admin管理员组文章数量:1313076
I'm using the Highlight.js library for syntax highlighting of code in Blogger and it refuses to highlight Lisp code properly.
In the article on Blogger:
<pre><code class="lisp">
(coerce (average 1 2 3 4) 'float)
> 2.5
</code></pre>
In the design template before the closing </head>
:
<script src='.0/lisp.min.js' ></script>
<script src='.0/highlight.min.js' ></script>
<link href='.0/styles/github.min.css' rel='stylesheet' />
<script type='text/javascript'>
hljs.initHighlightingOnLoad();
</script>
Upon opening the article the highlighting is broken, Firebug shows this in the HTML panel:
<pre>
<code class="lisp ruby"> // WTF
... stylized RUBY tokens here ...
</code>
</pre>
On some code snippets highlighter puts <code class="lisp undefined">
and refuses to highlight at all. As I'm on a Blogger, I really don't want to download anything to anywhere, especially when there is already published language packs. What magic should I do for Lisp to bee recognizable?
I'm using the Highlight.js library for syntax highlighting of code in Blogger and it refuses to highlight Lisp code properly.
In the article on Blogger:
<pre><code class="lisp">
(coerce (average 1 2 3 4) 'float)
> 2.5
</code></pre>
In the design template before the closing </head>
:
<script src='http://yandex.st/highlightjs/7.0/lisp.min.js' ></script>
<script src='http://yandex.st/highlightjs/7.0/highlight.min.js' ></script>
<link href='http://yandex.st/highlightjs/7.0/styles/github.min.css' rel='stylesheet' />
<script type='text/javascript'>
hljs.initHighlightingOnLoad();
</script>
Upon opening the article the highlighting is broken, Firebug shows this in the HTML panel:
<pre>
<code class="lisp ruby"> // WTF
... stylized RUBY tokens here ...
</code>
</pre>
On some code snippets highlighter puts <code class="lisp undefined">
and refuses to highlight at all. As I'm on a Blogger, I really don't want to download anything to anywhere, especially when there is already published language packs. What magic should I do for Lisp to bee recognizable?
1 Answer
Reset to default 7You're using the hosted version which includes a number of definitions for mon languages but Lisp is not among them. See the download page for the full list. In this case the "lisp" word in the class attribute is unknown to highlight.js and it tries to detect the language automatically.
However even if Lisp was included in the package it wouldn't highlight your fragment since it includes output (> 2.5
) that is not Lisp and the definition of Lisp in highlight.js doesn't allow for this.
本文标签: javascriptWhy the highlightjs ignores the language classesStack Overflow
版权声明:本文标题:javascript - Why the highlight.js ignores the language classes? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741927786a2405392.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论