fix(syntax): per-level heading groups so colorschemes differentiate H1-H6
The single `nuwikiHeading` group linked all six levels to `Title`. Many popular colorschemes (codedark, gruvbox-light, etc.) define `Title` as bold-only with no foreground colour, so every heading rendered as bold text in the Normal colour — H1 and H3 were visually identical. Split into nuwikiHeading1..6 and link each to a different accent (Title / Function / Identifier / Type / Constant / PreProc), matching the per-level Tree-sitter mapping the Neovim semantic-token side already uses. The patterns are mutually exclusive: each requires whitespace immediately after the equals run, so `=` won't match `==`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+19
-2
@@ -63,7 +63,15 @@ endif
|
|||||||
|
|
||||||
syntax case match
|
syntax case match
|
||||||
|
|
||||||
syntax match nuwikiHeading /^\s*=\{1,6}\s.\{-}\s=\{1,6}\s*$/
|
" One match per heading level so colorschemes can style each differently.
|
||||||
|
" Each pattern requires whitespace immediately after the equals run, which
|
||||||
|
" makes the levels mutually exclusive (`==` won't match `===`).
|
||||||
|
syntax match nuwikiHeading1 /^\s*=\s.\{-}\s=\s*$/
|
||||||
|
syntax match nuwikiHeading2 /^\s*==\s.\{-}\s==\s*$/
|
||||||
|
syntax match nuwikiHeading3 /^\s*===\s.\{-}\s===\s*$/
|
||||||
|
syntax match nuwikiHeading4 /^\s*====\s.\{-}\s====\s*$/
|
||||||
|
syntax match nuwikiHeading5 /^\s*=====\s.\{-}\s=====\s*$/
|
||||||
|
syntax match nuwikiHeading6 /^\s*======\s.\{-}\s======\s*$/
|
||||||
syntax match nuwikiHorizontal /^-\{4,}\s*$/
|
syntax match nuwikiHorizontal /^-\{4,}\s*$/
|
||||||
syntax match nuwikiCommentLine /^%%.*$/
|
syntax match nuwikiCommentLine /^%%.*$/
|
||||||
syntax region nuwikiCommentBlock start=/^%%+/ end=/+%%/ keepend
|
syntax region nuwikiCommentBlock start=/^%%+/ end=/+%%/ keepend
|
||||||
@@ -92,7 +100,16 @@ syntax match nuwikiWikilinkTarget /[^|\]]*|/ contained conceal
|
|||||||
syntax region nuwikiTransclusion start=/{{[^{]/ end=/}}/ keepend
|
syntax region nuwikiTransclusion start=/{{[^{]/ end=/}}/ keepend
|
||||||
syntax match nuwikiUrl /\<\(https\?\|ftp\|mailto\|file\):\/\?\/\?\S\+/
|
syntax match nuwikiUrl /\<\(https\?\|ftp\|mailto\|file\):\/\?\/\?\S\+/
|
||||||
|
|
||||||
highlight default link nuwikiHeading Title
|
" Heading levels map to progressively softer accents — matches the Neovim
|
||||||
|
" semantic-token mapping above so static fallback and LSP-driven highlights
|
||||||
|
" agree. Colorschemes that don't differentiate Title vs Function vs etc.
|
||||||
|
" will still show all six as the same colour, but most do.
|
||||||
|
highlight default link nuwikiHeading1 Title
|
||||||
|
highlight default link nuwikiHeading2 Function
|
||||||
|
highlight default link nuwikiHeading3 Identifier
|
||||||
|
highlight default link nuwikiHeading4 Type
|
||||||
|
highlight default link nuwikiHeading5 Constant
|
||||||
|
highlight default link nuwikiHeading6 PreProc
|
||||||
highlight default link nuwikiHorizontal Comment
|
highlight default link nuwikiHorizontal Comment
|
||||||
highlight default link nuwikiCommentLine Comment
|
highlight default link nuwikiCommentLine Comment
|
||||||
highlight default link nuwikiCommentBlock Comment
|
highlight default link nuwikiCommentBlock Comment
|
||||||
|
|||||||
Reference in New Issue
Block a user