Skip to content

Instantly share code, notes, and snippets.

// // Reduce empty block height for read-only mode.
// //
// // Expected to be `h:0.6` or `12px`.
// const reduceEmpty = (readOnly, children) => ({ height: readOnly && !children && "calc(0.75 * var(--fs-mod) * var(--fs) * var(--lh))" })
// // Insert a tab character.
// tab() {
// let { data, pos1, pos2 } = editorState // Use `let`.
// if (data.slice(pos1, pos2).indexOf("\n") === -1) {
// data = data.slice(0, pos1) + "\t" + data.slice(pos2)
// pos1 += "\t".length
// this.setState({ data, pos1, pos2: pos1 })
// return
// }
// let x1 = pos1 // Use `let`.

0.2.10: UL and OL

The following is the proposed markdown and HTML specs for unordered lists, e.g. UL and ordered lists, e.g. OL.

#ul-and-ol #edge-cases

UL and OL

Here’s the proposed spec for unordered lists:

function reducer(editorState, action) {
switch (action.type) {
// Set the editor’s render mode.
case "SET_RENDER_MODE":
return { ...editorState, renderMode: action.payload }
// Set the editor’s read-only mode.
case "SET_READ_ONLY":
return { ...editorState, readOnly: action.payload }
// Set the editor’s state.
// Version 2019-09-13.
//
// See data.iana.org/TLD/tlds-alpha-by-domain.txt for
// reference.
const domains = { "aaa": true, "aarp": true, "abarth": true, "abb": true, "abbott": true, "abbvie": true, "abc": true, "able": true, "abogado": true, "abudhabi": true, "ac": true, "academy": true, "accenture": true, "accountant": true, "accountants": true, "aco": true, "actor": true, "ad": true, "adac": true, "ads": true, "adult": true, "ae": true, "aeg": true, "aero": true, "aetna": true, "af": true, "afamilycompany": true, "afl": true, "africa": true, "ag": true, "agakhan": true, "agency": true, "ai": true, "aig": true, "aigo": true, "airbus": true, "airforce": true, "airtel": true, "akdn": true, "al": true, "alfaromeo": true, "alibaba": true, "alipay": true, "allfinanz": true, "allstate": true, "ally": true, "alsace": true, "alstom": true, "am": true, "americanexpress": true, "americanfamily": true, "amex": true, "amfam": true, "amica": true, "amsterdam": true, "analytics": true, "android": true, "anquan": true, "
//FIXME: `--`.
function Strikethrough(props) {
const x1 = "~".length
const x2 = props.children.length - "~".length
if (props.renderMarkup) {
return (
<strike className={props.renderSemanticClasses ? "strikethrough" : null}>
{props.children.slice(x1, x2)}
</strike>
)
@zaydek-old
zaydek-old / test.md
Last active September 6, 2019 07:56

this is code

and so is

package main

import "fmt"

func main() {
@zaydek-old
zaydek-old / NewNoteV02.js
Created September 5, 2019 15:41
Alpha development for the Codex editor
import React from "react"
import ReactDOMServer from "react-dom/server"
import globals from "./globals"
import "./NewNoteV02.css"
function H1(props) {
const x1 = "# ".length
if (props.renderMarkup) {
@zaydek-old
zaydek-old / test.md
Last active September 4, 2019 01:24

1

2

3

4

5

6 > > > >> 7

@zaydek-old
zaydek-old / NewNoteV02.js
Last active September 3, 2019 16:00
Alpha development for v0.2 of the Codex editor opencodex.dev
import React from "react"
import globals from "./globals"
import "./NewNoteV02.css"
/*
* LexerComponents.js
*/
const H1 = props => <h1 className="fw:700 c:gray-900">{!props.readOnly && <span className="c:gray-900"># </span>}{props.children.slice("# ".length)}</h1>