As cocomac points out in the comments, this specific instance of the issue may be explained by this; so the example below, that showcases the bug for lang-vim
, is an unfortunate one.
However:
- The same also happens for
lang-console
, which is listed among the supported languages, and at the same timelang-shell
works, so it seems like the bug is there anyways, and it's affecting some aliases handled by Highlight.js and, as shown by the tests conducted by zcoop98, also some "main" language codes (see thelang-javascript
example in their answer; in that case,lang-javascript
, a "main" language code, is broken; bizarrely,lang-js
, an SE alias forlang-javascript
, works); - I'd argue that there's also a side-bug in the discrepancy between what's shown in the preview and what's shown in the edited post for unsupported languages; preview and edited post should be consistent with each other. A minor thing, I agree, but still kinda annoying. Personally, I like to see exactly how my post is gonna look like.
Initial (partially wrong) report, now amended by the paragraphs above:
This is new, it used to work fine up until a few days ago.
On multiple sites (I've experienced this on Ask Ubuntu and Unix & Linux), syntax highlighting when using lang-*
with a language that doesn't have a tag that hints at it is broken; the post is displayed correctly in the preview while editing it, but syntax highlighting isn't applied at all after the edit has been sent through.
I'm saying "with a language that doesn't have a tag that hints at it" because, on the same post, lang-bash
(which I'm pretty sure it's hinted at by bash) works.
The screenshots were taken on Chromium 129.0.6668.89 stable / openSUSE Leap 15.6, however I think the issue may be browser-agnostic (server-sided even, due to the nature of the issue); however, for reference, I get the exact same on Firefox and Chrome on Ubuntu 24.04.
This is the link to the post in the example however this also shouldn't really matter as I'm getting this everywhere, on questions, answers and across sites.
lang-console
is still listed among the supported languages, yet I'm getting the same even forlang-console
. So either the list is not updated or there's something else going on as well (and regardless, the discrepancy is kinda annoying, shouldn't a language that is not going to be highlighted not be higlighted in the preview as well?)console
is used, but your post showsnone
is used.lang-console
is still (supposedly) supported, so I don''t know.lang-console
is listed as Highlight.js alias (inside parentheses), so I wonder if it's only the aliases that don't work now.lang-shell
works. I'll edit the questionlang-vim
norlang-bash
are aliases), so the only thing that that explained the discrepancy (in my mind at the time) was the "being hinted at by a tag" thing; I left that part of the question as is, amending it just in the initial paragraph once I got the full picture thanks to the commentslang-console
not working in the linked Unix.SE post. The reasonlang-vim
is colorless because it's not on the supported list, and the new change makes hints for non-supported languages intentionally colorless. But something odd is definitely going on with that console hint, since it should work, and does in the preview pane, but doesn't in posted posts.lang-js
, and I can't imagine that's the only case. The update seems to have broken many hints.lang-javascript
should've worked, but your tests show it doesn't. So it's a mess. And I now feel like I'm debugging my own crappy code, which I've had enough of for today, so I guess I'll let devs figure out exactly what's going on :)lang-vim
, or why. It's a text editor; the entire point is that the syntax highlighting will depend on what you're editing, not on what you use to edit it.