automadcms / tree-sitter-automad

Automad grammar for Tree-Sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tree-Sitter Automad

Tree-Sitter grammar for Automad templates.

Installation (Neovim)

In order to enable syntax highlighting in Automad templates when using Neovim, the following two steps are required:

Updating Tree-Sitter Config

First, the automad parser config has to be defined and then added to the ensure_installed table inside the nvim-treesitter setup function.

local parser_config = require('nvim-treesitter.parsers').get_parser_configs()

parser_config.automad = {
  install_info = {
    url = 'https://github.com/automadcms/tree-sitter-automad',
    files = { 'src/parser.c' },
  },
}

require('nvim-treesitter.configs').setup({
  ensure_installed = {
    'html',
    'php',
    'automad',
  },
  auto_install = true,
})

Copying Queries

After updating the Tree-Sitter config, the queries directory in this repository has to be copied to the Neovim config after directory:

git clone https://github.com/automadcms/tree-sitter-automad.git
cp -r ./tree-sitter-automad/queries ~/.config/nvim/after/queries

Note that this assumes that you don't have already a queries directory in your Neovim config.

About

Automad grammar for Tree-Sitter

License:MIT License


Languages

Language:C 95.6%Language:Rust 1.6%Language:JavaScript 1.5%Language:C++ 0.4%Language:Hack 0.4%Language:Scheme 0.2%Language:Python 0.2%