December 28, 2025
Plugin wars, anyone?
Plugins case study: mdBook preprocessors
Rust’s book tool lets plugins run wild — JS crowd crashes the party
TLDR: mdBook now spotlights language-agnostic plugins that rewrite your book before publishing. Commenters turned it into a crossover showdown: web fans hype paged.js hooks, while others dream of Python-powered Markdown in Zola. It matters because plugin-friendly docs are becoming the norm across ecosystems.
mdBook, the Rust-loved tool that turns simple text into glossy online books, just showed off how its plugin preprocessors work — think little helper programs that tweak your book before it’s published. The author even ships a playful “narcissist” demo in both Python and Rust, proving you can bolt on custom magic from almost any language. It’s a “send the whole book as JSON, get a modified book back” vibe — fast for docs, not for, say, Wikipedia-sized giants.
And the comments? Pure crossover chaos. One web dev swooped in to shout out paged.js, bragging about its hooks system and fresh funding, like the browser world just kicked open the door to the print party. Another reader gleefully declared this was “useful and timely” and started plotting a Zola (static site tool) preprocessor to run Python inside Markdown like Quarto, which had the crowd muttering “spicy!” The mood turned into friendly plugin one‑upmanship: JS folks wave hooks, Rust folks flex traits, and everyone nods at the “JSON firehose” design with a wink. An HN thread dropped for receipts, while the “narcissist” plugin name became the day’s meme. Docs devs, assemble — the plugin arms race is officially on.
Key Points
- •mdBook supports preprocessors that can modify book content after loading Markdown and before rendering.
- •Plugin discovery is explicit via book.toml, listing each preprocessor as a command to run.
- •Registration involves a supports <renderer> check (exit code 0 indicates support), then JSON-based book transfer via stdin/stdout.
- •Hooks are coarse-grained: preprocessors receive and emit the entire book as a single JSON object with metadata.
- •Rust-based preprocessors can use mdBook’s API and the Preprocessor trait; renderers/backends are a similar plugin mechanism.