Markdown
Markdown support is available natively in Gram.
- Tree-sitter: tree-sitter-markdown
- Language Server: zk
Syntax Highlighting Code Blocks
Gram supports language-specific syntax highlighting of markdown code blocks by leveraging tree-sitter language grammars. All Gram supported languages, including those provided by official or community extensions, are available for use in markdown code blocks. All you need to do is provide a language name after the opening ``` code fence like so:
```python
import functools as ft
@ft.lru_cache(maxsize=500)
def fib(n):
return n if n < 2 else fib(n - 1) + fib(n - 2)
```
Configuration
Language Server (zk)
Gram comes with support for the zk zettelkasten language server built in.
To enable it, add this to your settings.json:
"languages": {
"Markdown": {
"language_servers": ["zk"],
}
},
See the documentation more information
about zk and the zettelkasten system for note taking.
Format
Gram supports using Prettier to automatically re-format Markdown documents. You
can trigger this manually via the {#action editor::Format} action or via the
{#kb editor::Format} keyboard shortcut. Alternately, you can automatically
format by enabling format_on_save in
your settings.json:
"languages": {
"Markdown": {
"format_on_save": "on"
}
},
Trailing Whitespace
By default Gram will remove trailing whitespace on save. If you rely on
invisible trailing whitespace being converted to <br /> in Markdown files you
can disable this behavior with:
"languages": {
"Markdown": {
"remove_trailing_whitespace_on_save": false
}
},