mdbook-rss-feed
An mdBook preprocessor that generates a beautiful RSS 2.0 feed (and optional Atom) for your book, with HTML previews for each chapter.
Perfect for blogs, documentation sites, or any mdBook that you want to publish.
Sorry for the frequent updates, this should be close to stable now.
Features
-
HTML preview in
<description>built from the first paragraphs of each chapter -
Hybrid preview source:
- Prefer chapter body content for the preview
- Fall back to
descriptionin frontmatter when the body is empty or very short
-
Proper XML escaping via the
rsscrate -
Falls back to file modification time if no date in frontmatter
-
Supports
date:in YAML frontmatter (RFC3339 orYYYY-MM-DD) -
Respects
config.book.title,config.book.description, andoutput.html.site-url -
Zero-config, just drop it in
book.toml
Installation
Version Check:
Tested against:
- mdBook v0.4.40 & v0.5.1
- Rust editions 2020 & 2024
Usage
After installing globally, add the following to your mdbook's book.toml:
[]
= "your-title"
= "your-author"
= "your-lang"
= "src"
[]
= ["html"]
[]
= "https://your-user.github.io"
The renderers = ["html"] configuration in book.toml explicitly binds the
preprocessor to run only when mdBook uses the HTML renderer, preventing it from
executing unnecessarily for other output formats like Markdown or PDF.
-
If you don't give your book a
title, it will be displayed asMy mdbook. -
If you don't give a
site-url, the default isexample.com. Use the public base URL of your deployed site,site-url = "https://your-user.github.io"is just an example of what a gh-pages site could be.
Frontmatter
Frontmatter is completely optional for this crate, it will work without it, removing the need for a YAML frontmatter removal tool.
- Adding frontmatter becomes useful when you want to override or enrich
defaults: explicit
date, a shortdescriptionsummary, or per‑chapter metadata that differs from the Markdown heading/title.
title: Debugging NixOS modules
date:
author: saylesss88
description: This chapter covers debugging NixOS modules, focusing on tracing module
options and evaluating merges.
How description is used
-
Default behavior: The RSS preview is generated from the first few paragraphs of the chapter body.
-
Fallback behavior: If the chapter body is empty or extremely short, the preview is generated from the
descriptionfield instead. -
This makes
descriptiona good place for a short, human‑written summary, while still keeping the preview in sync with the chapter content in normal cases.
If you prefer not to rely on this fallback at all, you can simply omit
description in your frontmatter; the preview will always come from the chapter
body.
Hiding frontmatter in the rendered HTML
As stated above, adding frontmatter is optional but is easy to remove with the following crate if you choose to add it.
mdBook does not natively parse or remove YAML frontmatter from Markdown files,
treating it as plain text during rendering, which can result in the raw YAML
block (e.g., ---\ntitle: "My Chapter"\n---) appearing directly in the
generated HTML output.
To avoid this, you can use:
License
Apache-2.0