Mkdocs-embed-external-markdown is a MkDocs plugin that allows users to inject either entire external Markdown files or specific sections from external Markdown files into their MkDocs project using a Jinja2 macro. This enables the compilation of documentation from various remote sources, such as GitHub repositories. The plugin is actively maintained, with frequent updates addressing compatibility and feature enhancements.
pip install mkdocs-embed-external-markdownVerified import paths — ran on the pinned version, not inferred.
To get started, enable the `external-markdown` plugin in your `mkdocs.yml` file. Then, use the `{{ external_markdown('url', 'section name') }}` Jinja2 macro directly within your Markdown files to embed content. The 'section name' parameter specifies the exact Markdown header (e.g., '## Installation') to embed, or an empty string ('') for the full file.
Update all `external_markdown` macro calls to include the Markdown header level, such as `{{ external_markdown('url', '## My Section') }}`.Escape Jinja2-like syntax in your external Markdown files using raw blocks (`{% raw %}...{% endraw %}`) if you intend for them to be rendered by a subsequent Markdown processor, or adjust the external content to avoid conflicts.Be aware of this behavior and plan your documentation structure accordingly, adding appropriate context headers in your MkDocs pages where content is embedded.