This is a MkDocs plugin that allows a MkDocs site to include all or part of an INI file inside the docs at build time.
- Documenting the configuration system of an app without having to copy/paste config sections
- Showing the configuration for a specific feature
- ✅ Include whole INI files
- ✅ Include specific sections (e.g.,
[section.name]and all sub-data) - ✅ Preserve comments (useful docs for users)
- ✅ Support array keys like
key1[] = abc, key1[] = def - ✅ Simple embedding without complex parsing
pip install mkdocs-ini-includerAdd the plugin to your mkdocs.yml:
plugins:
- ini-includer:
base_path: "path/to/your/ini/files" # Optional: base path for INI files
config_file: "app.ini" # Optional: default INI file{% ini-include %}Or specify a specific file:
{% ini-include file="config/app.ini" %}{% ini-include section="database" %}Given an INI file config/app.ini:
# Application configuration
[app]
name = MyApp
version = 1.0.0
# Database settings
[database]
host = localhost
port = 5432
# Connection pool settings
pool_size = 10
[database.ssl]
enabled = true
cert_path = /path/to/certInclude entire file:
{% ini-include %}Include only database section:
{% ini-include section="database" %}This will include the [database] section and all its subsections like [database.ssl].
The plugin supports live reload during development. When using mkdocs serve, changes to INI files are automatically detected and trigger page rebuilds, allowing you to see updates immediately without restarting the development server.
- File paths are relative to your
docs_dirunlessbase_pathis configured - Comments and formatting are preserved
- Array keys (like
key[]=value) are supported - Error handling displays helpful messages in the generated docs
- Live reload works with
mkdocs servefor real-time INI file updates