Skip to content

Commit bb76412

Browse files
committed
Revise frontmatter intro example
The example under `frontmatter.intro` used an external crate, a nontrivial script body, and a bare `rust` code block that would fail CI since the test runner doesn't support frontmatter. Let's simplify it to mirror the example in the frontmatter removal section of `input-format.md`, and let's wrap it in an `EXAMPLE` admonition consistent with our convention for examples that aren't demonstrating the behavior of a specific rule.
1 parent e97aac0 commit bb76412

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/frontmatter.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,16 @@ INFOSTRING -> (XID_Start | `_`) ( XID_Continue | `-` | `.` )*
3737
r[frontmatter.intro]
3838
Frontmatter is an optional section for content intended for external tools without requiring these tools to have full knowledge of the Rust grammar.
3939

40-
```rust
41-
#!/usr/bin/env cargo
42-
---
43-
[dependencies]
44-
fastrand = "2"
45-
---
46-
47-
fn main() {
48-
let num = fastrand::i32(..);
49-
println!("{num}");
50-
}
51-
```
40+
> [!EXAMPLE]
41+
> <!-- ignore: test runner doesn't support frontmatter -->
42+
> ```rust,ignore
43+
> #!/usr/bin/env cargo
44+
> --- cargo
45+
> package.edition = 2024
46+
> ---
47+
>
48+
> fn main() {}
49+
> ```
5250
5351
r[frontmatter.position]
5452
Frontmatter may appear at the start of the file (after the optional [byte order mark]) or after a [shebang]. In either case, it may be preceded by [whitespace].

0 commit comments

Comments
 (0)