No description
Find a file
2016-04-24 14:01:31 +02:00
docs DOC: Properly escape inline code and code blocks 2016-04-24 14:01:31 +02:00
recommonmark Show proper code blocks if no language is given 2016-04-24 13:58:56 +02:00
tests Add initial stab at testing & Travis/Tox integration 2015-10-19 11:41:10 -07:00
.gitignore add configuration from doc.env 2015-08-02 17:54:06 -07:00
.travis.yml Add initial stab at testing & Travis/Tox integration 2015-10-19 11:41:10 -07:00
CHANGELOG.md Set rawsource value for each nodes to use as translation source on Sphinx i18n feature. 2016-02-08 22:48:21 +09:00
license.md Create license.md 2014-10-14 11:32:29 +02:00
prospector.yml Add initial stab at testing & Travis/Tox integration 2015-10-19 11:41:10 -07:00
README.md bold the option keys in the readme 2016-03-10 15:41:39 -05:00
requirements.txt Update requirements too 2016-01-05 14:01:46 -08:00
setup.cfg Add setup.cfg 2015-02-13 11:45:18 -08:00
setup.py Revert back to using old commonmark for now 2016-01-05 14:00:22 -08:00
tox.ini Don't double specify bits 2015-10-19 13:22:53 -07:00

recommonmark

A docutils-compatibility bridge to CommonMark.

This allows you to write CommonMark inside of Docutils & Sphinx projects.

Documentation is available on Read the Docs: http://recommonmark.readthedocs.org

Contents

Getting Started

To use recommonmark inside of Sphinx only takes 2 steps. First you install it:

pip install recommonmark 

Then add this to your Sphinx conf.py:

from recommonmark.parser import CommonMarkParser

source_parsers = {
    '.md': CommonMarkParser,
}

source_suffix = ['.rst', '.md']

This allows you to write both .md and .rst files inside of the same project.

AutoStructify

To use the advanced markdown to rst transformations you must add AutoStructify to your Sphinx conf.py.

# At top on conf.py (with other import statements)
import recommonmark
from recommonmark.transform import AutoStructify

# At the bottom of conf.py
def setup(app):
    app.add_config_value('recommonmark_config', {
            'url_resolver': lambda url: github_doc_root + url,
            'auto_toc_tree_section': 'Contents',
            }, True)
    app.add_transform(AutoStructify)

See https://github.com/rtfd/recommonmark/blob/master/docs/conf.py for a full example.

AutoStructify comes with the following options. See http://recommonmark.readthedocs.org/en/latest/auto_structify.html for more information about the specific features.

  • enable_auto_toc_tree: enable the Auto Toc Tree feature.
  • auto_toc_tree_section: when True, Auto Toc Tree will only be enabled on section that matches the title.
  • enable_auto_doc_ref: enable the Auto Doc Ref feature.
  • enable_math: enable the Math Formula feature.
  • enable_inline_math: enable the Inline Math feature.
  • enable_eval_rst: enable the evaluate embedded reStructuredText feature.
  • url_resolver: a function that maps a existing relative position in the document to a http link

Development

You can run the tests by running tox in the top-level of the project.

We are working to expand test coverage, but this will at least test basic Python 2 and 3 compatability.

Why a bridge?

Many python tools (mostly for documentation creation) rely on docutils. But docutils only supports a ReStructuredText syntax.

For instance this issue and this StackOverflow question show that there is an interest in allowing docutils to use markdown as an alternative syntax.

Why another bridge to docutils?

recommonmark uses the python implementation of CommonMark while remarkdown implements a stand-alone parser leveraging parsley.

Both output a docutils document tree and provide scripts that leverage docutils for generation of different types of documents.

Acknowledgement

recommonmark is mainly derived from remarkdown by Steve Genoud and leverages the python CommonMark implementation.

It was originally created by Luca Barbato, and is now maintained in the Read the Docs (rtfd) GitHub organization.