rustdoc: make table of contents optional

rustdoc currently determines whether to produce a table of
contents (along with numbered sections) from the input type: yes for
markdown input, no for Rust input. This commit adds a flag to disable
the table of contents for markdown input, which is useful for embedding
the output in a larger context.
This commit is contained in:
Aaron Turon
2014-07-23 15:43:03 -07:00
committed by Alex Crichton
parent 62bddfa0a5
commit 31ac8a90f1
2 changed files with 13 additions and 5 deletions

View File

@@ -131,7 +131,8 @@ pub fn opts() -> Vec<getopts::OptGroup> {
Markdown file or generated documentation",
"FILES"),
optopt("", "markdown-playground-url",
"URL to send code snippets to", "URL")
"URL to send code snippets to", "URL"),
optflag("", "markdown-no-toc", "don't include table of contents")
)
}
@@ -220,7 +221,8 @@ pub fn main_args(args: &[String]) -> int {
return test::run(input, cfgs, libs, externs, test_args)
}
(false, true) => return markdown::render(input, output.unwrap_or(Path::new("doc")),
&matches, &external_html),
&matches, &external_html,
!matches.opt_present("markdown-no-toc")),
(false, false) => {}
}