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
File details
Details for the file python-markdown-comments-1.1.0.tar.gz
.
File metadata
- Download URL: python-markdown-comments-1.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.0 CPython/3.7.5 Darwin/19.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fa882d35e8d4d469434719e94d189258e7fa6e847cef6400d7ff16429b09d88 |
|
MD5 | 177dbfabd08bd6939345480b98c45f21 |
|
BLAKE2b-256 | 82af701ea212590a9f498b7beab33da678e92cf6c26274cc7f6c658150908b4b |
File details
Details for the file python_markdown_comments-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: python_markdown_comments-1.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.0 CPython/3.7.5 Darwin/19.2.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebf024b2f6abd86eb7d717402497d54a400a93f20005cf81e0ee064243282411 |
|
MD5 | 0a3ad8afc5b4f38e89cd8b66540bf647 |
|
BLAKE2b-256 | 20ac25d031460347cba842b4e36fe49754eb1636a1fa5a0de48060c3bb2aa68d |