blob: 791e1be84fe6e60265d294ad6fb826112d1c68cd [file] [log] [blame]
Jeff Vander Stoep956d1432020-09-18 13:46:24 +02001.TH RUSTDOC "1" "September 2020" "rustdoc 1.46.0" "User Commands"
2.SH NAME
3rustdoc \- generate documentation from Rust source code
4.SH SYNOPSIS
5.B rustdoc
6[\fIOPTIONS\fR] \fIINPUT\fR
7
8.SH DESCRIPTION
9This tool generates API reference documentation by extracting comments from
10source code written in the Rust language, available at
11<\fBhttps://www.rust-lang.org\fR>. It accepts several input formats and
12provides several output formats for the generated documentation.
13
14.SH OPTIONS
15
16.TP
17\fB\-r\fR, \fB\-\-input\-format\fR \fIFORMAT\fR
18rust
19.TP
20\fB\-w\fR, \fB\-\-output\-format\fR \fIFORMAT\fR
21html
22.TP
23\fB\-o\fR, \fB\-\-output\fR \fIOUTPUT\fR,
24where to place the output (default: \fIdoc/\fR for html)
25.TP
26\fB\-\-passes\fR \fILIST\fR
27space\[hy]separated list of passes to run (default: '')
28.TP
29\fB\-\-no\-defaults\fR
30don't run the default passes
31.TP
32\fB\-\-plugins\fR \fILIST\fR
33space-separated list of plugins to run (default: '')
34.TP
35\fB\-\-plugin\-path\fR \fIDIR\fR
36directory to load plugins from (default: \fI/tmp/rustdoc_ng/plugins\fR)
37.TP
38\fB\-\-target\fR \fITRIPLE\fR
39target triple to document
40.TP
41\fB\-\-crate\-name\fR \fINAME\fR
42specify the name of this crate
43.TP
44\fB\-L\fR, \fB\-\-library\-path\fR \fIDIR\fR
45directory to add to crate search path
46.TP
47\fB\-\-cfg\fR \fISPEC\fR
48pass a \fI\-\-cfg\fR to rustc
49.TP
50\fB\-\-extern\fR \fIVAL\fR
51pass an \fI\-\-extern\fR to rustc
52.TP
53\fB\-\-test\fR
54run code examples as tests
55.TP
56\fB\-\-test\-args\fR \fIARGS\fR
57pass arguments to the test runner
58.TP
59\fB\-\-html\-in\-header\fR \fIFILE\fR
60file to add to <head>
61.TP
62\fB\-\-html\-before\-content\fR \fIFILES\fR
63files to include inline between <body> and the content of a rendered Markdown
64file or generated documentation
65.TP
66\fB\-\-markdown\-before\-content\fR \fIFILES\fR
67files to include inline between <body> and the content of a rendered
68Markdown file or generated documentation
69.TP
70\fB\-\-html\-after\-content\fR \fIFILES\fR
71files to include inline between the content and </body> of a rendered
72Markdown file or generated documentation
73.TP
74\fB\-\-markdown\-after\-content\fR \fIFILES\fR
75files to include inline between the content and </body> of a rendered
76Markdown file or generated documentation
77.TP
78\fB\-\-markdown\-css\fR \fIFILES\fR
79CSS files to include via <link> in a rendered Markdown file Markdown file or
80generated documentation
81.TP
82\fB\-\-markdown\-playground\-url\fR \fIURL\fR
83URL to send code snippets to
84.TP
85\fB\-\-markdown\-no\-toc\fR
86don't include table of contents
87.TP
88\fB\-h\fR, \fB\-\-extend\-css\fR
89to redefine some css rules with a given file to generate doc with your own theme
90.TP
91\fB\-V\fR, \fB\-\-version\fR
92Print rustdoc's version
93
94.SH "OUTPUT FORMATS"
95
96The rustdoc tool can generate output in an HTML format.
97
98If using an HTML format, then the specified output destination will be the root
99directory of an HTML structure for all the documentation.
100Pages will be placed into this directory, and source files will also
101possibly be rendered into it as well.
102
103.SH "EXAMPLES"
104
105To generate documentation for the source in the current directory:
106 $ rustdoc hello.rs
107
108List all available passes that rustdoc has, along with default passes:
109 $ rustdoc \-\-passes list
110
111The generated HTML can be viewed with any standard web browser.
112
113.SH "SEE ALSO"
114
115.BR rustc (1)
116
117.SH "BUGS"
118See <\fBhttps://github.com/rust\-lang/rust/issues\fR>
119for issues.
120
121.SH "AUTHOR"
122See the version control history or <\fBhttps://thanks.rust\-lang.org\fR>
123
124.SH "COPYRIGHT"
125This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.
126See \fICOPYRIGHT\fR file in the rust source distribution.