rustdoc: add table-of-contents recording & rendering, use it with plain
markdown files. This means that # Foo ## Bar # Baz ### Qux ## Quz Gets a TOC like 1 Foo 1.1 Bar 2 Baz 2.0.1 Qux 2.1 Quz This functionality is only used when rendering a single markdown file, never on an individual module, although it could very feasibly be extended to allow modules to opt-in to a table of contents (std::fmt comes to mind).
This commit is contained in:
parent
69b8ef806b
commit
f22c96cc88
4 changed files with 312 additions and 12 deletions
|
@ -18,7 +18,7 @@ use getopts;
|
|||
use testing;
|
||||
|
||||
use html::escape::Escape;
|
||||
use html::markdown::{Markdown, find_testable_code, reset_headers};
|
||||
use html::markdown::{MarkdownWithToc, find_testable_code, reset_headers};
|
||||
use test::Collector;
|
||||
|
||||
fn load_string(input: &Path) -> io::IoResult<Option<~str>> {
|
||||
|
@ -145,7 +145,7 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int
|
|||
css = css,
|
||||
in_header = in_header,
|
||||
before_content = before_content,
|
||||
text = Markdown(text),
|
||||
text = MarkdownWithToc(text),
|
||||
after_content = after_content);
|
||||
|
||||
match err {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue