Syntax

The [syntax] table defines directives for the syntax highlighting support; see syntax highlight for more information and examples.

Language definitions are resolved by file extension and you can see the list of available languages and file extensions here.

Use the map table to create a mapping between a language identifier and a file extension. For example, let's say we want to use the lowercase rust keyword to refer to the Rust language we map our identfier to a known file extension:

[syntax.map]
rust = "rs"

Then when we want to embed Rust code we can use the rust keyword with a fenced code block and the code will be highlighted as Rust:

```rust
// A rust code example
```

This mapping technique is useful if you have a lot of existing documents that use an unknown language identifier.

Back to Settings