diff --git a/doc/config.rst b/doc/config.rst index 5613d0bd6..c082dba2f 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -101,10 +101,13 @@ General configuration suffix that is not in the dictionary will be parsed with the default reStructuredText parser. - For example:: - source_parsers = {'.md': 'some.markdown.module.Parser'} + source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'} + + .. note:: + + Read more about how to use Markdown with Sphinx at :ref:`markdown`. .. versionadded:: 1.3 diff --git a/doc/contents.rst b/doc/contents.rst index 0f5527bae..92fb13fcb 100644 --- a/doc/contents.rst +++ b/doc/contents.rst @@ -19,6 +19,7 @@ Sphinx documentation contents theming templating latex + markdown extensions extdev/index websupport diff --git a/doc/markdown.rst b/doc/markdown.rst new file mode 100644 index 000000000..75a35b9d0 --- /dev/null +++ b/doc/markdown.rst @@ -0,0 +1,45 @@ +.. highlightlang:: python + +.. _markdown: + +Markdown support +================ + +`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 +`recommonmark `__. +recommonmark is a Docutils bridge to `CommonMark-py `__, a +Python package for parsing the `CommonMark `__ Markdown flavor. + + +Configuration +------------- + +To configure your Sphinx project for Markdown support, proceed as follows: + +#. Install recommonmark: + + :: + + pip install recommonmark + +#. Add the Markdown parser to the ``source_parsers`` configuration variable in your Sphinx configuration file: + + :: + + source_parsers = { + '.md': 'recommonmark.parser.CommonMarkParser', + } + + You can replace `.md` with a filename extension of your choice. + +#. Add the Markdown filename extension to the ``source_suffix`` configuration variable: + + :: + + source_suffix = ['.rst', '.md'] + +#. You can further configure recommonmark to allow custom syntax that standard CommonMark doesn't support. Read more in + the `recommonmark documentation `__.