davidmerfield/Typeset

HTML Entities are turned into actual characters

sharat87 opened this issue · 1 comments

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.

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