Skip to content

Commit 6b16940

Browse files
Add documentation for rustdoc --no-source flag
1 parent 80443cb commit 6b16940

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Diff for: src/doc/rustdoc/src/command-line-arguments.md

+18
Original file line numberDiff line numberDiff line change
@@ -417,3 +417,21 @@ This flag is **deprecated** and **has no effect**.
417417
Rustdoc only supports Rust source code and Markdown input formats. If the
418418
file ends in `.md` or `.markdown`, `rustdoc` treats it as a Markdown file.
419419
Otherwise, it assumes that the input file is Rust.
420+
421+
## `--no-source`: prevent source code generation in HTML output format generation
422+
423+
Using this flag looks like this:
424+
425+
```bash
426+
$ rustdoc src/lib.rs --no-source
427+
```
428+
429+
By default, `rustdoc` renders the source code as HTML and links to it from the documentation. When
430+
this flag is used, `rustdoc` won't render the source code. `--no-source` is equivalent to the
431+
`#![doc(html_no_source)]` attribute:
432+
433+
```rust
434+
// lib.rs
435+
#![doc(html_no_source)]
436+
// your code
437+
```

Diff for: src/librustdoc/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,8 @@ fn opts() -> Vec<RustcOptGroup> {
533533
"emit",
534534
"Comma separated list of types of output for rustdoc to emit",
535535
"[unversioned-shared-resources,toolchain-shared-resources,invocation-specific]",
536+
)
537+
}),
536538
stable("no-source", |o| {
537539
o.optflag(
538540
"",

0 commit comments

Comments
 (0)