mdbook-link-forever

mdBook preprocessor that takes care of linking to files in your Git repository.

mdbook-link-forever rewrites path-based links to version-pinned GitHub permalinks. No more hard-coded GitHub URLs.

Here's a link to the [Cargo workspace manifest](../../../Cargo.toml).

Here's a link to the Cargo workspace manifest.

  • Versions are determined at build time. Supports both tags and commit hashes.
  • Because paths are readily accessible at build time, it also validates them for you.

Getting started

  1. Install this crate:

    cargo install mdbookkit --features link-forever
    
  2. Configure your book.toml:

    [book]
    title = "My Book"
    
    [output.html]
    git-repository-url = "https://github.com/me/my-awesome-crate"
    # will use this for permalinks
    
    [preprocessor.link-forever]
    # mdBook will run `mdbook-link-forever`
    
  3. Link to files using paths, like this:

    See [`book.toml`](../../book.toml#L44-L48) for an example config.
    

    See book.toml for an example config.

License

This project is released under the Apache 2.0 License and the MIT License.