Skip to main content
1 of 7
double-beep
  • 723
  • 4
  • 16

Restore syntax highlighting on review and revision pages

About

Some months ago, Stack Exchange moved to highlight.js v11. One of the breaking changes of this version was the removal of the HTML auto-passthru, which SE uses to indicate addition/deletion in diffs (that is, nested spans in code elements). As a result, highlighting broke in code blocks for diffs.

The bug was reported on MSO and MSE. A week later, a "hotfix" was pushed which has been out for... 2 months! Essentially, it disabled highlight.js entirely on the pages where there were diffs (revisions and suggested edits).

What is this?

This is a highlight.js plugin. The idea as well as a large part of the code have been taken from this GitHub issue.

Screenshots

From revisions:

Diff highlighting in revisions

From suggested edits:

Diff highlighting in suggested edits

License

The script is licensed under the GPL-3.0-or-later license.

Download

GitHub | Install

Platform

The script should work in most browsers and userscript managers. It has been tested on Chrome using Tampermonkey.

Contact

You can add an answer or comment below or create a GitHub issue.

double-beep
  • 723
  • 4
  • 16