A traceable document preprocessor for mdbook.
mdbook-trace
provides a markdown extension to define a trace from the current document to a record in some external document. Each trace generates a footnote in the current page and is added to a trace table for the target document.
sh
cargo install mdbook-trace
Add an entry to book.toml
for each target document you'll be tracing to:
toml
[preprocessor.trace.targets.mydoc]
name = "My Document"
Then, in your markdown add a new trace:
markdown
Some traceable text {{#trace mydoc:ID-1.2 }}
This will be rendered as
Some traceable text[^1]
[^1]: My Document ID-1.2
Finally, update your markdown to generate a trace table for the target: ```markdown
{{#tracematrix mydoc }} ```
This will be rendered as
| Record | Traces | |--------|--------| | ID-1.2 | 1.1 |
Below is the full set of preprocessor configuration options and their default values: ```toml [preprocessor.trace]
qualified-footnotes = false
chapter-numbers = false
footnote-divider = false
record-heading = "Record"
trace-heading = "Traces"
parent-numbering = "zero" ```