davidmerfield / Typeset

An HTML pre-proces­sor for web ty­pog­ra­phy
https://typeset.lllllllllllllllll.com/
Creative Commons Zero v1.0 Universal
2.41k stars 52 forks source link

HTML Entities are turned into actual characters #62

Closed sharat87 closed 1 year ago

sharat87 commented 4 years ago

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.

danielhaim1 commented 4 years ago

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