Comments (5)
Ah, sorry, meant to close this myself :)
Cheers!
from strip-markdown.
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.
@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.
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.
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)
- Not working with current mdast? HOT 3
- Stripping URL outputs HTML escaped character for the colon ( : ) HOT 8
- Option to keep list characters HOT 15
- Type definitions HOT 2
- Fix exception for parents without children HOT 2
- HTML in Markdown HOT 6
- Add typescript types HOT 1
- Does not seem to remove tables HOT 2
- Removing alt text for images HOT 1
- Add remark as peer dependency HOT 1
- Backslash prepended to the input `[` HOT 3
- Keep existing new lines when thematic breaks are removed HOT 6
- Type error when using `strip-markdown` in `unified` HOT 10
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 strip-markdown.