Closed RReverser closed 2 years ago
@peterjcaulfield Right, I'm aware of that manual syntax, but that's different, and very hard to maintain for complex diffs. Whereas real diff syntax support can be applied to unifieddiffs copied from Git.
Yep gotcha. It seems like there are issues with a number of Prism plugins when used in a Node env.
Starting with now-available v3.2.1 of this plugin, you can use diff-
on the prefix of your language and Eleventy will use the official Prism.js diff-highlight plugin. Look to https://www.11ty.dev/docs/plugins/syntaxhighlight/ soon for the official docs on this.
Amazing, thanks!
With the following in my .md
file
```diff-js function test(a) { + const b = a + 1; const anotherThingThatIWantToBeHighlighted = 'nope'; - return b; } ```
I end up with this (only the +/- lines have been tokenized). Should this work now and/or am I missing something?
edit: on further inspection, I think it looks like tokenization will work throughout the block (even for unchanged lines) as long as the first line begins with a +
or a -
. Is this a known limitation?
edit some more: think I'm talking nonsense – seems like the amount of indentation is important, and I hadn't indented certain lines by the right amount. Please ignore me
Prism allows convenient diff line highlighting with preservation of underlying syntax highlighting via a Diff Highlight plugin: https://prismjs.com/plugins/diff-highlight/
However, trying to use it via 11ty via e.g.
```diff-javascript
tag currently fails withLooks like this might require some special handling similarly to TypeScript tag?