Skip to content

Commit 00d7417

Browse files
committed
Move markdown formatting to the contributor guide
1 parent b7f3aa6 commit 00d7417

File tree

3 files changed

+46
-32
lines changed

3 files changed

+46
-32
lines changed

contributor-guide/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- [mdbook-spec](tooling/mdbook-spec.md)
99
- [Tests]()
1010
- [Formatting](formatting/index.md)
11-
- [Markdown]()
11+
- [Markdown](formatting/markdown.md)
1212
- [Admonitions]()
1313
- [Language rules]()
1414
- [rustc test annotations]()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Markdown
2+
3+
There are automated checks for some of these rules. Run [`cargo xtask style-check`] to run them locally.
4+
5+
## Formatting style
6+
7+
- Use [ATX-style headings][atx] (not Setext) with [sentence case].
8+
- Do not use tabs, only spaces.
9+
- Files must end with a newline.
10+
- Lines must not end with spaces. Double spaces have semantic meaning, but can be invisible. Use a trailing backslash if you need a hard line break.
11+
- If possible, avoid double blank lines.
12+
- Do not wrap long lines. This helps with reviewing diffs of the source.
13+
- Use [smart punctuation] instead of Unicode characters. For example, use `---` for em-dash instead of the Unicode character. Characters like em-dash can be difficult to see in a fixed-width editor, and some editors may not have easy methods to enter such characters.
14+
- See the [admonitions chapter] for formatting callouts such as notes, edition differences, and warnings.
15+
16+
## Code blocks
17+
18+
- Do not use indented code blocks; use 3+ backticks code blocks instead.
19+
- Code blocks should have an explicit language tag.
20+
21+
## Links
22+
23+
See the [links chapter] for more information about linking.
24+
25+
- Links to other chapters should be relative with the `.md` extension.
26+
- Links to other rust-lang books that are published with the Reference should also be relative so that the linkchecker can validate them. See [outside book links].
27+
- Links to the standard library should use rustdoc-style links described in [standard library links].
28+
- The use of reference links is preferred, with shortcuts if appropriate. Place the sorted link reference definitions at the bottom of the file or at the bottom of a section if there are an unusually large number of links that are specific to the section.
29+
30+
```markdown
31+
Example of shortcut link: [enumerations]
32+
Example of reference link with label: [block expression][block]
33+
34+
[block]: expressions/block-expr.md
35+
[enumerations]: types/enum.md
36+
```
37+
38+
[`cargo xtask style-check`]: ../tests.md#style-checks
39+
[admonitions chapter]: admonitions.md
40+
[atx]: https://spec.commonmark.org/0.31.2/#atx-headings
41+
[links chapter]: ../links.md
42+
[outside book links]: ../links.md#outside-book-links
43+
[sentence case]: https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case
44+
[smart punctuation]: https://rust-lang.github.io/mdBook/format/markdown.html#smart-punctuation
45+
[standard library links]: ../links.md#standard-library-links

docs/authoring.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,6 @@ This document serves as a guide for editors and reviewers. Some conventions and
44

55
[introduction]: ../src/introduction.md
66

7-
## Markdown formatting
8-
9-
* Use [ATX-style headings][atx] (not Setext) with [sentence case].
10-
* Do not use tabs, only spaces.
11-
* Files must end with a newline.
12-
* Lines must not end with spaces. Double spaces have semantic meaning, but can be invisible. Use a trailing backslash if you need a hard line break.
13-
* If possible, avoid double blank lines.
14-
* Do not use indented code blocks; use 3+ backticks code blocks instead.
15-
* Code blocks should have an explicit language tag.
16-
* Do not wrap long lines. This helps with reviewing diffs of the source.
17-
* Use [smart punctuation] instead of Unicode characters. For example, use `---` for em-dash instead of the Unicode character. Characters like em-dash can be difficult to see in a fixed-width editor, and some editors may not have easy methods to enter such characters.
18-
* Links should be relative with the `.md` extension. Links to other rust-lang books that are published with the reference should also be relative so that the linkchecker can validate them.
19-
* Links to the standard library should use rustdoc-style links described in [Standard library links](#standard-library-links).
20-
* The use of reference links is preferred, with shortcuts if appropriate. Place the sorted link reference definitions at the bottom of the file, or at the bottom of a section if there are an unusually large number of links that are specific to the section.
21-
22-
```markdown
23-
Example of shortcut link: [enumerations]
24-
Example of reference link with label: [block expression][block]
25-
26-
[block]: expressions/block-expr.md
27-
[enumerations]: types/enum.md
28-
```
29-
* See the [Conventions] section for formatting callouts such as notes, edition differences, and warnings.
30-
31-
There are automated checks for some of these rules. Run `cargo xtask style-check` to run them locally.
32-
33-
[atx]: https://spec.commonmark.org/0.31.2/#atx-headings
34-
[conventions]: ../src/introduction.md#conventions
35-
[sentence case]: https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case
36-
[smart punctuation]: https://rust-lang.github.io/mdBook/format/markdown.html#smart-punctuation
37-
387
### Code examples
398

409
Code examples should use code blocks with triple backticks. The language should always be specified (such as `rust`).

0 commit comments

Comments
 (0)