commonmark
Compile Markdown into HTML with CommonMark instead of python-markdown
CommonMark (formerly known as Common Markdown and Standard Markdown before renaming due to licensing disputes) strives to be a strongly specified and highly compatible implementation of Markdown, the markup language created by John Gruber in 2004.
The commonmark
Nikola plugin is a post compiler, using the CommonMark
Python package to compile Markdown code. The package is a pure-Python port of
stmd.js
, a reference JavaScript implementation of CommonMark.
This plugin is an alternative to the markdown
plugin (which is using
python-markdown
), pandoc
(using Pandoc, which handles many more input
formats), and misaka
(yet another custom Markdown implementation). All the
plugins can be used on one site, provided that file extensions differ.
This plugin does not support MarkdownExtension plugins. They are only
compatible with the markdown
plugin and python-markdown
.
For syntax highlighting you can use highlight.js by adding it in your configuration file:
BODY_END += """
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
"""
Suggested Configuration:
# In order to use CommonMark, you must either disable the original # Markdown plugin, or use different file extensions for the two. COMPILERS = { "commonmark": ('.md', '.mdown', '.markdown'), } POSTS = ( ("posts/*.md", "posts", "post.tmpl"), ("posts/*.mdown", "posts", "post.tmpl"), ("posts/*.markdown", "posts", "post.tmpl"), ) PAGES = ( ("stories/*.md", "stories", "story.tmpl"), ("stories/*.mdown", "stories", "story.tmpl"), ("stories/*.markdown", "stories", "story.tmpl"), )
Requirements:
- commonmark (Python package)
Issues? Questions?
You can report issues with this plugin and request help via GitHub Issues.