Comments (3)
Thanks for spotting this. I've opened a PR for the incomplete HTML comments.
It's also inconsistent whether it puts
<em>
tags around the 'commented' section. I believe it should be replacing it in both cases
The library currently regards the contents of any HTML tag as HTML and will not process it as markdown. We do have an extra called markdown-in-html
that allows you to put markdown content inside HTML tags, but you need to add a markdown="1"
attribute to the tag, which won't work for comments.
Looking on babelmark, most other MD processors leave the HTML comment intact, except for markdown-it which escapes the comment tag and then processes the contents.
It's feasible that we could escape the comment tag, sanitise the contents (to remove any commented out HTML) and then process it as markdown.
from python-markdown2.
Thanks for fixing this!
The library currently regards the contents of any HTML tag as HTML and will not process it as markdown.
Personally, I find having this behaviour when safe_mode='escape'
unusual, since setting it is supposed to not treat the input as HTML. markdown-it seems to sanitize HTML by default, which seems to be why it processes the markdown in the comment tags.
To bring it back to this issue, I'm wondering if the unclosed comment fix will result in everything after the <!--
to remain unprocessed?
from python-markdown2.
To bring it back to this issue, I'm wondering if the unclosed comment fix will result in everything after the
<!--
to remain unprocessed?
From my testing, this doesn't happen. Incomplete tags are handled differently to normal HTML. Normal HTML is escaped and the contents are hashed to prevent further processing. Incomplete tags just have the tag escaped and the contents left in place.
Personally, I find having this behaviour when
safe_mode='escape'
unusual, since setting it is supposed to not treat the input as HTML
This makes sense, and the difference in treatment between complete and incomplete HTML tags is a bit confusing. I'll look into this
from python-markdown2.
Related Issues (20)
- Converting non-english anchor tags leads to "-x" values (or umlauts are replaced) HOT 2
- HTML headers not included in TOC
- Bad handling of two consecutive bold words HOT 6
- Fenced-code-blocks extra funky movments HOT 1
- Markdown Syntax Not Converted Within HTML Tags in markdown2 HOT 3
- Conversion Issue with Single Line Breaks in Lists and Tables HOT 2
- Table Conversion Issue with Trailing Spaces/Tabs
- Link Conversion Fails with Preceding or Following Square Brackets HOT 2
- Update markdown2 version on PyPI HOT 2
- Formatting error when input contains multiple words surrounded by triple asterisks HOT 2
- Conversion Issue with Single Line Breaks in Tables HOT 1
- Issue with Table Conversion - Last Row Not Converted HOT 1
- Update on PyPI and merge latest pull requests HOT 1
- Add typing to package HOT 3
- regression with markdown-in-html HOT 2
- How to format task list HOT 1
- Random <p> tags inserted when using HTML in markdown
- bug/feature html tags wrapped in paragraph tags HOT 4
- AssertionError: assert re.match(r'^<(?:ul|ol).*?>', cuddled_list) when two list items are on the same line HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-markdown2.