1
- # Cargo documentation
2
-
3
- This directory contains Cargo's documentation. There are two parts, [ The Cargo
4
- Book] which is built with [ mdbook] and the man pages, which are built with
5
- [ mdman] .
1
+ # Documentation
2
+
3
+ Cargo has several types of documentation that contributors work with:
4
+
5
+ * [ The Cargo Book]
6
+ * The primary user-facing Cargo documentation
7
+ * Source at < https://github.com/rust-lang/cargo/tree/master/src/doc >
8
+ * Built with [ mdbook]
9
+ * Published through [ "the doc publishing process"]
10
+ * Man pages
11
+ * Man pages of the ` cargo ` command
12
+ * Built with [ mdman]
13
+ * Published through [ "the doc publishing process"]
14
+ * [ Contributor guide]
15
+ * This guide itself
16
+ * Source at < https://github.com/rust-lang/cargo/tree/master/src/doc/contrib >
17
+ * Published independently on GitHub Pages at
18
+ < https://rust-lang.github.io/cargo/contrib >
19
+ when committing to the master branch.
6
20
7
21
[ The Cargo Book ] : https://doc.rust-lang.org/cargo/
22
+ [ Crate API docs ] : https://docs.rs/cargo
23
+ [ Contributor guide ] : https://rust-lang.github.io/cargo/contrib
8
24
[ mdBook ] : https://github.com/rust-lang/mdBook
9
25
[ mdman ] : https://github.com/rust-lang/cargo/tree/master/crates/mdman/
26
+ [ "the doc publishing process" ] : ../process/release.md#docs-publishing
10
27
11
- ### Building the book
28
+ ## Building the book
12
29
13
30
Building the book requires [ mdBook] . To get it:
14
31
@@ -30,43 +47,63 @@ on the book:
30
47
rebuilds the book whenever any file changes and automatically reloads your
31
48
web browser.
32
49
33
- The book contents are driven by the [ ` SUMMARY.md ` ] ( src/SUMMARY.md ) file, and
34
- every file must be linked there.
50
+ The book contents are driven by a ` SUMMARY.md ` file,
51
+ and every file must be linked there.
52
+ See < https://rust-lang.github.io/mdBook/ > for its usage.
35
53
36
- ### Building the man pages
54
+ ## Building the man pages
37
55
38
- The man pages use a tool called [ mdman] to convert markdown to a man page
39
- format. Check out the documentation at
40
- [ ` mdman/doc/ ` ] ( ../../crates/mdman/doc/ )
41
- for more details.
56
+ The man pages use a tool called [ mdman] to convert Markdown templates into several output formats.
57
+ See < https://github.com/rust-lang/cargo/tree/master/crates/mdman/doc >
58
+ for usage details and template syntax.
42
59
43
- The man pages are converted from a templated markdown ( located in the
44
- [ ` src/doc/man/ ` ] ( man )
45
- directory) to three different formats:
60
+ The templates are located in
61
+ < https://github.com/rust-lang/cargo/tree/master/ src/doc/man>
62
+ and are converted into three formats:
46
63
47
- 1 . Troff-style man pages, saved in [ ` src/etc/man/ ` ] ( ../etc/man ) .
48
- 2 . Markdown (with some HTML) for the Cargo Book, saved in
49
- [ ` src/doc/src/commands/ ` ] ( src/commands ) .
50
- 3 . Plain text (needed for embedded man pages on platforms without man such as
51
- Windows), saved in [ ` src/doc/man/generated_txt/ ` ] ( man/generated_txt ) .
64
+ 1 . Troff man pages --- used by the ` cargo help ` command,
65
+ and by distributions to provide man pages which people can install,
66
+ saved in < https://github.com/rust-lang/cargo/tree/master/src/etc/man > .
67
+ 2 . Plain text --- used for embedded help on platforms without ` man ` (such as Windows),
68
+ saved in < https://github.com/rust-lang/cargo/tree/master/src/doc/man/generated_txt > .
69
+ 3 . Markdown (with some HTML) --- used for the Cargo Book,
70
+ saved in < https://github.com/rust-lang/cargo/tree/master/src/doc/src/commands > .
52
71
53
72
To rebuild the man pages, run ` cargo build-man ` inside the workspace.
54
73
55
- ### SemVer chapter tests
56
-
57
- There is a script to verify that the examples in the SemVer chapter work as
74
+ ## Writing guidelines
75
+
76
+ Cargo's documentation is a collective effort,
77
+ so there isn't a single fixed writing style.
78
+ We recommend following the style of the surrounding text to keep things consistent.
79
+
80
+ A few important guidelines:
81
+
82
+ * The [ Cargo Commands] ( https://doc.rust-lang.org/nightly/cargo/commands/index.html )
83
+ chapters in the book are generated from man page templates.
84
+ To update them, see the [ Building the man pages] ( #building-the-man-pages ) section.
85
+ Do not edit the generated Markdown files directly.
86
+ * Links to pages under < https://doc.rust-lang.org/ > should use relative paths.
87
+ This ensures versioned docs are redirected correctly.
88
+ For example, if you are at < https://doc.rust-lang.org/cargo/reference/config.html >
89
+ and want to link to < https://doc.rust-lang.org/rustc/codegen-options/index.html > ,
90
+ you should write the link as ` ../../rustc/codegen-options/index.html ` .
91
+ This rule doesn't apply if you specifically want to link to docs of a fixed version or channel.
92
+ * When renaming or removing any headings or pages,
93
+ make sure to set up proper redirects.
94
+ See [ rust-lang/cargo #11480 ] ( https://github.com/rust-lang/cargo/pull/11480 ) for an example.
95
+ * If a section refers to a concept explained elsewhere
96
+ (like profiles, features, or workspaces), link to it.
97
+ That keeps the book navigable without duplicating content.
98
+
99
+ ## SemVer chapter tests
100
+
101
+ There is a script to verify that the examples in [ the SemVer chapter] work as
58
102
intended. To run the tests, run ` cargo +stable run -p semver-check ` .
59
103
60
104
Note that these tests run on the most recent stable release because they
61
105
validate the output of the compiler diagnostics. The output can change between
62
106
releases, so we pin to a specific release to avoid frequent and unexpected
63
107
breakage.
64
108
65
- ## Contributing
66
-
67
- We'd love your help with improving the documentation! Please feel free to
68
- [ open issues] ( https://github.com/rust-lang/cargo/issues ) about anything, and
69
- send in PRs for things you'd like to fix or change. If your change is large,
70
- please open an issue first, so we can make sure that it's something we'd
71
- accept before you go through the work of getting a PR together.
72
-
109
+ [ the SemVer chapter ] : https://doc.rust-lang.org/nightly/cargo/reference/semver.html
0 commit comments