https://github.com/xavierog/codemirror-mode-variables
variables mode for CodeMirror
https://github.com/xavierog/codemirror-mode-variables
codemirror-mode variables
Last synced: about 2 months ago
JSON representation
variables mode for CodeMirror
- Host: GitHub
- URL: https://github.com/xavierog/codemirror-mode-variables
- Owner: xavierog
- License: bsd-3-clause
- Created: 2021-06-19T15:47:56.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-01-04T17:44:29.000Z (5 months ago)
- Last Synced: 2025-03-23T20:11:41.248Z (2 months ago)
- Topics: codemirror-mode, variables
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# CodeMirror variables mode
This is a [CodeMirror](https://codemirror.net/) 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.