diff --git a/AGENTS.md b/AGENTS.md index 771f2ca..55938e7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -100,7 +100,10 @@ reuses a code where one fits; the list is complete at `0.1.0`. A code names the cause; where one cause recurs across node types, across one mark's attributes or across directions, one code covers them all and `path` and `message` say which — `unsupported-nesting-depth` is the 500-level guard whichever -direction hits it, `unspellable-link` the destination and the title alike. A claim code names the spelling claimed, never the node that spelling would have built: +direction hits it, `unspellable-link` the destination and the title alike. Where two codes stay +apart, the line between them is what they name: `unspellable-character` is a character CommonMark +rewrites wherever text holds it, `unspellable-whitespace` the newline no inline directive's +content slot spans, in either direction. A claim code names the spelling claimed, never the node that spelling would have built: a malformed `:::table` is a `malformed-directive`, and an alignment colon a `malformed-pipe-table` — the flavour's own delimiter row is `-` runs, so the grammar refuses the colon rather than ADF's missing column model doing it. A refusal no spelling recovers from is a gap in the flavour rather @@ -108,7 +111,11 @@ than a code: give the flavour the spelling and the code goes, which the freeze i for. A cause the carry answers gets no code: a mark no spelling writes rides the carry with its node. A directive whose name reads back to no node is `unknown-directive-name` rather than a claim code — the spelling is well formed, and telling that -apart from a typo is what a consumer switches on when a later MINOR gives the name meaning. What +apart from a typo is what a consumer switches on when a later MINOR gives the name meaning. A +reserved name is a known name, so never that code, and the two the flavour reserves part on form: +a form the grammar does not have is a claim code — `::adf`, whose carry is the fence — and a +well-formed form in the wrong place is `unsupported-node-shape`, `::listBreak` parting anything +but two adjacent lists of one type. What the grammar itself refuses stays a claim code, key order among it; a well-formed directive the node tables refuse — an attribute a node does not hold or spells elsewhere, a value outside its kind or its canonical spelling, an argument or a body its content model does not take — is diff --git a/corpus/round-trip/block-nodes/adjacent-lists.json b/corpus/round-trip/block-nodes/adjacent-lists.json index 3038748..21453bc 100644 --- a/corpus/round-trip/block-nodes/adjacent-lists.json +++ b/corpus/round-trip/block-nodes/adjacent-lists.json @@ -127,6 +127,54 @@ } ], "type": "panel" + }, + { + "content": [ + { + "content": [ + { + "content": [ + { + "content": [ + { + "content": [ + { + "text": "Head", + "type": "text" + } + ], + "type": "paragraph" + } + ], + "type": "listItem" + } + ], + "type": "bulletList" + }, + { + "content": [ + { + "content": [ + { + "content": [ + { + "text": "Tail", + "type": "text" + } + ], + "type": "paragraph" + } + ], + "type": "listItem" + } + ], + "type": "bulletList" + } + ], + "type": "listItem" + } + ], + "type": "bulletList" } ], "type": "doc", diff --git a/corpus/round-trip/block-nodes/adjacent-lists.md b/corpus/round-trip/block-nodes/adjacent-lists.md index dc50549..893ca28 100644 --- a/corpus/round-trip/block-nodes/adjacent-lists.md +++ b/corpus/round-trip/block-nodes/adjacent-lists.md @@ -15,3 +15,9 @@ ::listBreak - Right ::: + +- - Head + + ::listBreak + + - Tail diff --git a/corpus/round-trip/combinations/carve-out-pipe-table-bare.json b/corpus/round-trip/combinations/carve-out-pipe-table-bare.json new file mode 100644 index 0000000..7b7dca4 --- /dev/null +++ b/corpus/round-trip/combinations/carve-out-pipe-table-bare.json @@ -0,0 +1,38 @@ +{ + "content": [ + { + "content": [ + { + "text": "Part | Qty", + "type": "text" + }, + { + "type": "hardBreak" + }, + { + "text": "--- | ---", + "type": "text" + } + ], + "type": "paragraph" + }, + { + "content": [ + { + "text": "Part | Qty", + "type": "text" + }, + { + "type": "hardBreak" + }, + { + "text": ":--- | ---:", + "type": "text" + } + ], + "type": "paragraph" + } + ], + "type": "doc", + "version": 1 +} diff --git a/corpus/round-trip/combinations/carve-out-pipe-table-bare.md b/corpus/round-trip/combinations/carve-out-pipe-table-bare.md new file mode 100644 index 0000000..5eab2d7 --- /dev/null +++ b/corpus/round-trip/combinations/carve-out-pipe-table-bare.md @@ -0,0 +1,5 @@ +Part | Qty\ +\--- | --- + +Part | Qty\ +\:--- | ---: diff --git a/spec/flavour.md b/spec/flavour.md index ff0425e..d7aa560 100644 --- a/spec/flavour.md +++ b/spec/flavour.md @@ -26,7 +26,8 @@ normalizes to it through the round-trip. second list on merges instead: ADF records no tightness, so one `- ` spelling reads two adjacent lists of a kind back as one. The leaf `::listBreak` parts them, taking the separation any directive block takes where it sits. It builds no node, and it reads only between two - adjacent lists of one type: elsewhere, or carrying an argument or `{attrs}`, it is a named error. + adjacent lists of one type: elsewhere, or carrying an argument, `{attrs}` or a body, it is a + named error. - Blockquotes prefix lines with `> `; a blank line inside a blockquote is a bare `>`. - ATX headings (`#` … `######`); setext input normalizes to ATX. - Code fences ``` with the node's language as info string, the fence lengthened past any backtick @@ -296,9 +297,9 @@ takes the directive form instead. A pipe table parses back to exactly that shape Claiming at block level, symmetric with directives: a line opening with an unescaped `|` is claimed and must parse as part of a pipe table, else it is a named error — escape the pipe (`\|`) to keep it literal text. The shape a missing leading pipe leaves is claimed too: a line -holding an unescaped `|`, followed inside one paragraph by a line whose cells are all `-` runs -and match it in count — GFM's table without the outer pipes — is a named error rather than the -prose it reads as. A pipe table is a header row, a delimiter row whose cells are +holding an unescaped `|`, followed inside one paragraph by a line whose cells are all `-` runs, +an alignment colon among them, and match it in count — GFM's table without the outer pipes — is +a named error rather than the prose it reads as. A pipe table is a header row, a delimiter row whose cells are runs of one or more `-` (canonical `---`), and body rows; rows follow code-fence indentation. Cells split on unescaped `|` before inline parsing — `\|` stays in the cell text, and the inline layer's ordinary CommonMark escaping yields the pipe; each cell is the inline content of diff --git a/src/markdown/list-break.ts b/src/markdown/list-break.ts index d12bc99..132b818 100644 --- a/src/markdown/list-break.ts +++ b/src/markdown/list-break.ts @@ -1,5 +1,3 @@ -const name = 'listBreak' +export const listBreakName = 'listBreak' -export const listBreakName = name - -export const listBreakSpelling = `::${name}` +export const listBreakSpelling = `::${listBreakName}`