diff --git a/docs/SKILL.md b/docs/SKILL.md index c274ec1..c84b049 100644 --- a/docs/SKILL.md +++ b/docs/SKILL.md @@ -18,5 +18,9 @@ thinking; the headings follow within 30 seconds, and a new section at least ever Plan one section, write it, then plan the next: never plan the whole document before its first section goes in. +**The person may be typing on the page while you write.** Docs pages open in Edit for +them. What they type is theirs: `docs.js` writes around it and never changes it, and +`blocks` shows it. Don't wait for them to stop, and don't repeat or undo what they wrote. + You write text, never the page: `docs.js` turns it into the page, shows it on every open tab and saves it. Never deploy, push or edit the page any other way. diff --git a/docs/assets/blank-starter-1.0.html b/docs/assets/blank-starter-1.0.html new file mode 100644 index 0000000..a906224 --- /dev/null +++ b/docs/assets/blank-starter-1.0.html @@ -0,0 +1,55 @@ + + + + + + +Document + + + + +
+
+ + diff --git a/docs/assets/docs.js b/docs/assets/docs.js index d6d5f20..04d61cf 100644 --- a/docs/assets/docs.js +++ b/docs/assets/docs.js @@ -35,6 +35,7 @@ const WRITING = path.join(__dirname, "..", "references", "writing.md"); const OUTLINE = path.join(__dirname, "..", "references", "outline.md"); const BLANK_LIVE_LINK = path.join(__dirname, "blank-live-link.html"), BLANK_LIVE_LINK_NODESC = path.join(__dirname, "blank-live-link-nodesc.html"); const BLANK_NEW_SPACE = path.join(__dirname, "blank-new-space.html"); +const BLANK_STARTER_1 = path.join(__dirname, "blank-starter-1.0.html"); const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; const PLACEHOLDER = "Writing…"; const WORDS_FAR = 600; // words no A4 page of the starter holds @@ -155,6 +156,67 @@ function ledgerMeta(html) { const LEDGER = { exec: (html) => { const t = ledgerMeta(html); return t ? [t] : null; } }; function ledgerOf(html) { const t = ledgerMeta(html), m = t && /content="([^"]*)"/.exec(t); if (!m) return null; try { return JSON.parse(decode(m[1])); } catch { return null; } } const ledgerTag = (L) => ``; +// The page opens in Edit: Spacesheep's frame reads when the page loads, and +// opens it in Edit for a person who may edit it (16 Nov 2026). The starter carries it. A page of this skill made +// before then gets it with its next save, as part of the ledger change every save makes, right after the ledger +// in its head; it takes effect the next time the page is opened. A page with a meta of that name already, with +// any value, keeps it as it is. start only reads, so it never adds it. +const EDIT_META = ''; +// An element's attributes as the browser reads its start tag: names lower-cased (ASCII only), the first of a +// repeated name kept, values in either quote or none, separated by whitespace or "/". Values are as written; +// attrText decodes them. +const HTML_WS = "\t\n\f\r "; +function attrsOf(html, el) { + const s = html.slice(el.start + 1 + el.name.length, el.openEnd - 1), out = new Map(), ws = (c) => HTML_WS.includes(c); + let i = 0; + while (i < s.length) { + while (i < s.length && (ws(s[i]) || s[i] === "/")) i++; + if (i >= s.length) break; + let j = i + 1; // a name's first character can be "=" + while (j < s.length && !ws(s[j]) && s[j] !== "/" && s[j] !== "=") j++; + const name = s.slice(i, j).replace(/[A-Z]/g, (c) => c.toLowerCase()); + i = j; + while (i < s.length && ws(s[i])) i++; + let value = ""; + if (s[i] === "=") { + i++; + while (i < s.length && ws(s[i])) i++; + if (s[i] === '"' || s[i] === "'") { const k = s.indexOf(s[i], i + 1), end = k < 0 ? s.length : k; value = s.slice(i + 1, end); i = end + 1; } + else { let k = i; while (k < s.length && !ws(s[k])) k++; value = s.slice(i, k); i = k; } + } + if (!out.has(name)) out.set(name, value); + } + return out; +} +// A value as the browser decodes it, as far as comparing it with a plain ASCII name needs: numeric references, +// with or without their ";", become their character (anything outside ASCII, or 0, as U+FFFD). No named reference +// stands for a letter, a digit or "-", so one is left as written: a value holding one equals no plain name, as in +// the browser. +const attrText = (v) => v.replace(/&#(?:[xX]([0-9a-fA-F]+)|([0-9]+));?/g, (m, h, d) => { const n = h ? parseInt(h, 16) : parseInt(d, 10); return n > 0 && n < 0x80 ? String.fromCharCode(n) : "\uFFFD"; }); +// A meta named ss-edit as the browser sees it: an element whose tag name is exactly "meta", whose name attribute +// (the first one) decodes to ss-edit, compared ASCII case-insensitively as meta names are. One inside a