| 1 |
.. highlight:: python |
| 2 |
|
| 3 |
.. _markdown: |
| 4 |
|
| 5 |
======== |
| 6 |
Markdown |
| 7 |
======== |
| 8 |
|
| 9 |
`Markdown`__ is a lightweight markup language with a simplistic plain text |
| 10 |
formatting syntax. It exists in many syntactically different *flavors*. To |
| 11 |
support Markdown-based documentation, Sphinx can use `MyST-Parser`__. |
| 12 |
MyST-Parser is a Docutils bridge to `markdown-it-py`__, a Python package for |
| 13 |
parsing the `CommonMark`__ Markdown flavor. |
| 14 |
|
| 15 |
__ https://daringfireball.net/projects/markdown/ |
| 16 |
__ https://myst-parser.readthedocs.io/en/latest/ |
| 17 |
__ https://github.com/executablebooks/markdown-it-py |
| 18 |
__ https://commonmark.org/ |
| 19 |
|
| 20 |
Configuration |
| 21 |
------------- |
| 22 |
|
| 23 |
To configure your Sphinx project for Markdown support, proceed as follows: |
| 24 |
|
| 25 |
#. Install the Markdown parser *MyST-Parser*:: |
| 26 |
|
| 27 |
pip install --upgrade myst-parser |
| 28 |
|
| 29 |
#. Add *myst_parser* to the |
| 30 |
:confval:`list of configured extensions <extensions>`:: |
| 31 |
|
| 32 |
extensions = ['myst_parser'] |
| 33 |
|
| 34 |
.. note:: |
| 35 |
MyST-Parser requires Sphinx 2.1 or newer. |
| 36 |
|
| 37 |
#. If you want to use Markdown files with extensions other than ``.md``, adjust |
| 38 |
the :confval:`source_suffix` variable. The following example configures |
| 39 |
Sphinx to parse all files with the extensions ``.md`` and ``.txt`` as |
| 40 |
Markdown:: |
| 41 |
|
| 42 |
source_suffix = { |
| 43 |
'.rst': 'restructuredtext', |
| 44 |
'.txt': 'markdown', |
| 45 |
'.md': 'markdown', |
| 46 |
} |
| 47 |
|
| 48 |
#. You can further configure *MyST-Parser* to allow custom syntax that |
| 49 |
standard *CommonMark* doesn't support. Read more in the `MyST-Parser |
| 50 |
documentation`__. |
| 51 |
|
| 52 |
__ https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html |