mdbook-toc
A preprocessor for mdbook to add inline Table of Contents support.
It turns this:
into a Table of Contents based on all top- and second-level headings of the chapter.
Installation
If you want to use only this preprocessor, install the tool:
Add it as a preprocessor to your book.toml
:
[]
= "mdbook-toc"
= ["html"]
Finally, build your book as normal:
Configuration
Custom TOC marker
The default marker is:
If you wish to use a different marker, such as the GitLab marker [[_TOC_]]
, you must add the following settings to your book.toml
.
[]
= "[[_TOC_]]"
You can also use multi-line markers such as the GitHub marker, which is:
*
Configure the string with a newline:
[]
= "* auto-gen TOC;\n{:toc}"
or with multi-line strings:
[]
= """* auto-gen TOC;
{:toc}"""
Maximum header level
By default the ToC will include headings up to level 4 (####
).
This can be configured in your book.toml
as follows:
[]
= 4
License
MPL. See LICENSE.
Copyright (c) 2018-2020 Jan-Erik Rediger janerik@fnordig.de