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
However, when trying to load a language that doesn't supported by PrismJS will cause a console.warn output Language does not exist [language name].
Description
A silent option for not to print error message when loading a language that hasn't been supported by PrismJS could be helpful.
Alternatives
An API to get all current supported languages, maybe something like Prism.supportedLanguages() so that I could determine whether to use loadLanguages() or not.
For the time being, you could probably also just replace console.warn with a no-op function before you call loadLanguages and restore its function afterward.
(I made an issue to query supported languages (#2146).)
Motivation
I am implementing a syntax highlight plugin for Hexo which requires runnning PrismJS inside Node.js.
I have use this approach (adopted from example provided by PrismJS website) to load supported languages that are not loaded by default:
However, when trying to load a language that doesn't supported by PrismJS will cause a
console.warn
outputLanguage does not exist [language name]
.Description
A
silent
option for not to print error message when loading a language that hasn't been supported by PrismJS could be helpful.Alternatives
An API to get all current supported languages, maybe something like
Prism.supportedLanguages()
so that I could determine whether to useloadLanguages()
or not.My current solution is:
The text was updated successfully, but these errors were encountered: