Need config setting to turn off auto language detection
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 10 years ago
- Comments:11 (7 by maintainers)
Top GitHub Comments
Oh, I only just realized that we do have a setting to completely disable auto detection on the page:
hljs.configure({languages: []})
. So, this looks solved then?btw, the version on cdnjs with all the languages is, frankly, a mistake. It was supposed to be exactly like the one hosted on Yandex. And it probably will be like this starting from 8.1.