I have just come across Codemirror.
I would like to know how to create my own Syntax files (for a toy language), or extend the Syntax file of an existing language with new keywords - however, I can't find any documentation on how to get started.
Has anyone any links on docs that that show how to do this?
Syntax highlighting is one strategy to improve the readability and context of the text; especially for code that spans several pages. The reader can easily ignore large sections of comments or code, depending on what they are looking for. Syntax highlighting also helps programmers find errors in their program.
Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords like if or for in JavaScript differently than strings and comments and variable names.
CodeMirror is a code editor component for the web. It can be used in websites to implement a text input field with support for many editing features, and has a rich programming interface to allow further extension.
http://codemirror.net/doc/manual.html
In the second paragraph it says: "The distribution comes with a few modes (see the mode/ directory), and it isn't hard to write new ones for other languages."
So simply scroll down on that page to the "Writing CodeMirror Modes" part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With