You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
If the "ruby" grammar is registered with Highlight.js, it should be used.
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.
The text was updated successfully, but these errors were encountered:
joshgoebel
changed the title
StackOverflow's Highlight.js integration is broken
StackOverflow's Highlight.js integration is BROKEN when you manually specify language
May 8, 2021
The first proposed alternative has been implemented. A change has now been made so Highlight.js will no longer guess the language if the language provided by the user is not currently supported. The highlighting will defer to the default of lang-none in this case. If no language is provided by the user, Highlight.js will still attempt to guess the language based upon the syntax of the code block.
It should be noted that this change only impacts new posts and edited posts. Existing posts have not been rebaked to implement this change.
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)Only one of two things should happen.
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.
The text was updated successfully, but these errors were encountered: