A Python-Markdown extension to ignore html comments opened by three dashes.
Project description
mkdcomments
Original plugin was created by ryneeverett.
A Python-Markdown preprocessor extension to ignore html comments opened by three dashes and any whitespace prior to them. I believe pandoc has similar functionality.
<!-- This is a standard html comment which will remain in the output. -->
<!--- This is a markdown comment which this extension removes. -->
Installation
pip install python-markdown-comments
Example
>>> import markdown
>>> from python_markdown_comments import CommentsExtension
>>> comments = CommentsExtension()
>>> markdowner = markdown.Markdown(extensions=[comments])
>>> markdowner.convert("""\
... blah blah blah <!--- inline comment -->
...
... <!---multiline comment
... multiline comment
... multiline comment-->
...
... even more text.""")
u'<p>blah blah blah</p>\n<p>even more text.</p>'
Infrequently Asked Questions
How can I write about markdown comments without them being removed?
In order to render markdown comments, you must *(a)*use them in an html block (which are not processed as markdown) and *(b)*escape the brackets so the browser won't think they're html comments. E.g.:
<pre>
<!--- meta markdown comment -->
</pre>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for python-markdown-comments-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fa882d35e8d4d469434719e94d189258e7fa6e847cef6400d7ff16429b09d88 |
|
MD5 | 177dbfabd08bd6939345480b98c45f21 |
|
BLAKE2b-256 | 82af701ea212590a9f498b7beab33da678e92cf6c26274cc7f6c658150908b4b |
Close
Hashes for python_markdown_comments-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebf024b2f6abd86eb7d717402497d54a400a93f20005cf81e0ee064243282411 |
|
MD5 | 0a3ad8afc5b4f38e89cd8b66540bf647 |
|
BLAKE2b-256 | 20ac25d031460347cba842b4e36fe49754eb1636a1fa5a0de48060c3bb2aa68d |