| Crates.io | mdbook-selfpath |
| lib.rs | mdbook-selfpath |
| version | 0.2.2 |
| created_at | 2025-06-14 02:25:42.137807+00 |
| updated_at | 2025-06-17 00:06:53.465032+00 |
| description | A preprocessor for mdbook that allows self-referencing paths |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1712065 |
| size | 106,337 |
A Rust preprocessor for mdBook that allows you to insert the current file path into your book's Markdown content. This is useful for referencing the source file location within your documentation, tutorials, or codebooks.
cargo install mdbook-selfpath
This will produce the binary in target/release/mdbook-filepath.
book.tomlAdd the following to your book.toml:
[preprocessor.selfpath]
Here is the configuration available:
include-file-ext if true, file extension will be included (i.e. .md)Insert a directive in your Markdown file where you want the file path to appear. For example:
[{{ selftitle }}](https://github.com/howlowck/example-repo/files/blob/main/{{ selfpath }})
The output will be
[Intro](https://github.com/howlowck/example-repo/files/blob/main/src/Intro.md)
When you build your book, this will be replaced with the relative path to the current Markdown file.
mdbook build
src/.testbook/.make or the provided makefile for common tasks (if available).This project is licensed under the MIT License.