Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 9
    If I read Josh Goebel's post correctly he suggests option 2b: if an unsupported language hint is specified, then set highlighting to none. In all other cases (for example no language hint, or tags without a default), do autodetection. This should be fairly easy to implement, and it would improve the results (no highlighting is better than wrong highlighting). Maybe people would stop adding the language hint when they find out it defaults to none, so they should be reminded somehow that they should continue, but it would surely be an improvement over the current implementation. Commented Apr 1, 2021 at 21:03
  • 2
    Would the network costs for point 1 be lower when we don't serve everyone the entire library of languages, but subdivide them into several groups, with smallest size n=1 (an optimum can be at n=X). So that we serve smaller libraries, but possibly more often? Commented Apr 1, 2021 at 21:42
  • 7
    @Marijn Yes you understood me correctly. The problem is someone says "This is Pascal code" and SE says "here, I will give you some random language (not Pascal) with NO explanation WHY and without showing any error telling the user "hey pascal is not a valid language"... it entirely subverts users expectations when providing a MANUAL language hint. The manual language hint should either succeed or fail, not result in entirely RANDOM behavior. Adam: What would the harm be in correcting this one element? Commented Apr 2, 2021 at 22:17
  • 3
    Is the problem a huge history of existing posts with ridiculous/incorrect manual hinting of languages? I can't think of any other good reason not to implement that behavior. It would be line going to a diner and ordering a burger and then getting 5 milkshakes and with no explanation. If there aren't burgers available, they say so - or serve nothing at all. Don't give people milkshakes they don't want. Commented Apr 2, 2021 at 22:18
  • 5
    I don’t think point 2 is cogent, and I don’t see a cogent argument against this from animuson either: if a code snippet is tagged with a language that isn’t supported by Stack Overflow’s highlighter, then it shouldn’t be highlighted at all. I honestly find this pretty obvious. Prettify’s behaviour of applying random “makeup” was never justified: it completely misses the point of syntax highlighting, which, after all, isn’t to make code more colourful, but to make it more readable by highlighting semantically meaningful tokens. Prettify performed cargo cult highlighting. Commented May 17, 2021 at 22:21
  • 3
    Would a server side syntax highlighter be considered? Leave the dynamic highlighter for the preview/editor. Commented Jul 15, 2022 at 18:02
  • 1
    I've started giving up and am explicitly tagging unsupported languages as lang-none because the current behavior is so broken. It's a shame because now these code blocks are incorrectly tagged. Commented Feb 23, 2023 at 21:22