Format: a fenced block the parser reads as a step is formatted as frontmatter #284
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#284
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found by the fuzz (
format-preserves-meaning … at $.sections[].steps[], seed 3293311318, index 8841 ondev/1.6), present onmainanddev/1.6.The formatter's
splitFrontmattertakes any block fenced by---lines as frontmatter, while the parser'sFrontmatterrule acceptskey: valuelines only: a block holding anything else is read as a step, with its comments and elements. The formatter then applies rule 10 (trailing blanks) to that "frontmatter", including inside a block comment the parser keeps verbatim, and skips rules 1-8 on its elements:The comment's value goes from
"This \nis a block comment"to"This\nis a block comment"aftergram format.Fix: keep the textual split only when the parser finds no span (element, comment, action, title) inside the fenced block; otherwise the whole file is body.