<!-- thumbnail: https://avatars.githubusercontent.com/u/84144502?s=200&v=4 --> <!-- version: 1.0.0 --> <!-- tag: design --> <!-- excerpt: Restore syntax highlighting on revision and review pages --> ### About Some months ago, Stack Exchange moved to [highlight.js](https://github.com/highlightjs/highlight.js) v11. One of the breaking changes of this version was the [removal of the HTML auto-passthru](https://github.com/highlightjs/highlight.js/blob/main/VERSION_11_UPGRADE.md#feature-removal), which SE uses to indicate addition/deletion in diffs (that is, nested `span`s in `code` elements). As a result, highlighting broke in code blocks for diffs. The bug was reported [on MSO](https://meta.stackoverflow.com/q/408781) and [MSE](https://meta.stackexchange.com/q/366899). 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](https://highlightjs.readthedocs.io/en/latest/plugin-api.html). The idea as well as a large part of the code have been taken from [this GitHub issue](https://github.com/highlightjs/highlight.js/issues/2889). ### Screenshots From revisions: [![Diff highlighting in revisions][1]][1] From suggested edits: [![Diff highlighting in suggested edits][2]][2] ### License The script is licensed under the [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later) license. ### Download [GitHub](https://github.com/userscripters/restore-highlightjs/blob/master/restore_highlightjs.user.js) | [Install](https://raw.githubusercontent.com/userscripters/restore-highlightjs/master/restore_highlightjs.user.js) ### 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](https://github.com/userscripters/restore-highlightjs/issues/new). [1]: https://i.sstatic.net/tymuh.png [2]: https://i.sstatic.net/4OyFK.png