Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/badboy/mdbook-toc
A preprocessor for mdbook to add inline Table of Contents support.
https://github.com/badboy/mdbook-toc
Last synced: 7 days ago
JSON representation
A preprocessor for mdbook to add inline Table of Contents support.
- Host: GitHub
- URL: https://github.com/badboy/mdbook-toc
- Owner: badboy
- License: mpl-2.0
- Created: 2018-07-19T16:10:16.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-04-04T10:16:43.000Z (7 months ago)
- Last Synced: 2024-10-13T22:44:39.092Z (26 days ago)
- Language: Rust
- Homepage:
- Size: 332 KB
- Stars: 165
- Watchers: 4
- Forks: 20
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - badboy/mdbook-toc - A preprocessor for mdbook to add inline Table of Contents support. (others)
README
# mdbook-toc
A preprocessor for [mdbook][] to add inline Table of Contents support.
[mdbook]: https://github.com/rust-lang-nursery/mdBook
It turns this marker:
```md
```
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:
```sh
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:
```sh
mdbook path/to/book
```## Configuration
### Custom TOC marker
The default marker is:
```md
```
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:
```md
* 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](LICENSE).
Copyright (c) 2018-2020 Jan-Erik Rediger