eleventy-plugin-syntaxhighlight icon indicating copy to clipboard operation
eleventy-plugin-syntaxhighlight copied to clipboard

Unsupported Languages cause Build Failures

Open Navigatron opened this issue 2 years ago • 2 comments

Situation

I have code blocks in my markdown, like the one below:

```sh
echo "Hello!"
```

"sh" is used here purely for the sake of example - I have 400+ pages of content that I'm in the process of migrating, with much more esoterically-tagged code blocks.

Result

Since "sh" is not a valid Prism language, Prism prints a warning. This causes eleventy to stop the build.

[11ty] Problem writing Eleventy templates:
[11ty] 1. Having trouble rendering liquid template ./source/content/xxxxx/xxxxx.md (via TemplateContentRenderError)
[11ty] 2. "sh" is not a valid Prism.js language for eleventy-plugin-syntaxhighlight (via Error)
[11ty] Wrote 0 files in 1.06 seconds (v1.0.1)

Expected Behavior

If a code block uses a language that isn't recognized, I would prefer if that code block were simply not highlighted at all (or treated as plain text) rather than the entire site failing to build.

Navigatron avatar Jul 13 '22 05:07 Navigatron

Just to add another use-case: I want to add eleventy-charts to my blog, and I also useeleventy-plugin-syntaxhighlight. Since eleventy-charts uses the same triple back-ticks for enclosing chart's data, I can't have both plug-ins running at the same time.

yehudab avatar Sep 27 '22 19:09 yehudab

See potential fix in PR: #73

yehudab avatar Oct 14 '22 17:10 yehudab

Shipping in 5.0.0, an errorOnInvalidLanguage: false option, the default will be to allow invalid languages—you will have to opt-in to throwing an error.

zachleat avatar Apr 12 '23 19:04 zachleat