Skip to main content

Markdown extension for Sphinx

Project description

sphinx-mdinclude

Sphinx extension for including or writing pages in Markdown format.

version documentation changelog license

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.

sphinx-mdinclude is a fork of m2r and m2r2, focused only on providing a Sphinx extension.

Features

  • Basic markdown and some extensions (see below)
    • inline/block-level raw html
    • fenced-code block
    • tables
    • footnotes ([^1])
  • Inline- and Block-level rst markups
    • single- and multi-line directives (.. directive::)
    • inline-roles (:code:`print(1)` ...)
    • ref-link (see `ref`_)
    • footnotes ([#fn]_)
    • math extension inspired by recommonmark
  • Sphinx extension
    • add markdown support for sphinx
    • mdinclude directive to include markdown from md or rst files
    • option to parse relative links into ref and doc directives (md_parse_relative_links)

Restrictions

  • In the rst's directives, markdown is not available. Please write in rst.
  • Column alignment of tables is not supported. (rst does not support this feature)
  • Heading with overline-and-underline is not supported.
    • Heading with underline is OK
  • Rst heading marks are currently hard-coded and unchangeable.
    • H1: =, H2: -, H3: ^, H4: ~, H5: ", H6: #

Installation

Python 3.6 or newer is required.

pip install sphinx-mdinclude

Usage

In your Sphinx conf.py, add the following lines:

extensions = [
    ...,
    'sphinx_mdinclude',
]

Markdown files with the .md extension will be loaded and used by Sphinx, similar to any other .rst files.

To include Markdown files within other files, use the .. mdinclude:: <filename> directive. This applies the conversion from Markdown to reStructuredText format.

License

sphinx-mdinclude is copyright Hiroyuki Takagi, CrossNox, and John Reese, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_mdinclude-0.5.0.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

sphinx_mdinclude-0.5.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_mdinclude-0.5.0.tar.gz.

File metadata

  • Download URL: sphinx_mdinclude-0.5.0.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for sphinx_mdinclude-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5f3a6bc25ec443e64572ba444089f9aeee668f053d7300fc010429d0e36059a8
MD5 4bdc04f9374dc157f61a61f4c3536e68
BLAKE2b-256 17c90357c32baf423df6f3243faf07d2e058b5ba247824afe43ad3347221ac4e

See more details on using hashes here.

File details

Details for the file sphinx_mdinclude-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_mdinclude-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e1d20abb8816d642f2afa63e383620199a5807b769b14e529e4e799c8d18357
MD5 c93fe9221eb1c90cc1c76ea0c193fc5f
BLAKE2b-256 148ae846299934b47d94faaeb4ac7da663b3ff714ae149739329ae8ea5fdd947

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page