Crates.io | mdbook_header_footer |
lib.rs | mdbook_header_footer |
version | 0.0.1 |
source | src |
created_at | 2024-09-13 07:45:42.851035 |
updated_at | 2024-09-13 21:54:01.533668 |
description | mdBook preprocessor to prepend header and append footer to certain chapters |
homepage | |
repository | https://github.com/SichangHe/mdbook_header_footer |
max_upload_size | |
id | 1373457 |
size | 47,578 |
This mdBook preprocessor prepends headers and appends footers to
all chapters in the book whose URL path match the corresponding regex.
The headers and footers are two lists of object with the regex
and padding
string fields, where regex
specifies what Regex the URL path needs to
match and padding
specifies what to pad.
regex
is optional, if not specified, it will match all paths (.*
).
For example, if you add the following to your book.toml
:
[preprocessor.header-footer]
headers = [{ regex = "^notes/", padding = "Notes\n" }]
footers = [{ padding = "\nHaha" }]
Then, all chapters whose URL path starts with notes/
will have Notes
plus a newline prepended to the top of the chapter;
all chapters will have a newline plus Haha
appended to the bottom of
the chapter.
cargo install mdbook_header_footer
We use tracing-subscriber
with the env-filter
feature
to emit logs.
Please configure the log level by setting the RUST_LOG
environment variable.