This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a MkDocs plugin called mkdocs-ini-includer that allows MkDocs sites to embed INI file content directly into documentation at build time. The plugin supports including entire INI files or specific sections while preserving comments and formatting.
mkdocs_ini_includer/plugin.py- Main plugin class (IniIncluderPlugin) that extends MkDocsBasePluginmkdocs_ini_includer/__init__.py- Package initialization and version definitionsetup.py- Python package configuration with MkDocs plugin entry pointdemo/- Complete working example with sample INI files and MkDocs site
The plugin works by:
- Registering as a MkDocs plugin via
on_page_markdownhook - Using regex to find
{% ini-include %}tags in markdown content - Parsing tag arguments to determine file path and optional section filtering
- Reading INI files with preserved comments (not using configparser for parsing)
- Filtering content by section if specified (supports nested sections like
database.ssl) - Wrapping output in markdown code blocks with
inisyntax highlighting
on_page_markdown()- Main hook that processes markdown content_parse_include_args()- Parses arguments from include tags_get_full_path()- Resolves file paths using base_path config_read_ini_with_comments()- Reads raw INI content preserving formatting_filter_section()- Extracts specific sections and subsections
pip install -e . # Install in development mode# Run all tests with verbose output
python -m unittest discover tests/ -v
# Run specific test file
python -m unittest tests.test_plugin -v
# Alternative with pytest (if installed)
pytest tests/ -v --cov=mkdocs_ini_includercd demo
mkdocs serve # Run demo site locally with live reload
mkdocs build # Build demo site to test static generationLive Reload Testing: The plugin supports live reload during development. When using mkdocs serve, changes to INI files are automatically detected and trigger page rebuilds. This allows you to:
- Edit INI files in the demo directory
- Refresh the browser to see updated content immediately
- Test section filtering and file inclusion in real-time
python setup.py sdist bdist_wheel # Build distribution packagesPlugin accepts two optional configuration parameters:
base_path- Base directory for INI files (relative to docs_dir)config_file- Default INI file when none specified in include tag
{% ini-include %}- Include default config file{% ini-include file="path/to/file.ini" %}- Include specific file{% ini-include section="database" %}- Include specific section{% ini-include file="config.ini" section="api" %}- Combine parameters
Section filtering supports hierarchical sections (e.g., database includes database.ssl).