Skip to content

Commit 4bfe8b4

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. The "some" is ambiguous (does it mean "a quantity of" or "certain"?), and "may next appear" is slightly awkward. 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 2bf3530 commit 4bfe8b4

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/input-format.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,20 @@ 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+
If the remaining input begins with a [frontmatter] fence, optionally preceded by lines containing only [whitespace], the [frontmatter] and any preceding whitespace are removed.
76+
77+
For example, given the following file:
78+
79+
<!-- ignore: test runner doesn't support frontmatter -->
80+
```rust,ignore
81+
--- cargo
82+
package.edition = 2024
83+
---
84+
85+
fn main() {}
86+
```
87+
88+
The first three lines (the opening fence, body, and closing fence) would be removed, leaving an empty line followed by `fn main() {}`.
7689

7790
r[input.tokenization]
7891
## Tokenization

0 commit comments

Comments
 (0)