Dynamic syntax highlighting is highlighting of code that the user can change. There is only one place where this happens, and that is the online editor.
Code snippets, iterations, and the like are static as the user can't change their code on the fly. If you'd like to know more of how we handle static syntax highlighting, check the static syntax highlighting docs.
Dynamic syntax highlighting is done using the CodeMirror library.
When adding support for your language, there are three options:
To enable CodeMirror support for your language, start a topic on the forum. We (Exercism) will then create a Pull Request that enables CodeMirror support for your language on the website.
To use an existing plugin, it needs to be published on NPM.
If the plugin isn't published on NPM, you can either:
The CodeMirror website has a list of community-built language plugins.
The next step is to Enable language.
These are the steps to get going:
codemirror-lang-...
to ensure that one doesn't already exist.To help you get started, the repo created for you contains a minimal sample grammar that you can build on/tweak.
We have an incredibly friendly and supportive community who will be happy to help you as you work through this! If you get stuck, please start a new topic on the Exercism forum or create new issues at exercism/exercism as needed 🙂
You'll then need to publish the plugin on NPM. The next step is to Enable the language.
Your language's syntax (closely) resembles another language's syntax, in which case you could consider using the syntax highlighting of that language for your language. To do so, configure the track using the other language's CodeMirror plugin. See the Enable language section for more information.