11ty / eleventy-plugin-syntaxhighlight

A pack of Eleventy plugins for syntax highlighting in Markdown, Liquid, and Nunjucks templates.
https://www.11ty.dev/docs/plugins/syntaxhighlight/
MIT License
129 stars 32 forks source link

Feature: Add option to ignore languages #69

Closed lacrioque closed 1 year ago

lacrioque commented 2 years ago

Short:

Added an option to skip language highlighting.

Reason:

While working on an internal documentation system, we came across an issue with mermaid-graph rendering and language highlighting. We wanted highlighting for the code examples, but the mermaid graphs should be painted. There was no easy way to achieve this, through editing the Prism configuration, so I added an option to filter out specific languages from being rendered out.

Solution:

Additional optional setting `languageFilter´. Default assignment is an empty array, so it will not impact running Installations. This change should be fully backwards compatible. In the highlighting modules (HighlightPairedShortcode, markdownSyntaxHighlightOption) the language will be checked before any linting, or reading action. It checks if the language is included in the option array. If it is a plain "

" will be returned with the language as class and any additional preAttributes set as option.

zachleat commented 2 years ago

Hey, just reading the Mermaid docs https://mermaid-js.github.io/mermaid/#/usage it looks like any element with class="mermaid" on it gets passed to the mermaid API—how do you differentiate between a code block that wants to be syntax highlighted in mermaid and a code block that should be rendered in mermaid? Also reviewing https://traveling-coderman.net/code/eleventy-mermaid/ which seemed to use a mermaid-graph lang

I’m also curious if #50 already solved this without filtering.

zachleat commented 1 year ago

This is an automated message to let you know that this issue requires additional input from the original poster and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.

Do not let the issue’s closing deter you. After you’ve supplied the required information, the issue will be reopened. Thanks!