A Sphinx extension to build documentation compatible with readme.io via the rdme cli.
- Generates Markdown files with YAML frontmatter
- Strips
.mdextensions from relative links (rdme resolves links without extensions) - Extracts page titles and slugs automatically
- Flexible frontmatter with configurable defaults and per-document overrides
- Supports MyST Parser YAML frontmatter
- Built on top of sphinx-markdown-builder
pip install sphinx-rdmeOr with uv:
uv add sphinx-rdmeAdd the extension to your conf.py:
extensions = [
# ... other extensions ...
"sphinx_rdme",
]Build your documentation:
sphinx-build -M rdme ./docs ./buildOr using the builder directly:
sphinx-build -b rdme ./docs ./build/rdmeAdd these options to your conf.py:
| Option | Default | Description |
|---|---|---|
rdme_frontmatter |
True |
Enable/disable YAML frontmatter generation |
rdme_strip_md_links |
True |
Strip .md extension from relative links |
rdme_default_frontmatter |
{} |
Default frontmatter fields (dict) |
rdme_passthrough_fields |
None |
Fields to pass through from document metadata |
You can set default frontmatter fields that apply to all documents:
# conf.py
rdme_default_frontmatter = {
"category": "guides",
"hidden": False,
"order": 1,
"author": "Documentation Team",
}This can include any key/value pairs - not just rdme standard fields. The defaults can also override auto-generated fields like title, slug, and excerpt:
# Override auto-generated excerpt for all pages
rdme_default_frontmatter = {
"excerpt": "Official documentation",
}For RST sources, use field lists with the rdme- prefix:
:rdme-hidden: true
:rdme-category: advanced
:rdme-custom-field: custom-value
My Document Title
=================
Content here...If you're using MyST Parser for Markdown sources, you can use YAML frontmatter directly in your .md files:
---
title: Custom Title
hidden: true
category: advanced
order: 5
---
# My Document
Content here...By default, the following fields are passed through from MyST frontmatter:
title,slug,excerpt,category,hidden,orderparentDoc,parentDocSlug,type,api,next,previous
To customize which fields are passed through:
# conf.py
rdme_passthrough_fields = {
"title", "slug", "hidden", "category", "my_custom_field"
}Frontmatter values are resolved in this order (highest to lowest priority):
- Per-document metadata (RST
:rdme-*:fields or MyST frontmatter) - Default frontmatter (
rdme_default_frontmatterconfig) - Auto-generated values (title, slug, excerpt)
Generated Markdown files include YAML frontmatter:
---
title: "Page Title"
slug: "page-slug"
excerpt: "First paragraph of the page"
category: "guides"
hidden: false
---
# Page Title
Content here...MIT License - see LICENSE for details.