Skip to main content
added 12 characters in body
Source Link
Makyen Mod
  • 33.2k
  • 14
  • 114
  • 119

The Problem

The issue here was that the syntax highlighting was identifying the code block as Markdown and using the highlighting for that language. This happened because:

  1. The language tag was removed from the question in an edit (see revision 3), which caused lang-sh to not be the only potential syntax highlighting language passed to highlight.js.
  2. The syntax highlighting language for was set to default, which, when there isn't a specific language defined in other question tags, results in feeding the default list of languages to highlight.js as possible highlighting languages. This allows highlight.js to try to find the "best" language among those in the default list. [Note: that the default list is not used when there's a language defined on another tag is an assumption on my part, but that assumption is consistent with how it appears to be operating. I have not looked in SE's code to verify this is actually what's happening.]

Since the default list was being used, highlight.js did the best it could at guessing which language to use from among those in that list and the short amount of code. In this instance, highlight.js ended up deciding that Markdown was the "best", so used syntax highlighting for that language.

Resolution

I have changed the syntax highlighting language for the tag to <none> and rolled back the edit which removed the tag from that question.

The Problem

The issue here was that the syntax highlighting was identifying the code block as Markdown and using the highlighting for that language. This happened because:

  1. The language tag was removed from the question in an edit (see revision 3), which caused lang-sh to not be the only potential syntax highlighting language passed to highlight.js.
  2. The syntax highlighting language for was set to default, which, when there isn't a specific language defined in other question tags, results in feeding the default list of languages to highlight.js as possible highlighting languages. This allows highlight.js to try to find the "best" language among those in the default list. [Note: that the default list is not used when there's a language defined on another tag is an assumption on my part, but that assumption is consistent with how it appears to be operating. I have not looked in SE's code to verify this is actually what's happening.]

Since the default list was being used, highlight.js did the best it could at guessing which language to use from among those in that list and the short amount of code. In this instance, highlight.js ended up deciding that Markdown was the "best", so used syntax highlighting for that language.

Resolution

I have changed the syntax highlighting language for to <none> and rolled back the edit which removed the from that question.

The Problem

The issue here was that the syntax highlighting was identifying the code block as Markdown and using the highlighting for that language. This happened because:

  1. The language tag was removed from the question in an edit (see revision 3), which caused lang-sh to not be the only potential syntax highlighting language passed to highlight.js.
  2. The syntax highlighting language for was set to default, which, when there isn't a specific language defined in other question tags, results in feeding the default list of languages to highlight.js as possible highlighting languages. This allows highlight.js to try to find the "best" language among those in the default list. [Note: that the default list is not used when there's a language defined on another tag is an assumption on my part, but that assumption is consistent with how it appears to be operating. I have not looked in SE's code to verify this is actually what's happening.]

Since the default list was being used, highlight.js did the best it could at guessing which language to use from among those in that list and the short amount of code. In this instance, highlight.js ended up deciding that Markdown was the "best", so used syntax highlighting for that language.

Resolution

I have changed the syntax highlighting language for the tag to <none> and rolled back the edit which removed the tag from that question.

Source Link
Makyen Mod
  • 33.2k
  • 14
  • 114
  • 119

The Problem

The issue here was that the syntax highlighting was identifying the code block as Markdown and using the highlighting for that language. This happened because:

  1. The language tag was removed from the question in an edit (see revision 3), which caused lang-sh to not be the only potential syntax highlighting language passed to highlight.js.
  2. The syntax highlighting language for was set to default, which, when there isn't a specific language defined in other question tags, results in feeding the default list of languages to highlight.js as possible highlighting languages. This allows highlight.js to try to find the "best" language among those in the default list. [Note: that the default list is not used when there's a language defined on another tag is an assumption on my part, but that assumption is consistent with how it appears to be operating. I have not looked in SE's code to verify this is actually what's happening.]

Since the default list was being used, highlight.js did the best it could at guessing which language to use from among those in that list and the short amount of code. In this instance, highlight.js ended up deciding that Markdown was the "best", so used syntax highlighting for that language.

Resolution

I have changed the syntax highlighting language for to <none> and rolled back the edit which removed the from that question.