Inline and Block Code highlighting

183 views
Skip to first unread message

ayman farhat

unread,
Apr 10, 2013, 7:40:40 AM4/10/13
to highl...@googlegroups.com
Hello everyone, in my web page I am displaying code blocks with highlight js, I am putting my code that is of more than one line with <pre><code></code></pre> and the highlighting works fine. But what I want to do in addition to that is also highlight inline code which is code blocks of one line that are within the text, it is basically a span tag with inlinecode class as the class name. Here is what I did when initializing hljs:

 hljs.initHighlightingOnLoad();
 $('span.inlinecode').each(function(i,e){hljs.highlightBlock(e);});

but the highlighting is not working on span.inlinecode nodes. 

Any ideas why? Thanks for the help.

ayman farhat

unread,
Apr 10, 2013, 10:13:03 AM4/10/13
to highl...@googlegroups.com
Never mind, turned out to be a theme related issue with the selectors. Highlight js itself does catch the element on init.
Reply all
Reply to author
Forward
0 new messages