Table of contents
A simple way of including other files, rust doc and table of content in a markdown file.
For a repo's README file, you'll create a README.tpl.md which you can edit like a normal markdown file, but with the added support for fenced includes which are TOML fences with an extra name containing the configuration of the include.
src/README.tpl.md:
My title
Include a table of content:
```toml toc
header = "# Table of contents"
```
Extracted from lib.rs' rust doc:
```toml rustdoc
source = "lib.rs"
```
To generate a README.md file you add a test:
```rust
fn updatereadme() { markdownincludes::update("src/README.tpl.md", "README.md").unwrap(); } ```
This test will update the README file if necessary, but if running in a CI pipeline (the CI environment variable is set), it will fail if the README.md needs updating.