33

In this answer, I updated the name of the class from Testing to SpellCheck, but the revision history, while looking it on inline mode, shows it as TestingSpellCheck.

"TestingSpellCheck" is shown on inline mode

It's shown correctly when using the other modes, as side-by-side:

side-by-side renders it correctly

10
  • reproed in inline mode. o_O
    – 0Valt
    Commented Jun 26, 2021 at 10:26
  • 12
    Yep. It looks like highlighting is completely broken/missing in code blocks for inline diffs.
    – Cody Gray Mod
    Commented Jun 26, 2021 at 10:29
  • "It's shown correctly when using the other modes, as side-by-side", it doesn't highlight it though (except when you click on Full), so I wouldn't call that "correctly". The only mode that seems to work as expected is "Side-by-side Markdown".
    – 41686d6564
    Commented Jun 26, 2021 at 11:03
  • 3
    The highlighting flashes for a fraction of a second when the page is refreshed].
    – 41686d6564
    Commented Jun 26, 2021 at 11:07
  • what's of interest is that the markup generated considers the merged name to be the actual class name: <span class="hljs-title class_">TestingSpellCheck</span>
    – 0Valt
    Commented Jun 26, 2021 at 11:50
  • 4
    What appears to be happening is that the difference highlighting is overwritten by the code syntax highlighting.
    – Makyen Mod
    Commented Jun 26, 2021 at 19:47
  • 2
    Also reported on MSE: Sometimes diff isn't shown in edits to code inside source fences. Commented Jun 27, 2021 at 0:48
  • Another example: no highlight at all when in "Side-by-side" mode (my favorite mode)
    – ZygD
    Commented Jun 28, 2021 at 10:29
  • 2
    More examples from a duplicate question of mine: Diffs of code blocks are pretty consistently broken. This makes reviewing Suggested Edits much harder; code changes are often invisible unless you use the Markdown view, which is in turn pretty bad for reviewing changes to big code blocks.
    – Mark Amery
    Commented Jun 28, 2021 at 18:53
  • 4
    I'm investigating now đź‘€ I can reproduce, this seems like a critical bug to fix
    – Kyle Pollard StaffMod
    Commented Jul 5, 2021 at 14:53

2 Answers 2

20

A hotfix is now in place for this bug on both the /posts/{id}/revisions and /review/suggested-edits/{id} pages. Revisions will now be highlighted correctly in code blocks:

A screenshot showing revision history properly highlighting removals and additions

This is a problem with highlight.js overriding the classes used to show these additions and deletions. My hotfix disables highlight.js on the revisions page.

We have plans to revisit the syntax highlighting regression on the /posts/{id}/revisions and /review/suggested-edits/{id}, but for now our syntax highlighting is incompatible with also showing the highlighting for additions and deletions. Although the original bug has been fixed, I'm going to mark this specific bug as until we fix the syntax highlighting regression introduced by the hotfix.

15
  • 3
    I'm just realizing that this is not just broken on the /revisions page but also on some review pages as highlighted in the comments above. Working on a hotfix for those pages too, thanks for your patience!
    – Kyle Pollard StaffMod
    Commented Jul 5, 2021 at 17:55
  • 3
    So.. we're going from not having diffs in code in one view to not know if the edit made the post better when adding a language tag? How are we suppose to know if the edit is good or not?
    – Scratte
    Commented Jul 5, 2021 at 18:08
  • 2
    This makes me realize that this question is also caused by the same issue. Time to edit my (thankfully few) posts that used strikethrough in code blocks... Maybe there should be warnings for users if they do this from now on. Commented Jul 5, 2021 at 18:22
  • 3
    Along with the issues of overwriting diffs, I see these types of warnings very often now. For most of those, I don't see any un-escaped HTML.
    – Scratte
    Commented Jul 5, 2021 at 18:25
  • 1
    The hotfix is now also in place for the /review/suggested-edits/{id} page as well.
    – Kyle Pollard StaffMod
    Commented Jul 5, 2021 at 18:47
  • 6
    @Scratte your feedback has been noted - today's my first day working with the revisions page so I don't know what our intentions are here, but I'll follow up on the warning and code highlighting.
    – Kyle Pollard StaffMod
    Commented Jul 5, 2021 at 19:02
  • 3
    @AbdulAzizBarkat could definitely be related to this change, I've flagged it to my team
    – Kyle Pollard StaffMod
    Commented Jul 5, 2021 at 19:07
  • 2
    Example review. I can't review this because I cannot tell if it highlights correctly. Not even if I "Improve edit" or "Reject and edit". Before I could see the highlighting and then pick "Side-by-side Markup" to see if there were any code changes. Now I'm forced to pick "Side-by-side Markup" on every code post and Skip every edit that makes a change to the highlighting. If there's no change to the highlighting, I must open up the post on the side :(
    – Scratte
    Commented Jul 5, 2021 at 20:02
  • @KylePollard: will the script be fixed for inline formatting of code blocks as well? This was actually sometimes quite useful to let the reader focus on what changes were made. Commented Jul 26, 2021 at 21:30
  • 3
    Hey Kyle, is there any update on this?
    – Luuklag
    Commented Sep 8, 2021 at 13:59
  • 2
    People around the network are starting to believe this is a feature and not a hotfix applied - please, can something be done about it? I understand that the issue is likely not easy to fix, but this makes reviewing suggested edits a very frustrating experience - I used to review a lot in this queue, now I hardly do several a month...
    – 0Valt
    Commented Sep 8, 2021 at 14:25
  • 2
    @Luuklag this bug got incorrectly handed off between teams internally here and got forgotten - I've followed up on it and it will be prioritized in an upcoming sprint instead of being stuck in our backlog forever. Thank you for your reminder and patience!
    – Kyle Pollard StaffMod
    Commented Sep 8, 2021 at 14:55
  • 4
    @OlegValter Not to worry. If a US 4th of July holiday can go on until September, I think we don't have to feel inclined to review more than a post a year ;)
    – Scratte
    Commented Sep 8, 2021 at 15:02
  • @KylePollard this bug seems to have come back: sample review Commented Sep 15, 2022 at 4:50
  • 2
    This is fixed now: meta.stackoverflow.com/a/423542/3023052
    – Kyle Pollard StaffMod
    Commented Mar 8, 2023 at 18:26
7

This happens because of the "recent" highlight.js v11 migration (specifically this feature removal). highlight.js. The library now strips unescaped HTML inside code elements and that includes the .diff-add/.diff-delete spans SE uses in diffs to indicate addition/deletion.

Until a permanent fix is out, I've created a userscript that should resolve both issues (the original bug and the "hotfix"):

You must log in to answer this question.

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