An mdBook preprocessor that generates and embeds a QR code for your book, powered by fast-qr.
It produces a PNG image during the build and replaces {{QR_CODE}} markers in chapters with an <img> tag pointing to the generated QR code.
Read the documentation here, to see the actual examples in action.
Features
- Generates PNG QR codes using
fast-qr - Structured configuration under
[preprocessor.qr]with sub-tables:- Configurable RGB/A or hex color options
- Optional fit width/height for the
<img>tag - Support for multiple module shapes (see Shapes)
- Adjustable quiet zone margin
- Supports custom named QR configurations under
[preprocessor.qr.custom.*](see Custom Configuration)
Installation
From crates.io:
From source (in this repository):
Ensure the mdbook-qr binary is available on your PATH.
Quick Start
Add to your book.toml:
[]
= true
= "https://example.com"
= "src/qr.png"
= 2
= "#FFFFFFFF"
= "#000000FF"
[]
= 256
= 256
[]
= true
Then, in any Markdown file:
{{QR_CODE}}
During the build, this is replaced with:
...and rendered as:

License
Licensed under the MIT License