mdbook-bib
mdbook-bib is an mdBook preprocessor for adding citations and bibliographies to your books. mdBook is written in Rust Klabnik2018.
Two Rendering Backends
mdbook-bib offers two rendering backends to suit different needs:
| Feature | Custom (Handlebars) | CSL |
|---|---|---|
| Use case | Full customization | Standard academic formats |
| Citation styles | Custom templates | IEEE, Chicago, Nature, APA, 80+ more |
| Interactive elements | Copy buttons, collapsible details | Basic (links only) |
| Configuration | More flexible | Simpler |
Custom Backend (Default)
The Custom backend uses Handlebars templates for maximum flexibility. You control exactly how citations and bibliography entries are rendered, including custom HTML, CSS, and JavaScript.
Best for: Power users who need custom layouts, interactive elements, or non-standard citation formats.
See Custom Backend for details.
CSL Backend
The CSL backend uses hayagriva to render citations in standard academic formats. Simply specify a style name and get properly formatted output.
Best for: Academic writing where you need standard citation styles like IEEE, APA, or Chicago.
See CSL Backend for details.
Quick Start
Configure the preprocessor in book.toml:
[preprocessor.bib]
bibliography = "refs.bib" # BibTeX or YAML
# Custom mode by default
# backend = "csl" # Optional: use CSL instead of custom
# csl-style = "ieee" # Required when backend = "csl"
Cite entries with {{#cite key}} or @@key. For Pandoc compatibility, enable citation-syntax = "pandoc" to also use @key, [@key], and [-@key].
GitHub project
mdbook-bib is Open Source and available on GitHub.
License
mdbook-bib is released under the MPL-2.0 License.