sphinx/doc/usage/markdown.rst

53 lines
1.5 KiB
ReStructuredText
Raw Normal View History

.. highlight:: python
2017-01-29 03:58:22 -06:00
.. _markdown:
========
Markdown
========
2017-01-29 03:58:22 -06:00
`Markdown`__ is a lightweight markup language with a simplistic plain text
formatting syntax. It exists in many syntactically different *flavors*. To
support Markdown-based documentation, Sphinx can use `MyST-Parser`__.
MyST-Parser is a Docutils bridge to `markdown-it-py`__, a Python package for
parsing the `CommonMark`__ Markdown flavor.
__ https://daringfireball.net/projects/markdown/
__ https://myst-parser.readthedocs.io/en/latest/
__ https://github.com/executablebooks/markdown-it-py
2018-09-23 11:36:25 -05:00
__ https://commonmark.org/
2017-01-29 03:58:22 -06:00
Configuration
-------------
To configure your Sphinx project for Markdown support, proceed as follows:
2017-01-29 03:58:22 -06:00
#. Install the Markdown parser *MyST-Parser*::
2017-01-29 03:58:22 -06:00
pip install --upgrade myst-parser
2017-01-29 03:58:22 -06:00
#. Add *myst_parser* to the
:confval:`list of configured extensions <extensions>`::
2017-01-29 03:58:22 -06:00
extensions = ['myst_parser']
2017-01-29 03:58:22 -06:00
.. note::
MyST-Parser requires Sphinx 2.1 or newer.
2017-01-29 03:58:22 -06:00
#. If you want to use Markdown files with extensions other than ``.md``, adjust
the :confval:`source_suffix` variable. The following example configures
Sphinx to parse all files with the extensions ``.md`` and ``.txt`` as
Markdown::
2017-01-29 03:58:22 -06:00
source_suffix = {
'.rst': 'restructuredtext',
'.txt': 'markdown',
'.md': 'markdown',
}
2017-01-29 03:58:22 -06:00
#. You can further configure *MyST-Parser* to allow custom syntax that
standard *CommonMark* doesn't support. Read more in the `MyST-Parser
documentation`__.
__ https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html