Skip to content

StackOverflow's Highlight.js integration is BROKEN when you manually specify language #3183

@joshgoebel

Description

@joshgoebel

Please see: https://meta.stackexchange.com/questions/355852/stop-guessing-auto-detecting-a-language-when-you-know-it-will-be-incorrect/362811#362811

To summarize the issue if someone manually specifies a particular language for a code block: (below ruby is the language specified)

```ruby
def launch
   @rocket.fire!
end
```

Only one of two things should happen.

  1. If the "ruby" grammar is registered with Highlight.js, it should be used.
  2. If not the code block should remain unhighlighted. (operationally an error could be shown)

What actually happens:

StackOverflow RANDOMLY picks a language to use for highlighting, which will always be WRONG and even worse - unpredictable.

What can you do? Post on the linked to thread on StackOverflow... post new threads that bring this to StackOverflows attention(?), contact StackOverflow support... I'm honestly not sure how to get them to fix this. The fix is trivially simple and no one at StackOverflow has yet explained why this cannot or should not be changed.


This thread is created to serve as the primary thread to point people to when they post issues here that are the result of StackOverflows refusal to fix this. Other issues opened will be marked as duplicates and pointed here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discuss/proposeProposal for a new feature/directionhelp welcomeCould use help from community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions