Table of Contents
Edit modes are defined using XML, the extensible markup language; mode files have the extension .xml. XML is a very simple language, and as a result edit modes are easy to create and modify. This section will start with a short XML primer, followed by detailed information about each supported tag and highlighting rule.
Note that changes to mode files take effect immediately; editing a mode or a mode catalog file within jEdit will cause the file to be re-parsed as soon it is saved.
The Utilities>Reload Edit Modes command can be used to reload edit modes after changes to mode files are made outside jEdit.
A very simple edit mode looks like so:
<?xml version="1.0"?> <!DOCTYPE MODE SYSTEM "xmode.dtd"> <MODE> <PROPS> <PROPERTY NAME="commentStart" VALUE="/*" /> <PROPERTY NAME="commentEnd" VALUE="*/" /> </PROPS> <RULES> <SPAN TYPE="COMMENT1"> <BEGIN>/*</BEGIN> <END>*/</END> </SPAN> </RULES> </MODE> |
Note that each opening tag must have a corresponding closing tag. If there is nothing between the opening and closing tags, for example <TAG></TAG>, the shorthand notation <TAG /> may be used. An example of this shorthand can be seen in the <PROPERTY> tags above.
XML is case sensitive. Span or span is not the same as SPAN.
To insert a special character such as < or > literally in XML (for example, inside an attribute value), you must write it as an entity. An entity consists of the character's symbolic name enclosed with "&" and ";". The most frequently used entities are:
< - The less-than (<) character
> - The greater-than (>) character
& - The ampersand (&) character
For example, the following will cause a syntax error:
<SEQ TYPE="OPERATOR">&</SEQ> |
Instead, you must write:
<SEQ TYPE="OPERATOR">&</SEQ> |
Now that the basics of XML have been covered, the rest of this section will cover each construct in detail.