-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String after < is completely removed, if it is not followed by a space #160
Comments
The problem is that |
Cannot replace all Anyway, I will try to do a workaround on this and will post once I am done. |
This particular example doesn't reproduce in version 7. |
You know what? Even Blink (Chrome's engine) is confused by HTML spec also doesn't seem to be helpful - it is really permissive about tag attributes and doesn't even ban It requires some effort to collect the behavior across numerous JS HTML parsers. So far I know that Angular has a particularly smart parser, but that's probably not a great dependency for a project like |
Ok, now I'm pretty confident there is no parser to switch to in order to address this issue. @angular/compiler contains a nice parser but in itself it doesn't look like a good dependency. Forking it might be a way to go but I'm not convinced it is the right way to go. I would prefer not to maintain a parser too... If there is a nice example on how a certain html fragment should be interpreted according to the spec and how it is different in AST explorer - that better be filed upstream (in the parser repo, htmlparser2). I'll keep this issue open as a reference but I don't have any more to do about it, for now at least. |
I am facing the same issue even if my html being passed has
Output completely skips |
@sairupesh I can't reproduce this. const text = htmlToText(
`<div>
<ul>
<li><i>Point 1 - this is point 1</i></li>
<li><span style="font-weight: 700;">Point 2 - <this is point 2></span></li>
</ul>
</div>`
);
console.log(text);
|
SNIPPET TO REPRODUCE
EXPECTED
there are definitely <10,000 terrestrial planets in the universe. Only few of them would be habitable for future human.
ACTUAL OUTPUT
there are definitely
The text was updated successfully, but these errors were encountered: