]> git.lizzy.rs Git - rust.git/commit
rustdoc: add table-of-contents recording & rendering, use it with plain
authorHuon Wilson <dbau.pp+github@gmail.com>
Fri, 7 Mar 2014 14:13:17 +0000 (01:13 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Sun, 9 Mar 2014 08:29:49 +0000 (19:29 +1100)
commitf22c96cc888eac4c1c5d44ea4765e5c2a65f64f3
tree697fce4442d4fa82d11fb6476610a00f518a617d
parent69b8ef806b3742ba7d41a77cd216713c84f36254
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).
src/librustdoc/html/markdown.rs
src/librustdoc/html/toc.rs [new file with mode: 0644]
src/librustdoc/lib.rs
src/librustdoc/markdown.rs