CodeMirror variables mode
This is a CodeMirror mode that provides syntax highlighting for variables in arbitrary contexts (e.g. variables that appear in a string for later interpolation).
How to use
Basic use
Load variables.js
at an adequate location in your HTML structure.
Mention mode: 'variables'
when creating your CodeMirror instance.
Configuration
By default, codemirror-mode-variables highlights basic shell-like variables like $foo
and ${bar}
.
It supports custom variable patterns and the CodeMirror tokens it returns can be customised too. Refer to the demo page for further explanations.
Theming
Unless customised, this mode leverages CodeMirror's default tokens and should therefore fit in with all CodeMirror themes.
Nesting
codemirror-mode-variables can be nested within another mode, i.e. it can highlight variables for another mode. This requires adjusting the other mode though. See the demo page for an example of such nesting.
License
This mode is released under the 3-clause BSD license.
Commit History @master
- Add .gitattributes file. Xavier G 2 years ago
- Tag v1.0.4. Xavier G 3 years ago
- Fix access to mode options. Xavier G 3 years ago
- Tag v1.0.3. Xavier G 3 years ago
- consume(): improve performance. Xavier G 3 years ago
- Tag v1.0.2. Xavier G 3 years ago
- Demo page: remove trailing whitespace. Xavier G 3 years ago
- npm: adjust keywords. Xavier G 3 years ago
- Add npm's package.json. Xavier G 3 years ago
- Add README file. Xavier G 3 years ago