Sphinx Markdown Include Extension

0.6.2 · active · verified Mon Apr 13

sphinx-mdinclude is a simple Sphinx extension that enables including Markdown documents from within reStructuredText. It provides the `.. mdinclude::` directive, and automatically converts the content of Markdown documents to reStructuredText format. It is a fork of `m2r` and `m2r2`, focused solely on providing a Sphinx extension. The current version is 0.6.2, and it is actively maintained as part of the Omnilib Project, with regular releases addressing compatibility and features.

Warnings

Install

Imports

Quickstart

First, add `sphinx_mdinclude` to the `extensions` list in your `conf.py`. Then, within any reStructuredText file (e.g., `index.rst`), use the `.. mdinclude::` directive to embed Markdown content from `.md` files. You can specify a path relative to the current `.rst` file. Options like `:start-line:` and `:end-line:` can be used to include only a portion of the Markdown file.

# conf.py
# Add 'sphinx_mdinclude' to your extensions list
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.napoleon',
    'sphinx_mdinclude'
]

# index.rst (or any .rst file)
My Project Documentation
========================

.. mdinclude:: ../README.md
   :start-line: 1
   :end-line: 10

This section continues with reStructuredText.

.. mdinclude:: introduction.md

view raw JSON →