Code blocks should be able to display whether a word is a keyword or variable #352
-
I don't have a particular reason to request this, but I think this would be a neat feature for code blocks in general and especially for code blocks aimed at people trying to learn programming: It crossed my mind how when I was starting to get into programming, I had a really hard time differentiating between "things that have to be written that way" and "things where I can choose how to name them". This is somewhat alleviated by syntax highlighting and variable naming (like 'foo'), but take the first code block on the JS Guide on Loops and Iteration as an example:
I find it hard to give really good examples, because now I immediately recognize where a variable is declared, which objects are just standard like I'd propose to either
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
As we use an external highlighter, I think you should bring this problem to Prism Note that, from a JS perspective. Maybe what you need is more information about what is the global scopes. The Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Yari uses Prism's basic/default JS highlighting. To highlight advanced JS components Prism has provided js-extras. If yari uses the extras then more advanced highlighting can be achieved: If we wish to do this then please raise an issue in We can extend Prism's JS language definition and add Web API interfaces that are global and static methods. This will make code more easy to grasp and it'll be a unique feature for MDN Web Docs site. |
Beta Was this translation helpful? Give feedback.
Yari uses Prism's basic/default JS highlighting. To highlight advanced JS components Prism has provided js-extras. If yari uses the extras then more advanced highlighting can be achieved:
If we wish to do this then please raise an issue in
mdn/yari
repo and ping me. I'll be happy to work on it. 😄We can extend Prism's JS language definition and add Web API interfaces that are global and static methods. This will make code more easy to grasp and it'll be a unique feature for MDN Web Docs site.