2018-04-14 09:15:31 -05:00
|
|
|
.. highlight:: python
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2018-04-30 04:21:34 -05:00
|
|
|
.. _markdown:
|
|
|
|
|
2018-02-06 05:22:47 -06:00
|
|
|
========
|
|
|
|
Markdown
|
|
|
|
========
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2018-04-30 04:21:34 -05:00
|
|
|
`Markdown`__ is a lightweight markup language with a simplistic plain text
|
2018-02-06 05:22:47 -06:00
|
|
|
formatting syntax. It exists in many syntactically different *flavors*. To
|
2018-04-30 04:21:34 -05:00
|
|
|
support Markdown-based documentation, Sphinx can use `recommonmark`__.
|
|
|
|
recommonmark is a Docutils bridge to `CommonMark-py`__, a Python package for
|
|
|
|
parsing the `CommonMark`__ Markdown flavor.
|
|
|
|
|
|
|
|
__ https://daringfireball.net/projects/markdown/
|
|
|
|
__ https://recommonmark.readthedocs.io/en/latest/index.html
|
|
|
|
__ https://github.com/rtfd/CommonMark-py
|
2018-09-23 11:36:25 -05:00
|
|
|
__ https://commonmark.org/
|
2017-01-29 03:58:22 -06:00
|
|
|
|
|
|
|
Configuration
|
|
|
|
-------------
|
|
|
|
|
2017-02-01 12:16:05 -06:00
|
|
|
To configure your Sphinx project for Markdown support, proceed as follows:
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2019-01-09 09:44:00 -06:00
|
|
|
#. Install the Markdown parser *recommonmark*::
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2019-01-09 09:44:00 -06:00
|
|
|
pip install --upgrade recommonmark
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2018-12-23 10:27:54 -06:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
The configuration as explained here requires recommonmark version
|
2019-01-09 09:44:00 -06:00
|
|
|
0.5.0 or later.
|
2018-12-23 10:27:54 -06:00
|
|
|
|
2018-07-28 11:02:32 -05:00
|
|
|
#. Add *recommonmark* to the
|
|
|
|
:confval:`list of configured extensions <extensions>`::
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2018-07-28 11:02:32 -05:00
|
|
|
extensions = ['recommonmark']
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2018-07-28 11:02:32 -05:00
|
|
|
.. versionchanged:: 1.8
|
2018-12-23 10:28:44 -06:00
|
|
|
Version 1.8 deprecates and version 3.0 removes the ``source_parsers``
|
2018-07-28 11:02:32 -05:00
|
|
|
configuration variable that was used by older *recommonmark* versions.
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2018-07-28 11:02:32 -05: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
|
|
|
|
2018-07-28 11:02:32 -05:00
|
|
|
source_suffix = {
|
|
|
|
'.rst': 'restructuredtext',
|
|
|
|
'.txt': 'markdown',
|
|
|
|
'.md': 'markdown',
|
|
|
|
}
|
2017-01-29 03:58:22 -06:00
|
|
|
|
2018-04-30 04:21:34 -05:00
|
|
|
#. You can further configure *recommonmark* to allow custom syntax that
|
2018-07-28 11:02:32 -05:00
|
|
|
standard *CommonMark* doesn't support. Read more in the `recommonmark
|
2018-04-30 04:21:34 -05:00
|
|
|
documentation`__.
|
2018-02-06 05:22:47 -06:00
|
|
|
|
2018-04-30 04:21:34 -05:00
|
|
|
__ https://recommonmark.readthedocs.io/en/latest/auto_structify.html
|