mdx-include is a Python Markdown extension that enables the inclusion of local or remote files directly into Markdown documents. It provides advanced features like recursive includes, file content slicing by line/column, caching of included files, and detection of circular inclusions. The current stable version is 1.4.2, with the last update released in July 2022, indicating an irregular release cadence.
pip install mdx-includeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `mdx-include` to embed content from one Markdown file (`include_me.md`) into another. The extension processes the `{! file_path !}` syntax to replace it with the target file's content.
Customize the include syntax in the extension configuration. Refer to the 'Configuration' section in the documentation for details on changing the syntax pattern.
Set `allow_circular_inclusion` to `True` in the extension configuration to allow non-recursive inclusion in such scenarios.
Choose one extension for file inclusion; do not enable both `mdx_include` and `markdown_include` in your Markdown extensions list.
Ensure that the global `recursion` option is `None` if you intend to use the inline `recurs_state` for selective recursive inclusions.