Why does highlight.js ignore language classes?

I use the Highlight.js library to highlight the code syntax in Blogger and refuse to highlight the Lisp code correctly.

In a blogger article:

<pre><code class="lisp"> (coerce (average 1 2 3 4) 'float) > 2.5 </code></pre> 

In the project template before 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> 

After 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> 

In some snippets of code, highlighter places <code class="lisp undefined"> and doesn't want to highlight at all. Since I'm at Blogger, I really don't want to download anything anywhere, especially when language packs are already released. What magic should I do for Lisp to be recognizable?

+4
source share
1 answer

You are using a hosted version that includes a number of definitions for common languages, but Lisp is not one of them. A complete list can be found on the download page . In this case, the word "lisp" in the class attribute is unknown to highlight.js, and it tries to automatically detect the language.

However, even if Lisp was included in the package, it will not highlight your fragment, since it includes output ( > 2.5 ), which is not Lisp, and the definition of Lisp in highlight.js does not allow this.

+6
source

All Articles