Skip to content

Commit 98632ac

Browse files
authored
Rollup merge of #145617 - epage:style, r=joshtriplett
docs(style): Specify the frontmatter style Taken from [a style team discussion](rust-lang/style-team#212 (comment)). Assumptions on my part: - I specify that frontmatter fences should not have trailing whitespace - We aren't specifying when to include the infostring (one idea being if there is no shebang) - Keep it simple and have a single example instead of showing allowed several variations Tracking issue: #136889 Closes rust-lang/style-team#212
2 parents 4d94478 + 962b0f1 commit 98632ac

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/doc/style-guide/src/nightly.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,29 @@ This chapter documents style and formatting for nightly-only syntax. The rest of
55
Style and formatting for nightly-only syntax should be removed from this chapter and integrated into the appropriate sections of the style guide at the time of stabilization.
66

77
There is no guarantee of the stability of this chapter in contrast to the rest of the style guide. Refer to the style team policy for nightly formatting procedure regarding breaking changes to this chapter.
8+
9+
### Frontmatter
10+
11+
*Location: Placed before comments and attributes in the [root](index.html).*
12+
13+
*Tracking issue: [#136889](https://github.com/rust-lang/rust/issues/136889)*
14+
15+
*Feature gate: `frontmatter`*
16+
17+
There should be no blank lines between the frontmatter and either the start of the file or a shebang.
18+
There can be zero or one line between the frontmatter and any following content.
19+
20+
The frontmatter fences should use the minimum number of dashes necessary for the contained content (one more than the longest series of initial dashes in the
21+
content, with a minimum of 3 to be recognized as frontmatter delimiters).
22+
If an infostring is present after the opening fence, there should be one space separating them.
23+
The frontmatter fence lines should not have trailing whitespace.
24+
25+
```rust
26+
#!/usr/bin/env cargo
27+
--- cargo
28+
[dependencies]
29+
regex = "1"
30+
---
31+
32+
fn main() {}
33+
```

0 commit comments

Comments
 (0)