Highlighting

Syntax Highlighting

Mendoza supports syntax highlighting for a few languages built it, and also has a simple mechanism for adding more languages. Built in grammars include Janet, C, and HTML.

Simple Example

Syntax highlighting occurs in @codeblock blocks. For example, the following markup will do syntax highlighting for some Janet source code.

@codeblock[janet]```
(def a (+ 1 2))
```

Produces:

(def a (+ 1 2))

Adding More Grammars

To add more grammars, you will need to add a Janet source file in the syntax/ folder of your source. Mendoza will automatically load syntaxes on demand if you reference them in your content files.

The built-in grammars are probably a good starting point if you would like highlighting for a language that is not yet supported. Alternatively, you can raise an issue on GitHub for more built-in grammars.