All Projects → readthedocs → Recommonmark

readthedocs / Recommonmark

Licence: mit
A markdown parser for docutils

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Recommonmark

laravel-etched-blade
A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.
Stars: ✭ 19 (-94.24%)
Mutual labels:  commonmark
cmark-scala
Parse, manipulate and render CommonMark in Scala Native
Stars: ✭ 13 (-96.06%)
Mutual labels:  commonmark
mdformat
CommonMark compliant Markdown formatter
Stars: ✭ 90 (-72.73%)
Mutual labels:  commonmark
CommonMarkEmoji
CommonMark extension adds UTF-8 emoji with Github tag for the `league/commonmark` PHP Markdown parsing engine, based on the CommonMark spec.
Stars: ✭ 17 (-94.85%)
Mutual labels:  commonmark
smu
Simple MarkUp - markdown/commonmark like syntax
Stars: ✭ 21 (-93.64%)
Mutual labels:  commonmark
md-toc
Automatically generate a compliant table of contents for a markdown file to improve document readability
Stars: ✭ 18 (-94.55%)
Mutual labels:  commonmark
markdom
A markdown parser for laravel for making beautiful html
Stars: ✭ 42 (-87.27%)
Mutual labels:  commonmark
Md4c
C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
Stars: ✭ 322 (-2.42%)
Mutual labels:  commonmark
guile-commonmark
Implementation of CommonMark for Guile
Stars: ✭ 31 (-90.61%)
Mutual labels:  commonmark
goldmark-pdf
A PDF renderer for the goldmark markdown parser.
Stars: ✭ 83 (-74.85%)
Mutual labels:  commonmark
comark
Comark is CommonMark (Markdown) library for Haxe
Stars: ✭ 14 (-95.76%)
Mutual labels:  commonmark
Publish.jl
A universal document authoring package for Julia.
Stars: ✭ 86 (-73.94%)
Mutual labels:  commonmark
NeoMarkdigXaml
Markdig Xaml/Wpf Renderer
Stars: ✭ 18 (-94.55%)
Mutual labels:  commonmark
commonmark-attributes-extension
The Attributes extension adds a syntax to define attributes on the various HTML elements in markdown’s output.
Stars: ✭ 32 (-90.3%)
Mutual labels:  commonmark
jekyll-commonmark
CommonMark generator for Jekyll
Stars: ✭ 28 (-91.52%)
Mutual labels:  commonmark
front-matter
The most featured front matter (yaml, json, neon, toml) parser and dumper for PHP.
Stars: ✭ 23 (-93.03%)
Mutual labels:  commonmark
nwotable
One app for all your notes on all your devices.
Stars: ✭ 22 (-93.33%)
Mutual labels:  commonmark
Markdown Writer Fx
Markdown Writer FX
Stars: ✭ 323 (-2.12%)
Mutual labels:  commonmark
Commonmarker
Ruby wrapper for libcmark (CommonMark parser)
Stars: ✭ 266 (-19.39%)
Mutual labels:  commonmark
NativeMarkKit
NativeMark is a flavor of Markdown designed to be rendered by native apps.
Stars: ✭ 36 (-89.09%)
Mutual labels:  commonmark

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:

# for Sphinx-1.4 or newer
extensions = ['recommonmark']

# for Sphinx-1.3
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.

Links

For all links in commonmark that aren't explicit URLs, they are treated as cross references with the :any: role. This allows referencing a lot of things including files, labels, and even objects in the loaded domain.

Linking to headings in other files

For linking to headings in other files you can use the autosectionlabel sphinx feature, e.g.

# conf.py

extensions = [
    # Auto-generate section labels.
    'sphinx.ext.autosectionlabel',
]

# Prefix document path to section labels, otherwise autogenerated labels would look like 'heading'
# rather than 'path/to/file:heading'
autosectionlabel_prefix_document = True

You would use it like:

<!-- path/to/file_1.md -->

# Title

## My Subtitle
<!-- file_2.md -->

[My Subtitle][]

[My Subtitle]: <path/to/file_1:My Subtitle>

AutoStructify

AutoStructify makes it possible to write your documentation in Markdown, and automatically convert this into rST at build time. See the AutoStructify Documentation for more information about configuration and usage.

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_maxdepth: The max depth of the Auto Toc. Defaults to 1.
  • 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. Deprecated
  • 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
  • known_url_schemes: a list of url schemes to treat as URLs, schemes not in this list will be assumed to be Sphinx cross-references. Defaults to None, which means treat all URL schemes as URLs. Example: ['http', 'https', 'mailto']

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].