Skip to content

Commit 68279a3

Browse files
committed
Flesh out the frontmatter removal section
The frontmatter removal section in `input-format.md` is a single sentence ("After some whitespace, frontmatter may next appear in the input") that doesn't clearly describe the removal behavior. By contrast, the shebang removal section provides a full description with an example. Let's rewrite the section with a precise description of the removal process and add an annotated example.
1 parent 8543ae8 commit 68279a3

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/input-format.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,21 @@ The shebang is removed from the input sequence (and is therefore ignored).
7272
r[input.frontmatter]
7373
## Frontmatter removal
7474

75-
After some [whitespace], [frontmatter] may next appear in the input.
75+
r[input.frontmatter.removal]
76+
If the remaining input begins with a [frontmatter] fence, optionally preceded by lines containing only [whitespace], the [frontmatter] and any preceding whitespace are removed.
77+
78+
For example, given the following file:
79+
80+
<!-- ignore: test runner doesn't support frontmatter -->
81+
```rust,ignore
82+
--- cargo
83+
package.edition = 2024
84+
---
85+
86+
fn main() {}
87+
```
88+
89+
The first three lines (the opening fence, body, and closing fence) would be removed, leaving an empty line followed by `fn main() {}`.
7690

7791
r[input.tokenization]
7892
## Tokenization

0 commit comments

Comments
 (0)