Is it just me, or has the language detection from tags for syntax highlighting been broken lately? I seem to have noticed a couple of times that scripts containing /* were highlighted as if it that started a comment, like in C, even though the questions had proper-looking shell-related tags.

For example, this answer to a question tagged both and looks like this to me:

enter image description here

Adding <!-- language: bash --> or <!-- language: shell --> manually fixes it, but that doesn't scale too well..

  • That's weird. I just double checked and the sh tag is correctly set to highlight with "lang-sh". Maybe it's the lang-sh that's broken. I will try changing the default for sh to lang-bash and see if that helps.
    – terdon Mod
    Feb 6, 2019 at 18:56
  • Apparently, we've been here before, this question from 4.5 years had the exact same issue: Why prettify mistakes /* as comment for “shell script” (just noticed that from the Related questions list)
    – ilkkachu
    Feb 7, 2019 at 11:37

1 Answer 1


The was set to highlight using lang-sh. I just changed that so it uses lang-bsh instead and that seems to have fixed the issue. I don't know if that's because lang-sh was broken or because lang-sh actually refers to some other language and not sh, but it seems to be OK now:

screenshot of the same answer but now with correct highlighting

If anyone notices issues or objects to having default to bash-style syntax highlighting, please let me or another mod know, preferably by opening a meta thread.

  • 3
    The two tags had different format options specified: lang-sh and lang-bsh. The code formatting script considers them the same, but the SE logic which applies them does not - so it reverted to the default formatter. The default formatter thinks C-style comments are super cool and everyone uses them all the time. By changing the tags to use the same option, you resolved the ambiguity - changing them both to lang-sh would also have worked.
    – Shog9
    Feb 6, 2019 at 21:23
  • 1
    @Shog9 oooh! Thanks for the update!
    – terdon Mod
    Feb 6, 2019 at 21:27
  • 1
    @Shog9, haa, interesting, thanks!
    – ilkkachu
    Feb 7, 2019 at 11:26
  • 1
    @terdon, there's still the shell tag that has lang-sh, so if I get this right, the conflict can arise again if that's used with e.g. bash. If lang-sh and lang-bsh are the same with the actual formatting, maybe all three should be changed to lang-sh (or lang-bsh, but I think sh is clearer). The zsh, ksh etc. tags don't seem to have languages set, so they shouldn't be an issue.
    – ilkkachu
    Feb 7, 2019 at 11:29
  • 1
    @ilkkachu thanks, I just changed that to lang-bsh as well. I agree that lang-sh would make more sense but since many were already set to bsh, it was easier to change the rest as well.
    – terdon Mod
    Feb 7, 2019 at 11:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .