Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

mdbook-toc

> 编程语言
Open source

A preprocessor for mdbook to add inline Table of Contents support.

193 stars0 likes0 views
WebsiteGitHub

About

A preprocessor for mdbook to add inline Table of Contents support.

mdbook-toc

A preprocessor for mdbook to add inline Table of Contents support.

It turns this marker:

markdown

into a Table of Contents based on headings of the chapter following the marker.

Installation

If you want to use only this preprocessor, install the tool:

bash
cargo install mdbook-toc

Add it as a preprocessor to your book.toml:

toml
[preprocessor.toc]
command = "mdbook-toc"
renderer = ["html"]

Finally, build your book as normal:

bash
mdbook path/to/book

Configuration

Custom TOC marker

The default marker is:

markdown

If you wish to use a different marker, such as the GitLab marker [[_TOC_]], you must add the following settings to your book.toml.

toml
[preprocessor.toc]
marker = "[[_TOC_]]"

You can also use multi-line markers such as the GitHub marker, which is:

markdown
* auto-gen TOC;
{:toc}

Configure the string with a newline:

toml
[preprocessor.toc]
marker = "* auto-gen TOC;\n{:toc}"

or with multi-line strings:

toml
[preprocessor.toc]
marker = """* 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:

toml
[preprocessor.toc]
max-level = 4

License

MPL. See LICENSE.
Copyright (c) 2018-2020 Jan-Erik Rediger

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言