Closed Legends closed 9 years ago
Just curious, why don’t you just escape all of the HTML code inside <code>
tag? Although highlight.js will escapes them automatically, but this will only makes your web page HTML becomes invalid (if the code is truncated (or even if it’s valid, but— <!DOCTYPE html>
inside HTML tags???)). And if JavaScript is disabled (or failed to load the file included) then it will breaks your whole web page (?)
Actually, highlight.js doesn't do any automatic escaping (and it shouldn't), and this is exactly the reason why the issue in question happens: all HTML that is supposed to appear literally on the page should be escaped with < and >, otherwise those are just regular tags.
Yes, I thought it does automatic escaping. Now it works!
BTW, we don't autoescape tags because we actually let you use them for any custom highlighting:
<pre><code>
<body>
<span class="important"><h1>....</h1></span>
</code></pre>
The following code breaks using the html class. Just copy & paste the. It's using hl cdn scripts.