Adding meson syntax highlighting
Introduction
This is a small post/tutorial/diary about how i added meson syntax to my website.
It is no surprise i use Zola to generate my website and besides a few hiccups it all works very well. One of those hiccups is that i like meson but Zola doesn't meet me halfway with meson highlighting.
Fetching
Lucky for me, one can extend what syntaxes Zola can understand via configuration and the usage of .sublime-syntax files from the sublime editor.
So we start by fetching the meson file from sublime, here is the link for syntax highlighting file, let's save on syntaxes in the root tree of my repo.
. ├── config.toml ├── content ├── public ├── sass ├── static ├── syntaxes └── templates 6 directories, 1 file syntaxes/ └── Meson.sublime-syntax 0 directories, 1 file
Configuring
Ok now we need to edit the config.toml file and add the following key:
extra_syntaxes = ["syntaxes"]
That key is an array of directories to look for files ending in .sublime-syntax.
Checking it
Let's check it out by highlighting an example available on the meson documentation.
project('simple', 'c') src = ['source1.c', 'source2.c', 'source3.c'] exe = executable('myexe', src) test('simple test', exe)
Looks good, so this is how we add new syntaxes for Zola.