9

The shell-script 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: If anyone notices issues or objects to having shell-script default to ...


7

The code highlighter is more often than not tied to the tags on the questions - tags can have a highlighting hint tied to them, but the c tag didn't have one. I've set that up, so the c block actually highlights now. Sometimes, the highlighter doesn't figure out what it needs to do, so needs help in the form of a highlighting hint: <!-- language: lang-...


7

As explained in this meta.se FAQ post: Stack Exchange does not have its own syntax highlighting engine. It uses Google Code Prettify. Therefore, any bugs and feature requests regarding syntax highlighting cannot be handled by Stack Exchange and should be directed to the team behind Google Code Prettify. In fact, as pointed out by the OP, there is already ...


6

The problem was python, which tells it to use the syntax highlighting associated with the tag python, which for some reason was set to "none". I changed it now, so both the methods you described will work. In the future, you can also directly specify a language from the list in that meta post (instead of specifying a tag), but you need to prefix it with lang,...


6

It's failing on that question because it's tagged with both bash and shell-script. bash is associated with the "bsh" language, which I guess is a bash-specific highlighting. shell-script is associated with generic shell script highlighting. Since the question has two languages defined, prettify doesn't know which it should use and falls back on just doing ...


5

You either need to specify a tag name, or a language prefixed with lang-. There is no registered language named shell, so lang-shell kicks it into a default mode the same as if you'd done lang-foobarbaz, and apparently in that mode it looks for C-style comments. If you do <!-- language: lang-sh -->, or <!-- language: shell --> (which tells it to ...


3

If the question is tagged zsh, it will already apply syntax highlighting 'shell style'. You can see that by checking the Tag Info; at the bottom there's a little message: Code Language (used for syntax highlighting): lang-bsh For the record, ♦ moderators are able to change this. Stack Exchange highlighting isn't smart enough to parse shebangs, but we can ...


2

For your trivial examples, syntax highlighting looks mildly good because they have short strings in them highlighted as such. But for most text I have seen, blanket-wrapping all awk or sed code (especially those that are even mildly complex) as a string is useless. It might as well not be highlighted at all. Not only that, most of the actual text given as ...


Only top voted, non community-wiki answers of a minimum length are eligible