fix(format): format a fenced block the parser reads as a step like the body #285
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!285
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/format-fenced-block-not-frontmatter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #284.
The formatter's
splitFrontmattertook any----fenced block as frontmatter, while the parser'sFrontmatterrule acceptskey: valuelines only and reads anything else as a step. Rule 10 then stripped a trailing blank inside a block comment the parser keeps verbatim (fuzzformat-preserves-meaning), and rules 1-8 skipped the block's elements.frontmatterOf(): the textual split is kept only when the parser finds no span (element, comment, action, title) inside the fenced block; otherwise the whole file is body. A file that does not parse keeps the textual split (whitespace rules only). One extra parse, only when a fenced block opens the file.packages/format/tests/formatter.test.ts(both fail without the fix), plus the fuzz input infuzz/regressions/284-fenced-block-comment.gram.patchchangeset for@gram-lang/format.Checks: 3932 pass / 1 skip / 0 fail, conformance 142/142 and 24/24 with no golden change, typecheck, biome,
deprecations:check, audit 126, fuzz 50k (seed 2726604960, 0 signature).