Language plug-ins need a Languages.xml file in their root plug-in folder. This file defines the rules used to detect what syntax should be used for a given document.

Typically, syntax detection is done using file extensions, but it is also possible to detect languages based on the full filename, the content of the first few lines of the file, or by a combination of detectors.

Here is a simple example file using the markup language Textile as an example:

<?xml version="1.0" encoding="UTF-8"?>

	<language id="com.yourdomain.textile">
		<!-- Define what syntax this language should use;
			 use the name of the syntax you define in Syntaxes -->

		<!-- Human readable name for the language -->

		<!-- Ways to detect the language (see next section) -->

		<!-- Only necessary if you support multiple extensions -->


You can include more than one <language> definition within a single Languages.xml file. See the bundled Ruby.espressoplugin for an example (it defines support for both normal Ruby and ERB template files).


Although most of the elements in Languages.xml should be self-explanatory, you can use several different types of detectors to inform Espresso which files belong to your syntax.

Extension detector

This detector defines a single extension that activates the language. You can include as many <extension> elements within the <detectors> element as you need.


Filename detector

This detector defines an entire filename that activates the language. This is useful for special files like .htaccess, Makefile, etc. There is an optional attribute that allows you to make it case sensitive (default is case insensitive).

<filename casesensitive="true">Makefile</filename>

Content matching detector

This detector actually inspects the contents of the file. The optional lines attribute specifies how many lines of the file have to be loaded to inspect the content. The value of this tag is a regular expression, so you are not limited to fixed values.

<match-content lines="2"><![CDATA[(?i)<!DOCTYPE html]]></match-content>

Combo detector

Finally, you may only wish to apply a language when a combination of detectors have a positive result. This is possible with the <combo> tag. For example:

	<match-content lines="2"><![CDATA[(?i)<!DOCTYPE html]]></match-content>