Merge pull request #276 from ekliot/main

Make aliased wikilink highlighting consistent
This commit is contained in:
lambtho
2023-09-08 09:44:03 +00:00
committed by GitHub
3 changed files with 13 additions and 11 deletions

View File

@@ -274,6 +274,7 @@ Telekasten.nvim allows you to color your `[[links]]` and `#tags` by providing
the following syntax groups:
- `tkLink` : the link title inside the brackets
- `tkAliasedLink` : the concealed portion of `[[concealed link|link alias]]`
- `tkBrackets` : the brackets surrounding the link title
- `tkHighlight` : ==highlighted== text (non-standard markdown)
- `tkTag` : well, tags

View File

@@ -499,10 +499,7 @@ groups:
- `tkBrackets` : the brackets surrounding the link title
- `tkHighlight` : ==highlighted== text (non-standard markdown)
- `tkTag` : well, tags
- `tkAliasedLink` : link with alias
- `tkHighlightedAliasedLink` : link with alias in `tkAliasedLink`
- `tkLinkAlias` : body of the link (left part of `[[aaa|bbb]]`)
- `tkLinkBody` : alias of the link (right part of `[[aaa|bbb]]`)
- `tkAliasedLink` : the concealed part of the link (left part of `[[aaa|bbb]]`)
`tkHighlight`, has nothing to do with links but I added it anyway, since I like
highlighting text when taking notes.
@@ -533,6 +530,12 @@ You can assign colors to the new syntax groups in your `init.vim`:
hi tkTag ctermfg=175 guifg=#d3869B
<
NOTE: Users configuring the following highlight groups prior to 09/2023, be aware they are deprecated:
- `tkHighlightedAliasLink`: this syntax group is now covered by `tkHighlight`
- `tkLinkBody`: this syntax group is renamed to `tkAliasedLink`
- `tkAliasedLink`: this group used to cover the whole link, it is now equivalent to the former `tkLinkBody`
- `tkLinkAlias`: this rule is deprecated
================================================================================
Section 3: Usage *telekasten.usage*

View File

@@ -8,8 +8,10 @@ unlet b:current_syntax
syn region Comment matchgroup=Comment start="<!--" end="-->" contains=tkTag keepend
syntax region tkLink matchgroup=tkBrackets start=/\[\[/ end=/\]\]/ display oneline
syntax region tkHighlight matchgroup=tkBrackets start=/==/ end=/==/ display oneline contains=tkHighlightedAliasedLink
syntax region tkLink matchgroup=tkBrackets start=/\[\[/ end=/\]\]/ keepend display oneline contains=tkAliasedLink
syntax match tkAliasedLink "[^\[\]]\+|" contained conceal
syntax region tkHighlight matchgroup=tkBrackets start=/==/ end=/==/ display oneline contains=tkAliasedLink
syntax match tkTag "\v#[a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\-_]*"
syntax match tkTag "\v:[a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\-_]*:"
@@ -17,10 +19,6 @@ syntax match tkTag "\v:[a-zA-ZÀ-ÿ]+[a-zA-ZÀ-ÿ0-9/\-_]*:"
syntax match tkTagSep "\v\s*,\s*" contained
syntax region tkTag matchgroup=tkBrackets start=/^tags\s*:\s*\[\s*/ end=/\s*\]\s*$/ contains=tkTagSep display oneline
syntax region tkAliasedLink start="\[\[[^\]]\+|" end="\]\]" keepend oneline contains=tkLinkAlias,tkLinkBody
syntax region tkHighlightedAliasedLink start="\[\[[^\]]\+|" end="\]\]" keepend oneline contained contains=tkLinkAlias,tkLinkBody
syntax region tkLinkAlias start="|"ms=s+1 end=".+\]\]"me=e-2 keepend contained
syntax region tkLinkBody start="\[\["ms=s+2 end="|" keepend contained conceal
let b:current_syntax = 'telekasten'
@@ -38,4 +36,4 @@ let b:current_syntax = 'telekasten'
"
" " Tags
" hi tkTagSep ctermfg=gray
" hi tkTag ctermfg=magenta
" hi tkTag ctermfg=magenta