Skip to content

Commit a5c1d30

Browse files
committed
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.
1 parent 7a9f99b commit a5c1d30

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
@@ -47,7 +47,21 @@ If a [shebang] is present, it is removed from the input sequence (and is therefo
4747
r[input.frontmatter]
4848
## Frontmatter removal
4949

50-
After some [whitespace], [frontmatter] may next appear in the input.
50+
r[input.frontmatter.removal]
51+
If the remaining input begins with a [frontmatter] fence, optionally preceded by lines containing only [whitespace], the [frontmatter] and any preceding whitespace are removed.
52+
53+
For example, given the following file:
54+
55+
<!-- ignore: test runner doesn't support frontmatter -->
56+
```rust,ignore
57+
--- cargo
58+
package.edition = "2024"
59+
---
60+
61+
fn main() {}
62+
```
63+
64+
The first three lines (the opening fence, body, and closing fence) would be removed, leaving an empty line followed by `fn main() {}`.
5165

5266
r[input.tokenization]
5367
## Tokenization

0 commit comments

Comments
 (0)