You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there! I was thinking it would be useful to have an option to alias certain Markdown languages that are not directly supported by Prism. For example:
This is not really an issue in Node.js environments but it is in bundled (client-side) environments, where as noted in #28, Prism expects you to load the correct language grammars. The aliases listed above are technically valid in most syntax highlighters and flavors of Markdown, but they are not directly supported by Prism, so they cannot be loaded as-is.
Proposed solution
Add a mapping from aliases to actual supported languages
Possible approaches:
Hard-code the mapping internally with an option to opt into aliasing
Allow users to pass in their own alias map.
Some combination of Approaches 1 and 2 (sensible defaults and user overrides)
What do you think?
Additional context
Happy to contribute a PR upon approval
I am not actually running into any problems with my current setup because I use your plugin in a static site generator, so Prism runs in an unbundled environment. Long story short, I use my markdown parser to also parse user-generated comments and render them on my blog, and it works fine for now (I don't know how Netlify bundles serverless functions but it doesn't cause any issues there 🤷♂️). I'm trying to migrate to Cloudflare + Cloudflare Workers, and in that environment the code will eventually be bundled by esbuild/webpack, so it errors when an unsupported language is detected.
The text was updated successfully, but these errors were encountered:
Description
Hi there! I was thinking it would be useful to have an option to alias certain Markdown languages that are not directly supported by Prism. For example:
For example, this:
Would be treated the same as:
This is not really an issue in Node.js environments but it is in bundled (client-side) environments, where as noted in #28, Prism expects you to load the correct language grammars. The aliases listed above are technically valid in most syntax highlighters and flavors of Markdown, but they are not directly supported by Prism, so they cannot be loaded as-is.
Proposed solution
Add a mapping from aliases to actual supported languages
Possible approaches:
What do you think?
Additional context
Happy to contribute a PR upon approval
I am not actually running into any problems with my current setup because I use your plugin in a static site generator, so Prism runs in an unbundled environment. Long story short, I use my markdown parser to also parse user-generated comments and render them on my blog, and it works fine for now (I don't know how Netlify bundles serverless functions but it doesn't cause any issues there 🤷♂️). I'm trying to migrate to Cloudflare + Cloudflare Workers, and in that environment the code will eventually be bundled by esbuild/webpack, so it errors when an unsupported language is detected.
The text was updated successfully, but these errors were encountered: