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) --- .../nvim/queries/sisu/indents.scm | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sundry/editor-syntax-etc/nvim/queries/sisu/indents.scm (limited to 'sundry/editor-syntax-etc/nvim/queries/sisu/indents.scm') diff --git a/sundry/editor-syntax-etc/nvim/queries/sisu/indents.scm b/sundry/editor-syntax-etc/nvim/queries/sisu/indents.scm new file mode 100644 index 0000000..aa73af8 --- /dev/null +++ b/sundry/editor-syntax-etc/nvim/queries/sisu/indents.scm @@ -0,0 +1,48 @@ +; Indentation queries for SiSU Spine markup. +; +; SiSU markup is largely flat: paragraphs and headings live at column 0, +; block bodies preserve their author-supplied indentation verbatim, and +; nesting is by markers rather than by indent. So indents.scm is mostly a +; no-op - the goal is to ensure that auto-indent on stays at column 0 +; for normal lines and respects existing indentation inside header +; continuations and blocks. + +; Tree-sitter indent semantics (per nvim-treesitter and treesit): +; @indent.begin - increases indent for the following line +; @indent.end - matches the @indent.begin and decreases indent +; @indent.zero - resets indent to column 0 +; @indent.align - aligns following lines with this node +; @indent.branch - same level as the parent (for else/elif-style joins) + +; Top-level structures live at column 0 - reset to zero on the next line. +(heading_part) @indent.zero +(heading_segment) @indent.zero +(paragraph) @indent.zero +(book_index) @indent.zero +(composite_include) @indent.zero +(page_break) @indent.zero +(horizontal_rule) @indent.zero +(ocn_suppress_open) @indent.zero +(ocn_suppress_close) @indent.zero +(body_comment) @indent.zero + +; Block elements: opening line increases indent for the body, closing +; line returns to zero. Editors that respect this will visually indent +; raw content one step from the delimiter line, which is conventional. +(code_block_curly) @indent.align +(code_block_tic) @indent.align +(poem_block_curly) @indent.align +(poem_block_tic) @indent.align +(block_block_curly) @indent.align +(block_block_tic) @indent.align +(group_block_curly) @indent.align +(group_block_tic) @indent.align +(table_block_curly) @indent.align +(table_block_tic) @indent.align +(quote_block_tic) @indent.align + +; Header continuation lines are indented by two spaces from column 0; +; mark continuations as align so a host that chooses to auto-indent the +; next continuation line matches the previous one. +(header_field) @indent.align +(header_continuation) @indent.align -- cgit v1.2.3