-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
Milestone
Description
Describe the issue
When applying highlight.js to the following code block,
<pre><code class="html"><script>foo();</script></code></pre>
I am expecting <script>foo();</script>
, but it prints <script></script>
without foo();
inside. I understand if the javascript cannot be highlighted since the language is set as html. However, the disappearance of the contents does not look good.
Which language seems to have the issue?
html
Are you using highlight
or highlightAuto
?
I used initHighlightingOnLoad
.
...
Sample Code to Reproduce
Here is jsfiddle: https://jsfiddle.net/6ey310qL/1/
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.0/highlight.min.js"></script>
</head>
<body>
<pre><code class="html"><script>foo();</script></code></pre>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>
I changed:
- version 10.0.0
- language as html
- script source to cloudfare:
https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.0/highlight.min.js
Expected behavior
<script>foo();</script>
is printed in the code block.
Additional context
Is this a bug? or a feature?
sangwoo-joh