Giter Club home page Giter Club logo

Comments (5)

strugee avatar strugee commented on May 27, 2024 1

Ah, sorry, meant to close this myself :)

Cheers!

from strip-markdown.

wooorm avatar wooorm commented on May 27, 2024

Thanks for raising this issue!

The problem here arises because an HTML comment at the start of the line “taints” the whole paragraphs as HTML. As an example, I pasted this code:

<!--A comment-->, **importance**, and `code`.

Below:

, **importance**, and `code`.

As you can see, the importance (bold) and code no longer “work”.

A solution would be to not start the line with HTML:

A <!--comment-->, **importance**, and `code`.

Yields:

A , importance, and code.

...and otherwise I wouldn’t really know how to do this in markdown (HTML in markdown is horrible and breaks lots of things). But you could transform the markdown/HTML to HTML first (with remark-rehype and rehype-raw) and then strip all tags?

from strip-markdown.

strugee avatar strugee commented on May 27, 2024

@wooorm cool, makes sense. This was mostly just a corner case for processing user input, so I think I'll just throw an error if people write this. Thanks for the suggestion though :-)

Am I correct in thinking that we should leave this open, though, since it seems to be a legitimate bug?

from strip-markdown.

wooorm avatar wooorm commented on May 27, 2024

Sorry for the slightly late response!

Am I correct in thinking that we should leave this open, though, since it seems to be a legitimate bug?

I dunno, I don’t think this can ever be “fixed”. Other vendors (e.g., markdown-it without html enabled) handle this similar...

from strip-markdown.

wooorm avatar wooorm commented on May 27, 2024

As this is handled similarly by other markdown parsers (commonmark, markdown-it, gfm), I’d say this is working as it’s supposed to!

from strip-markdown.

Related Issues (14)

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.