question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unsupported diff-* highlighting

See original GitHub issue

Issue Description

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 with

`TemplateContentRenderError` was thrown
> "diff-javascript" is not a valid Prism.js language for eleventy-plugin-syntaxhighlight

`Error` was thrown:
    Error: "diff-javascript" is not a valid Prism.js language for eleventy-plugin-syntaxhighlight
        at module.exports (/mnt/c/src/web.dev/node_modules/.pnpm/@11ty/eleventy-plugin-syntaxhighlight@3.0.1_@11ty+eleventy@0.11.0/node_modules/@11ty/eleventy-plugin-syntaxhighlight/src/PrismLoader.js:11:11)
...

Looks like this might require some special handling similarly to TypeScript tag?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
zachleatcommented, Jan 20, 2022

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.

0reactions
RReversercommented, Jan 20, 2022

Amazing, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Diff syntax highlighting in Github Markdown - Stack Overflow
Github's markdown supports diff when formatting code. For example: ```diff public class Hello1 { public static void Main() { - System.
Read more >
Skip highlighting cache for diffs with unsupported characters (!69069 ...
Skip a highlighting cache generation for affected diff files. It doesn't fully resolves the problem but it improves the user experience.
Read more >
Highlighting a .diff file - TeX - LaTeX Stack Exchange
Update: Diff viewers often highlight the background of lines, instead of coloring the text. This can be added with the help of Martin ......
Read more >
What does it do for unsupported languages? Just fall back to ...
Yep! It does a conventional textual diff: run Myers' diff algorithm on lines, then word highlighting on changed lines.
Read more >
Syntax Highlighting - Hugo
css; Cython: cython, pyx, pyrex; D: d; Dart: dart; Diff: diff, udiff; Django/Jinja: django, jinja ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found