-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
I use highlight.js in my site hosted on github pages. The markdown engine redcarpet2 generates HTML tags from markdown code by mark ```language. Since I manually mark the language of all code blocks respectively, I don't really need auto language detection.
In fact, auto language detection produces problems. Without rendering, the markdown correctly translate the code block to
<code class="r language-r" data-lang="r"></code>which should later be rendered as R code. But when I load highlight.js and run
hljs.initHighlightingOnLoad();the auto detect also works and makes the code tags mixed like
<code class="r language-r hljs php" data-lang="r"></code>where php should be eliminated from the class.
Using tag selector and iteratively render all code blocks will solve the problem. But is it better to allow us to disable language auto detection in the config to make it?
I prefer a new method that works like initHighlightingOnLoad() to render all code blocks except that it does not detect language but take the prespecified language as given.