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 markdown.extensions.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.0.0.tar.gz
.
File metadata
- Download URL: python-markdown-comments-1.0.0.tar.gz
- Upload date:
- Size: 4.1 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 | 7887c461e662b7d189b8b1b5fc228e551c1dffc727c93c8ce143d3586e72af8a |
|
MD5 | 84a0774a31fff25e168495ae5159bd9b |
|
BLAKE2b-256 | 06c7d19a70b6e28629cac877da7148ecccc305efaf579190914b42b0b3dd23b2 |
File details
Details for the file python_markdown_comments-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: python_markdown_comments-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.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 | d35d48fa381b009e0c59a52c9fb8852635fff1b3c3b9bab565a720c0adf6cb9c |
|
MD5 | b578e2f921bff4e90850f461b06a4009 |
|
BLAKE2b-256 | ab3865baeb9e80961d00d113e0ab102d97dc4e64709e47fe0c58ba44e7cf38fc |