Starlight
Syntax highlighting of custom languages
To add syntax highlighting for a language that is not supported by Shiki by default, follow these instructions.
Example: Odin
- Find a suitable textmate json object file, such as this.
- save the file to e.g.
src/syntax/odin.tmLanguage.json
- save the file to e.g.
- Edit
astro.config.js
- Add:
1 integrations: [starlight({2 title: 'jmn docs',3 expressiveCode: {4 plugins: [pluginLineNumbers()],5 shiki: {6 langs: [7 JSON.parse(fs.readFileSync('./src/syntax/odin.tmLanguage.json', 'utf-8'))8 ]9 }10 },11 ...
Example Odin code block
1package main2
3import "core:fmt"4
5main :: proc() {6 fmt.println("Hellope, World!");7}