13

I think currently syntax highlight is broken for edit preview and the suggested edit review queue.

This is the case for the majority of posts I've seen, it seems the exception are code fences with a language code. The edit preview also used to render syntax highlight until recently with just the tags and code block indentation being enough.

As I'm writing this I notice someone else has posted about the suggested edits queue. However, I have the impression the number of posts where this happens has increased with the recent changes.

Some examples:

https://stackoverflow.com/review/suggested-edits/27035639

Enter image description here

https://stackoverflow.com/review/suggested-edits/27035474

Enter image description here

The only exception of the few dozen posts I looked at that did have syntax highlight and didn't use a code fence with language code was the following VBA tagged post.

https://stackoverflow.com/review/suggested-edits/27036124

Enter image description here

I am using Firefox on Windows 10.

2
  • 7
    I don't believe we had any highlighting changes alongside the post styling changes. Looking at the examples here, the diff with highlighting is explicitly specifying the language while the others are relying on default detection. That might, indeed, be broken. We'll check it out.
    – Adam Lear StaffMod
    Commented Aug 28, 2020 at 1:09
  • @AdamLear thank you I appreciate it. Please notice the cases in edit preview where indentation with tags was enough to render syntax highlight, that seems to have stopped working...
    – bad_coder
    Commented Aug 28, 2020 at 1:10

2 Answers 2

20

We managed to tackle the issue and disable the temporary fix we put in some time ago. The problem boils down to conflicts between the diff highlighting and the syntax highlighting - because of those issues, we were not able to use both of them at the same time effectively and we turned off the less critical one.

We adjusted the highlighting logic to be able to use both types of highlighting at the same time and reenabled the syntax highlighting on suggested edits. We hope that solves your issues!

5
  • 2
    Could this be the reason why HTML formatting inside highlighted code blocks has started working again? Demo. It's been broken since highlight.js v11 removed it from its core, and SO went with it, silently breaking existing HTML in highlighted code? Especially devious when <strike> stopped working. I have spent many hours over the recent years to fix (downgrade) my most popular posts, just to find now, that it has started working again. I would really, really like some official guideline what to expect, before I waste more of my time. Commented Mar 15, 2023 at 22:35
  • 2
    Yes, you're correct. We have not issued any guideline about it as our focus was on reintroducing syntax highlighting to the suggested edits, but yes, this will work now again, too.
    – marrados StaffMod
    Commented Mar 16, 2023 at 20:30
  • So what about that official guideline? Is HTML formatting inside code cool again? Is it here to stay? Where is this documented? Thank you. Should I post a question instead of this comment? Commented Mar 23, 2023 at 4:17
  • 2
    Thanks for following on that. I can confirm that HTML styling in explicit <pre><code> blocks will work. If you find issues with that, please let us know. On the other hand, we do not support HTML styling in actual code blocks (```). Hope that helps!
    – marrados StaffMod
    Commented Mar 23, 2023 at 16:47
  • Well, you confirmed what I already knew, but dodged the other, more important questions. So, honestly, no, it does not help much. Commented Mar 26, 2023 at 23:58
5

Thanks for raising this. I've been able to reproduce this bug, and I've added it to our backlog for our team to address. We have to address some larger priorities on our roadmap right now, and when we get to this ticket, we'll have more information here.

4
  • This has been unresolved for over a year now since your post. Has there been any progress?
    – Michael M.
    Commented Nov 9, 2022 at 23:35
  • Also, I noticed that syntax highlighting works fine if it is specified in the markdown, but no language is inferred from the tag of the question.
    – Michael M.
    Commented Nov 9, 2022 at 23:46
  • 3
    So... given that we are closing in on 2 years of this bug being in production (which is really disruptive for reviewers) - any progress has been made on it? This is at a minimum a P2-level bug, and it keeps hindering day-to-day curation of the site - surely it can get prioritized a little bit?
    – 0Valt
    Commented Nov 21, 2022 at 13:21
  • 2
    This also causes a large amount of unnecessary edits from people thinking they need to fix syntax highlighting even when it isn't broken, which trickles down to mods with reviewer management. Commented Nov 29, 2022 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .