Giter Site home page Giter Site logo

Comments (3)

Crozzers avatar Crozzers commented on May 24, 2024

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.

michaelkedar avatar michaelkedar commented on May 24, 2024

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.

Crozzers avatar Crozzers commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.