Skip to content

Commit 4016ef8

Browse files
committed
docs(spec): assert an @example caption has a block beneath it
Claude-Session: https://claude.ai/code/session_01MkQhmuuJAVDjmeWNixwDDH Co-authored-by: Claude <noreply@anthropic.com>
1 parent a6cb2f3 commit 4016ef8

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
"@objectstack/spec": patch
3+
---
4+
5+
The reference-docs renderer now refuses an `@example CAPTION` with no code block beneath it,
6+
instead of publishing an orphaned caption.
7+
8+
`@example CAPTION` is declared to be *the caption of the fence beneath it*, and the renderer
9+
acts on that reading: it promotes the tag into a bold lead-in on the assumption that a fence
10+
follows. Nothing asserted that one did. When a module header captioned a listing and wrote its
11+
rows as bare prose, the promotion still fired and the rows below collapsed into a single run-on
12+
paragraph — consecutive non-blank lines are one markdown paragraph, and the docs site loads no
13+
`remark-breaks`. Two customer-facing reference pages shipped that way.
14+
15+
The assumption is now a precondition the generator checks before it emits anything. A module
16+
description whose caption has no block under it fails the docs build with a message naming the
17+
caption and the source-side fix, the way the renderer already refuses a heading it cannot
18+
renumber. Deliberately a refusal in the generator rather than a separate gate: it makes the
19+
wrong page impossible instead of detecting it afterwards, and it is scoped to the population
20+
the renderer actually renders — module doc blocks — rather than to every `@example` line in the
21+
package.
22+
23+
⛔ The check never asks whether a run of prose is "really" a table. Shape-sniffing is exactly
24+
what this renderer refuses to do, and what an author writes instead of a fence is not knowable
25+
from the text. It asks only the question the contract already states: is there a block beneath
26+
the caption? An author who wants those words as ordinary prose writes them without the tag.
27+
28+
Both code kinds satisfy it. An indented block reaches the page as a fence — the render loop
29+
re-emits it as one — so a caption above one captions a fence by the time a reader sees it. All
30+
twelve captions in the corpus are fenced today and are unaffected; no schema behavior changes.

0 commit comments

Comments
 (0)