Typeset icon indicating copy to clipboard operation
Typeset copied to clipboard

HTML Entities are turned into actual characters

Open sharat87 opened this issue 5 years ago • 1 comments
trafficstars

I have HTML with entities like &lt; and &gt; in it and when I pass this HTML through typeset, they are replaced with the actual < and > characters and so my HTML comes up incorrect. Check out the following example:

console.log(typeset(`
<!doctype html>
<html lang="en">

<p>Hello &lt;there&gt; you!</p>
`.trim()));

This produces the following output:

<!DOCTYPE html><html lang="en"><head></head><body><p>Hello <there> you!</there></p></body></html>

The &lt; and &gt; around the word there have now turned it into a <threre> tag, with a closing tag as well just before </p> in the final output.

Here's a REPL demonstrating this test case: https://repl.it/@sharat87/BigheartedDefiantCones

Thank you very much for your work.

sharat87 avatar Mar 04 '20 03:03 sharat87

Hey @sharat87, thanks for your contribution. I'll have a look this coming weekend.

danielhaim1 avatar Mar 18 '20 09:03 danielhaim1