Skip to content

TypeError: grammar is undefined #3310

Discussion options

You must be logged in to vote

A stack trace would have been nice. My guess is that the error occurs here. This means that the languages isn't loaded.

It seems that you also changed something else when you changed Prism.languages[paste.language] -> Prism.languages.rust. Whatever that something was, it loaded all languages (or at least Rust) correctly.

While the incorrect language loading probably isn't Prism's fault, the very non-descriptive error message is. I'll add a better error. (see #3311)


Btw, the reason why HTML, CSS, and JS will always work is that those 3 languages (plus one util language) are always loaded by default. Prism was originally a very web-languages-focused highlighter.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@AlphaBeta1906
Comment options

@RunDevelopment
Comment options

@AlphaBeta1906
Comment options

Answer selected by AlphaBeta1906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants