docs(syntax): fix frontmatter examples that silently emptied the whole block #266

Merged
abiwab merged 1 commit from docs/frontmatter-densities-example into main 2026-11-26 10:31:34 +01:00
Owner

The frontmatter only reads flat key: value lines (KeyValue = emptyLine* key ":" sp* value nl in grammar.ohm). Two documented examples broke that rule, silently:

  • reference/syntax/document-structure.mdx (en + fr): the example emptied the whole frontmatter. Both its indented densities: list and its # Functional Fields comment line make Frontmatter fail, so the block is read as a step of text and meta is empty (checked with getAST). It now uses densities: [flour:0.55, milk:1.03] with no comment line; all 9 keys and both densities are read.
  • densities is described as an inline list instead of an "Object", and a caution aside under "YAML block" says only flat lines are read: a # … line or an indented line makes the whole block unreadable, and a trailing # is part of the value.
  • explanation/mass-and-yield.mdx (en + fr): densities: { flour: 0.55 } only worked by accident with one entry ({ flour: 0.55, water: 1 } gives no override at all). It now reads densities: [flour:0.55].

Docs only, no changeset. The snippet audit reports the same 126 flags as before.

Left for later on dev/1.6: the frontmatter examples of the gram-authoring skill and of gram-spec.ts carry trailing # … comments that end up in the values (AI spec examples test, PR 3 of the DX plan).

The frontmatter only reads flat `key: value` lines (`KeyValue = emptyLine* key ":" sp* value nl` in `grammar.ohm`). Two documented examples broke that rule, silently: - **`reference/syntax/document-structure.mdx`** (en + fr): the example emptied the whole frontmatter. Both its indented `densities:` list and its `# Functional Fields` comment line make `Frontmatter` fail, so the block is read as a step of text and `meta` is empty (checked with `getAST`). It now uses `densities: [flour:0.55, milk:1.03]` with no comment line; all 9 keys and both densities are read. - `densities` is described as an inline list instead of an "Object", and a caution aside under "YAML block" says only flat lines are read: a `# …` line or an indented line makes the whole block unreadable, and a trailing `#` is part of the value. - **`explanation/mass-and-yield.mdx`** (en + fr): `densities: { flour: 0.55 }` only worked by accident with one entry (`{ flour: 0.55, water: 1 }` gives no override at all). It now reads `densities: [flour:0.55]`. Docs only, no changeset. The snippet audit reports the same 126 flags as before. Left for later on `dev/1.6`: the frontmatter examples of the `gram-authoring` skill and of `gram-spec.ts` carry trailing `# …` comments that end up in the values (AI spec examples test, PR 3 of the DX plan).
docs(syntax): fix frontmatter examples that silently emptied the whole block
All checks were successful
CI / Build & Test (pull_request) Successful in 5m56s
8a2d256804
abiwab merged commit c02ba6c150 into main 2026-11-26 10:31:34 +01:00
abiwab deleted branch docs/frontmatter-densities-example 2026-11-26 10:31:34 +01:00
Sign in to join this conversation.
No description provided.