Closed quantizor closed 6 months ago
Hi, <
is not valid symbol, it should be as <
, if you know that provided html may contains some invalid symbols you can fix it with this method:
const fixHtml = (html: string) =>
new DOMParser().parseFromString(html, 'text/html').body.innerHTML;
for "Here is some text with an < angle bracket"
it returns "Here is some text with an < angle bracket"
Hmm I tried this originally and it just printed <
directly into the DOM as plain text without converting back to the original character entity. I'll try playing with it some more... part of the trick is the backing template is used in places other than just the DOM (browser title for example.)
You can try to use processTextSegment
prop with this method:
(text: string) => text.replace('<', '<')
I figured out how to handle it, will be in the next update
Sorry, the solution of this problem makes logic too complicated, so it will not be implemented
@quantizor this problem was fixed in 1.2.0
Glad to hear it, thanks!
For an input string like:
"Here is some text with an < angle bracket"
Currently the
<
is being considered as HTML and theHTML2React
component fails with error "invalid html".