Skip to content

CompEng0001/mdbook-qr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mdbook-qr

Crates.io version Downloads Docs.rs CI status Built with Rust

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:

cargo install mdbook-qr

From source (in this repository):

cargo install --path .

Ensure the mdbook-qr binary is available on your PATH.


Quick Start

Add to your book.toml:

[preprocessor.qr]
enable = true
url = "https://example.com"
qr-path = "src/qr.png"
margin = 2
background = "#FFFFFFFF"
module = "#000000FF"

[preprocessor.qr.fit]
width = 256
height = 256

[preprocessor.qr.shape]
circle = true

Then, in any Markdown file:

{{QR_CODE}}

During the build, this is replaced with:

<img src="./qr.png" alt="QR code" style="width:256px;height:256px;" loading="eager">

...and rendered as:


License

Licensed under the MIT License


Author

CompEng0001

About

mdbook plugin injects qr codes via fast_qr

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages