Summary
Support diff-style highlighting: +/- prefixed lines get green/red backgrounds, combinable with a base language (e.g. diff-php).
Details
- Client mode: bundle
prism-diff grammar plus the diff-highlight Prism plugin in frontend.js; expose a "Show as diff" toggle or diff-{language} handling in the language logic.
- Server mode: highlight.php supports
diff as a language; combined diff+language rendering needs a custom pass in render_code_block_server() (split lines by +/-, highlight the remainder with the base language, then wrap).
- Extend
remap_token_classes() for diff token classes; add styling to hljs-server-mode.css/frontend.css.
- Follow the standard flow: JS attribute schema → save output →
render_code_block() → frontend Prism plugin support.
Why
Extremely common in tutorials and changelogs ("change this line to that"). Prism's diff-highlight is well-proven; few WP block plugins expose it.
Speed to implement: Medium · Usefulness: High · Rank: 3
Summary
Support diff-style highlighting:
+/-prefixed lines get green/red backgrounds, combinable with a base language (e.g.diff-php).Details
prism-diffgrammar plus thediff-highlightPrism plugin infrontend.js; expose a "Show as diff" toggle ordiff-{language}handling in the language logic.diffas a language; combined diff+language rendering needs a custom pass inrender_code_block_server()(split lines by+/-, highlight the remainder with the base language, then wrap).remap_token_classes()for diff token classes; add styling tohljs-server-mode.css/frontend.css.render_code_block()→ frontend Prism plugin support.Why
Extremely common in tutorials and changelogs ("change this line to that"). Prism's diff-highlight is well-proven; few WP block plugins expose it.
Speed to implement: Medium · Usefulness: High · Rank: 3