question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need config setting to turn off auto language detection

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

14reactions
isagalaevcommented, Feb 25, 2014

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?

0reactions
isagalaevcommented, Feb 26, 2014

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Turn on automatic language detection - Microsoft Support
Open a new document or email message. · On the Review tab, in the Language group, click Language. · Click Set Proofing Language....
Read more >
How do I disable, for good, automatic language detection?
In Language Bar ("language thing at the bottom"), right click, Settings... make sure that your default Input Language is defined as English (UK),...
Read more >
How to disable the language detection - ImTranslator
How to disable the language detection. Select the language from the source language drop-down list and mark the "Lock-in language" checkbox.
Read more >
How to disable language autodetection in Word style?
I want to make style to type programming code ...
Read more >
Disable auto language detection - LanguageTool Forum
Hey, thanks for the suggestion! I already have only English in the browser settings though = image.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found