Exclude certain languages from highlighting altogether
See original GitHub issueMotivation Prism’s current behavior makes it impossible to use Prism and Mermaid on the same page.
Description
I’d like to have what the title in #558 says (“Ignore some html tags”) and not what the provided solution does (“Preserve markup even after Prism has applied syntax highlighting”). The issue I’m facing is having both Mermaid and Prism on the same page and Prism just destroys Mermaid code blocks so Mermaid can’t do anything sensible with it. Instead of preserving markup (which I suppose will also “fix” the problem), I’d like Prism to just not touch .language-mermaid
elements. Is this not possible?
Alternatives
I’ve searched around and found gaearon/gitbook-plugin-prism#28 which proves that there’s a need for this feature and I can’t think of a way to work around this. Had there only been a Prism.highlightElements()
method that took a list of elements I could select and filter beforehand manually, I could have solved this myself. But since this method doesn’t exist, I’m unable to fix this without learning how to develop a Prism plugin of some sort. And I find the Prism API documentation to be very sparse (the available hooks
don’t seem to be documented, for instance), I’m struggling to do so. Please help! 🙏 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
I against this because the resulting function will look something like this:
I think that this is a function simple enough that we don’t need to include it in our library.
I don’t know the details of what you intend here but I guess that it’s similar to #1761.
I’ll make a small plugin for this and ping you when it’s done.
Your assumptions are correct, @RunDevelopment. Even though that helps, It would be nice if Prism could be initialized with a CSS selector or array of elements (as a result from
document.querySelectorAll()
) or (as in highlight.js) the ability toconfigure
a set of white-listedlanguages
Prism should highlight, alternatively black-list the languages it should not highlight.