From d0cd8444fa69269803d9cda8af6277d2cdbecaee Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 15 May 2026 17:25:47 -0400 Subject: editors syntax highlighting ... - emacs syntax: add tree-sitter major mode for SiSU spine markup New file sisu-spine-ts-mode.el is a sibling of the existing regex mode, backed by Emacs 29+'s built-in treesit.el and the tree-sitter-sisu grammar. It replaces the long font-lock keyword list with treesit-font-lock-rules grouped into eight features (comment, header, heading, block, inline, note, link, index, misc) so users can dial verbosity via treesit-font-lock-level. It also wires up: - treesit-simple-imenu-settings for a heading outline, - treesit-thing-settings for sentence / paragraph motions, - treesit-defun-type-regexp so C-M-a / C-M-e jump heading-to-heading, - a sisu-spine-ts-install-grammar command that registers treesit-language-source-alist and runs treesit-install-language-grammar so users can install the parser from inside Emacs without leaving the editor. - the original sisu-spine-mode.el is unchanged and supported for Emacs < 29 and for users who prefer regex highlighting. - nvim drop-in: point parser fetch at tools/tree-sitter-sisu sundry/editor-syntax-etc/nvim/ The nvim-treesitter install_info now fetches the parser from https://git.sisudoc.org/projects/tree-sitter-sisu which can be cloned via git://git.sisudoc.org/tools/tree-sitter-sisu The fetched paths: files = { "src/parser.c", "src/scanner.c" } submission of the sisu parser to nvim-treesitter's parsers.lua should be a near-trivial one-liner. - the original vim regex highlighter remains as before - sundry/editor-syntax-etc/vim/syntax/sisu-spine.vim - sundry/editor-syntax-etc/vim/templates/{sst,ssm,ssi}.tpl new skeleton templates for the three SiSU markup file types sets up the YAML header (title, creator, date, rights, classify, identfier) - .gitignore - whitelist the new files (assisted by Claude-Code) --- .../editor-syntax-etc/nvim/lua/sisu-spine/init.lua | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sundry/editor-syntax-etc/nvim/lua/sisu-spine/init.lua (limited to 'sundry/editor-syntax-etc/nvim/lua') diff --git a/sundry/editor-syntax-etc/nvim/lua/sisu-spine/init.lua b/sundry/editor-syntax-etc/nvim/lua/sisu-spine/init.lua new file mode 100644 index 0000000..d1ae3df --- /dev/null +++ b/sundry/editor-syntax-etc/nvim/lua/sisu-spine/init.lua @@ -0,0 +1,43 @@ +-- Entry point for the SiSU spine markup Neovim integration. +-- +-- Registers a tree-sitter parser config so users can run +-- :TSInstall sisu +-- to fetch and build the parser via nvim-treesitter. +-- +-- The parser source lives can be found under the +-- `projects/` namespace on git.sisudoc.org. + +local M = {} + +--- Register the `sisu` parser with nvim-treesitter and ensure that +--- `.sst` / `.ssm` / `.ssi` are detected as filetype "sisu". +--- +--- Call once from your init.lua before invoking `:TSInstall sisu`. +function M.setup() + local ok, parsers = pcall(require, "nvim-treesitter.parsers") + if not ok then + vim.notify( + "sisu-spine: nvim-treesitter is not installed; " + .. "syntax highlighting will not be available.", + vim.log.levels.WARN + ) + return + end + + local parser_config = parsers.get_parser_configs() + parser_config.sisu = { + install_info = { + url = "https://git.sisudoc.org/projects/tree-sitter-sisu", + files = { + "src/parser.c", + "src/scanner.c", + }, + branch = "main", + generate_requires_npm = false, + requires_generate_from_grammar = false, + }, + filetype = "sisu", + } +end + +return M -- cgit v1.2.3