Skip to content
Prev Previous commit
Next Next commit
Flesh out the frontmatter removal section
The frontmatter removal section could do better at describing
the removal behavior.  Let's rewrite the section with a precise
description of the removal process and add an annotated example.
  • Loading branch information
traviscross committed Mar 11, 2026
commit d978d31a1ab7f96970f6163064aa876f24cef77c
16 changes: 15 additions & 1 deletion src/input-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,21 @@ If a [shebang] is present, it is removed from the input sequence (and is therefo
r[input.frontmatter]
## Frontmatter removal

After some [whitespace], [frontmatter] may next appear in the input.
r[input.frontmatter.removal]
If the remaining input begins with a [frontmatter] fence, optionally preceded by lines containing only [whitespace], the [frontmatter] and any preceding whitespace are removed.

For example, given the following file:

<!-- ignore: test runner doesn't support frontmatter -->
```rust,ignore
--- cargo
package.edition = "2024"
---

fn main() {}
```

The first three lines (the opening fence, body, and closing fence) would be removed, leaving an empty line followed by `fn main() {}`.

r[input.tokenization]
## Tokenization
Expand Down