; Syntax highlighting queries for SiSU Spine markup ; Compatible with tree-sitter highlight capture names from ; https://tree-sitter.github.io/tree-sitter/syntax-highlighting ; ================================================================= ; Comments ; ================================================================= (version_comment) @comment.documentation (header_comment) @comment (body_comment) @comment ; ================================================================= ; Header (document metadata) ; ================================================================= ; YAML dialect (sisudoc-spine) (header_field key: (header_key) @keyword) (header_field value: (header_value) @string) (header_continuation) @string ; Bespoke dialect (original SiSU @key: / :subkey:) (sisu_header_field key: (sisu_header_key) @keyword) (sisu_header_field value: (sisu_header_value) @string) (sisu_header_continuation) @string ; ================================================================= ; Headings ; ================================================================= (part_marker) @keyword.directive (segment_marker) @keyword.directive (heading_part content: (heading_content) @markup.heading) (heading_segment content: (heading_content) @markup.heading) (segment_name) @label (suppress_marker) @punctuation.special ; Heading levels for more specific styling (heading_part marker: (part_marker) @markup.heading.1 (#match? @markup.heading.1 "^:A~$")) (heading_part marker: (part_marker) @markup.heading.2 (#match? @markup.heading.2 "^:B~$")) (heading_part marker: (part_marker) @markup.heading.3 (#match? @markup.heading.3 "^:C~$")) (heading_part marker: (part_marker) @markup.heading.4 (#match? @markup.heading.4 "^:D~$")) (heading_segment marker: (segment_marker) @markup.heading.5 (#match? @markup.heading.5 "^1~$")) (heading_segment marker: (segment_marker) @markup.heading.6 (#match? @markup.heading.6 "^2~$")) ; ================================================================= ; Inline formatting ; ================================================================= (emphasis) @markup.italic (bold) @markup.bold (italic) @markup.italic (underline) @markup.underline (citation_mark) @markup.quote (superscript) @markup.superscript (subscript) @markup.subscript (inserted) @markup.underline (strikethrough) @markup.strikethrough (monospace_inline) @markup.raw ; Formatting delimiters ["*{" "}*"] @punctuation.special ["!{" "}!"] @punctuation.special ["/{" "}/"] @punctuation.special ["_{" "}_"] @punctuation.special ["\"{" "}\""] @punctuation.special ["^{" "}^"] @punctuation.special [",{" "},"] @punctuation.special ["+{" "}+"] @punctuation.special ["-{" "}-"] @punctuation.special ["#{" "}#"] @punctuation.special ; ================================================================= ; Footnotes and editor notes ; ================================================================= (footnote) @markup.link (footnote_marker) @punctuation.special (editor_note) @markup.link ["~{" "}~"] @punctuation.special ; Editor-note channel selector: ~[* (asterisk set) or ~[+ (plus set). ; A distinct capture lets themes colour the two channels separately ; from the generic footnote delimiters above. (editor_note_marker) @attribute ["]~"] @punctuation.special ; ================================================================= ; Links and images ; ================================================================= (link text: (link_text) @markup.link.label) (link target: (url) @markup.link.url) (link target: (anchor_ref) @markup.link.url) (link target: (collection_path) @markup.link.url) (auto_footnote_marker) @punctuation.special (image spec: (image_spec) @markup.link.label) (url) @markup.link.url (inline_anchor) @label (anchor_name) @label ; ================================================================= ; Block elements ; ================================================================= (block_open) @keyword.directive (block_close) @keyword.directive (raw_content) @markup.raw ; Code blocks get more specific highlighting (code_block_curly open: (block_open) @keyword.directive) (code_block_curly content: (raw_content) @markup.raw.block) (code_block_curly close: (block_close) @keyword.directive) (code_block_tic open: (block_open) @keyword.directive) (code_block_tic content: (raw_content) @markup.raw.block) (code_block_tic close: (block_close) @keyword.directive) ; ================================================================= ; Book index ; ================================================================= (book_index) @markup.list (index_content) @string ; ================================================================= ; Paragraph prefixes ; ================================================================= (paragraph_prefix) @punctuation.special ; ================================================================= ; Special markers ; ================================================================= (ocn_suppress) @comment (ocn_suppress_open) @comment (ocn_suppress_close) @comment (page_break) @punctuation.special (horizontal_rule) @punctuation.special ; ================================================================= ; Composite includes ; ================================================================= (composite_include) @keyword.import (include_path) @string.special.path ; ================================================================= ; Pipe table ; ================================================================= (table_spec) @keyword.directive (table_row) @markup.raw ; ================================================================= ; Text ; ================================================================= (text) @spell ; Line break (line_break) @punctuation.special