mixmark-io / turndown

🛏 An HTML to Markdown converter written in JavaScript
https://mixmark-io.github.io/turndown
MIT License
8.94k stars 881 forks source link

Fix: correctly escape text that would otherwise be interpreted as raw HTML and HTML blocks. #438

Open bjones1 opened 1 year ago

bjones1 commented 1 year ago

See the issues linked below for a good description of the issue. Given readable text in HTML, which renders as <iframe src="http://www.w3schools.com"></iframe>, the correct Turndown translation is \<iframe src="http://www.w3schools.com">\</iframe>, but the current behavior is <iframe src="http://www.w3schools.com"></iframe>.

Closes #106 Closes #261

siminino commented 1 year ago

I need this fixed. It will fix an issue in my projects.

mrdziuban commented 5 months ago

I also just encountered this, would love to see it fixed. @martincizek @pavelhoral any chance you could take a look?

zachleat commented 1 day ago

One more upvote for this PR (and a vouch for it—I tested this one locally and in the @11ty/import project).

Current behavior is a bit dangerous as escaped HTML is converted to unescaped HTML in Turndown output.