32 - a mark's attribute depth is counted from its value, the marks spelling refusing its own #121

Merged
lilleman merged 3 commits from 32 into main 2026-09-23 22:53:35 +02:00
3 changed files with 20 additions and 21 deletions
Showing only changes of commit d3a2129967 - Show all commits
+7 -13
View File
@@ -158,20 +158,14 @@ converts no raw HTML, so at `0.2.0` the mapped elements stop erroring and the co
no ADF node carries. A refusal found before its path is known — the block walk's, a directive
reader's — is a `ConvertFault`, the code and message alone; the node walk attaches the path as it
descends, so a document reports its first error in document order. `not-an-adf-document` carries
the document's own path throughout: eight of the guard's nine branches read the document's own
shape, and threading a path to the ninth — a malformed node anywhere in the tree — wants the
the document's own path throughout: seven of the guard's eight branches read the document's own
shape, and threading a path to the eighth — a malformed node anywhere in the tree — wants the
manual stack §11's no-recursion rule forces, whose empty half no input reaches. The message names
the violation instead. Depth is not one of the nine: `adfDocumentFault` returns the code with the
message, so an attribute value past 500 levels is `unsupported-nesting-depth` from the emitter as
it already is from the parser, both directions refusing the same value. An attribute, a node's or
a mark's, is counted from the value itself, never from the `attrs` object holding it; a spelling
nesting the value deeper — the block directive's marks attribute, three levels in, or the carry —
refuses in its own format, as that format's parser does. `isAdfDocument` is true for a depth fault:
a deep document is a document, as the 2000-level blocks and the 600-deep marks the guard already
waves through are, and depth is the walks' answer rather than the shape's. A non-finite number
stays parted where depth is joined: the parse says `unsupported-node-shape` because the markdown is
at fault, the emit `not-an-adf-document` because the input is, and unlike depth nothing round-trips
inconsistently between them.
the violation instead. An attribute value past 500 levels is `unsupported-nesting-depth` in both
directions, the guard included. An attribute is counted from its value; a spelling that nests it
deeper — the block directive's `marks`, the carry — refuses in its own format, as its parser does.
A non-finite number takes two codes: `unsupported-node-shape` parsing, `not-an-adf-document`
emitting — no document holds one, so no round-trip crosses them.
`position` is the parse side's alone: an emitter reads no source, so an emit error carries `path`
and nothing more. It is `{ line, offset }` at the start of the line the block holding the refusal
+12
View File
@@ -1018,6 +1018,18 @@ The done `todo.md` items in full, as they were written. `todo.md` keeps a one-li
`parse/` imports `emit/` twice — `commonMarkSpelling` and `openingLinkTakesDirective` — and
§11 says those two are the whole of the seam a `../emit/` grep under `parse/` reads.
- [x] **32 — The mark depth `adf/` counts is stated in ADF's terms (`0.2.0`).**
`document.ts`'s `markAttributeNesting` is `largestNesting - 3`, and both the comment above it
and AGENTS.md §8 give the reason as markdown's: the block directive spells the whole mark set
as one JSON attribute, so the parser reads the value at the bottom of array, mark and
`attrs`. That is a format's spelling deciding a constant inside the directory §11 forbids to
know a format. Move the derivation to where that spelling lives, or state the three levels in
ADF's own vocabulary. Before 7 gives the constant a second format whose spelling may not
spend the same three levels.
**Done** (2026-09-23): `adf/` counts a mark's attribute from its value at 500, as a node's;
the block directive's `marks` spelling refuses its own over-deep JSON with the parser's
message and the node's path, and §8 says a deeper spelling refuses in its own format.
## 5 — Ship `0.1.0`
- [ ] **5 — Ship `0.1.0`.** Only the maintainer's own acts are left (§15): make the Gitea repo
+1 -8
View File
@@ -56,14 +56,6 @@ chunk clearing a §11 seam.
upward, so the first raise to the measured figure reddens a run that changed nothing. Make
the measurement repeatable, or state the number the floor may be raised to and why it is not
the measured one.
- [ ] **32 — The mark depth `adf/` counts is stated in ADF's terms (`0.2.0`).**
`document.ts`'s `markAttributeNesting` is `largestNesting - 3`, and both the comment above it
and AGENTS.md §8 give the reason as markdown's: the block directive spells the whole mark set
as one JSON attribute, so the parser reads the value at the bottom of array, mark and
`attrs`. That is a format's spelling deciding a constant inside the directory §11 forbids to
know a format. Move the derivation to where that spelling lives, or state the three levels in
ADF's own vocabulary. Before 7 gives the constant a second format whose spelling may not
spend the same three levels.
- [ ] **23 — The block-directive fragments are one file (`0.2.0`).** `block-directive-arguments.ts`,
`-forms.ts` and `-marks.ts` are three files under 25 lines answering one question. Fold them,
and take `src/markdown/` — the worst level both architects named, 13 entries with no
@@ -292,6 +284,7 @@ chunk clearing a §11 seam.
- [x] **28 — `emitLine`'s retry loop cannot spin (`0.2.0`).**
- [x] **29 — The README reads raw HTML as refused for good (`0.2.0`).**
- [x] **30 — AGENTS.md says each thing once (`0.2.0`).**
- [x] **32 — The mark depth `adf/` counts is stated in ADF's terms (`0.2.0`).**
## The ADF inventory to cover