Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codemirror - adding new keywords to a syntax highlighting file

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?

like image 775
skyeagle Avatar asked Jan 05 '11 17:01

skyeagle


People also ask

What is the use of syntax highlighting?

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.

What is syntax highlighting in JavaScript?

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.

What is the use of CodeMirror?

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.


1 Answers

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.

like image 66
richie Avatar answered Oct 20 '22 20:10

richie