You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is this kind of automatic detection a bug or a feature? If it's a feature: Is there a way to switch it off? I don't see any highlighting settings in the configuration docs.
I read #467 and the surrounding discussions. They all revolve around giving users the ability to easier modify themes or even add a plugin API. What I describe here is a bug that already occurs in the default theme.
Steps to reproduce: with a fresh install of MkDocs and a new project add this line to the code block in the autogenerated index.md (or add an additional code block - same result):
from here to there: this should not be highlighted
The code block gets recognized as livescript and is wrongly highlighted.
IMHO this should be fixed independently from what is proposed and discussed in #467 or other issues.
It sounds as if the "fix" you ask for would be a "fix" to the highlight.js library. In that case, the "bug" (incorrectly identifying plain text blocks) should be reported upstream to that library. If you would like a "fix" at the MkDocs level, then that falls under #467. In other words, any changes to MkDocs to address this issue would be the changes discussed in #467. Even if we were to make the drastic change of having highlighting disabled by default for all code blocks, the changes discussed in #467 would be how users would then enable/configure code highlighting. In the unlikely event that such a change was made, it would only happen after a provision to enable/configure code highlighting was available.
My point is that unless I'm missing something obvious, any fix for this issue at the MkDocs level is directly connected with #467.
Do I understand this correctly then that unless #467 is resolved there is no way to prevent verbatim text like this (log output) being randomly highlighted using the available settings and any of the themes MkDocs ships with? Or is there something obvious that I (as a new user) am missing?
@obestwalter Hello from three plus years into the future! Did you ever find a pragmatic fix for this at any (read the docs, mkdocs, or highlight.js) level?
Not ideal, but it worked. Annoying that highlight.js doesn't let you turn off its auto detection (or does it but MkDocs doesn't expose that? ¯\_(ツ)_/¯)
Activity
waylan commentedon Apr 18, 2016
This is a duplicate of #467.
obestwalter commentedon Apr 18, 2016
I read #467 and the surrounding discussions. They all revolve around giving users the ability to easier modify themes or even add a plugin API. What I describe here is a bug that already occurs in the default theme.
Steps to reproduce: with a fresh install of MkDocs and a new project add this line to the code block in the autogenerated
index.md(or add an additional code block - same result):The code block gets recognized as livescript and is wrongly highlighted.
IMHO this should be fixed independently from what is proposed and discussed in #467 or other issues.
d0ugal commentedon Apr 18, 2016
Fixed how?
obestwalter commentedon Apr 18, 2016
In the way that a verbatim block does not get wrongly highlighted as some random language in the default theme with the default settings?
waylan commentedon Apr 18, 2016
It sounds as if the "fix" you ask for would be a "fix" to the highlight.js library. In that case, the "bug" (incorrectly identifying plain text blocks) should be reported upstream to that library. If you would like a "fix" at the MkDocs level, then that falls under #467. In other words, any changes to MkDocs to address this issue would be the changes discussed in #467. Even if we were to make the drastic change of having highlighting disabled by default for all code blocks, the changes discussed in #467 would be how users would then enable/configure code highlighting. In the unlikely event that such a change was made, it would only happen after a provision to enable/configure code highlighting was available.
My point is that unless I'm missing something obvious, any fix for this issue at the MkDocs level is directly connected with #467.
obestwalter commentedon Apr 18, 2016
Do I understand this correctly then that unless #467 is resolved there is no way to prevent verbatim text like this (log output) being randomly highlighted using the available settings and any of the themes MkDocs ships with? Or is there something obvious that I (as a new user) am missing?
waylan commentedon Apr 18, 2016
Per my comments on #467 you may be able to use a Markdown extension to trick things into working the way you want. Outside of that, yes #467 is it.
obestwalter commentedon Apr 18, 2016
o.k. thanks for the clarification.
astorm commentedon Jul 20, 2019
@obestwalter Hello from three plus years into the future! Did you ever find a pragmatic fix for this at any (read the docs, mkdocs, or highlight.js) level?
obestwalter commentedon Jul 20, 2019
Using material theme by @squidfunk and explicitly declaring which highlighting you want in code blocks was basically what did the trick for me.
astorm commentedon Jul 20, 2019
Thank you @obestwalter! I wasn't aware of that theme and it looks pretty nice.
Also for anyone coming along later I ended up dropping an
extra.cssfile into the docs folder with rules like thisNot ideal, but it worked. Annoying that highlight.js doesn't let you turn off its auto detection (or does it but MkDocs doesn't expose that?
¯\_(ツ)_/¯)