Skip to content

Commit 37c772b

Browse files
committed
Move frontmatter intro and intro example ahead of grammar
Many of our existing chapters start directly with the grammar. We're shifting, however, toward leading with the introduction and with the introductory example. Let's do that for the frontmatter chapter.
1 parent ffe1518 commit 37c772b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/frontmatter.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
r[frontmatter]
22
# Frontmatter
33

4+
r[frontmatter.intro]
5+
Frontmatter is an optional section of metadata whose syntax allows external tools to read it without parsing Rust.
6+
7+
> [!EXAMPLE]
8+
> <!-- ignore: test runner doesn't support frontmatter -->
9+
> ```rust,ignore
10+
> #!/usr/bin/env cargo
11+
> --- cargo
12+
> package.edition = 2024
13+
> ---
14+
>
15+
> fn main() {}
16+
> ```
17+
418
r[frontmatter.syntax]
519
```grammar,lexer
620
@root FRONTMATTER ->
@@ -34,20 +48,6 @@ MAYBE_INFOSTRING_OR_WS ->
3448
INFOSTRING -> (XID_Start | `_`) ( XID_Continue | `-` | `.` )*
3549
```
3650
37-
r[frontmatter.intro]
38-
Frontmatter is an optional section of metadata whose syntax allows external tools to read it without parsing Rust.
39-
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-
> ```
50-
5151
r[frontmatter.position]
5252
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].
5353

0 commit comments

Comments
 (0)