MkDocs Embed External Markdown Plugin

3.0.2 · active · verified Wed Apr 15

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.

Warnings

Install

Imports

Quickstart

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.

# mkdocs.yml
site_name: My Docs
plugins:
  - external-markdown

# docs/index.md
# To be placed in docs/index.md
#
# # My Awesome Documentation
#
# This page embeds content from an external GitHub README.
#
# ## Features from MkDocs README
# {{ external_markdown('https://raw.githubusercontent.com/mkdocs/mkdocs/master/README.md', '## Features') }}
#
# ## Quick start from MkDocs Material README
# {{ external_markdown('https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/README.md', '## Quick start') }}

# To run this example:
# 1. Create a directory (e.g., my-docs-project)
# 2. Inside, create mkdocs.yml and docs/index.md as shown above.
# 3. From the project root, run:
#    mkdocs build
#    mkdocs serve

view raw JSON →