mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
Merge pull request #276 from ekliot/main
Make aliased wikilink highlighting consistent
This commit is contained in:
@@ -274,6 +274,7 @@ Telekasten.nvim allows you to color your `[[links]]` and `#tags` by providing
|
|||||||
the following syntax groups:
|
the following syntax groups:
|
||||||
|
|
||||||
- `tkLink` : the link title inside the brackets
|
- `tkLink` : the link title inside the brackets
|
||||||
|
- `tkAliasedLink` : the concealed portion of `[[concealed link|link alias]]`
|
||||||
- `tkBrackets` : the brackets surrounding the link title
|
- `tkBrackets` : the brackets surrounding the link title
|
||||||
- `tkHighlight` : ==highlighted== text (non-standard markdown)
|
- `tkHighlight` : ==highlighted== text (non-standard markdown)
|
||||||
- `tkTag` : well, tags
|
- `tkTag` : well, tags
|
||||||
|
|||||||
@@ -499,10 +499,7 @@ groups:
|
|||||||
- `tkBrackets` : the brackets surrounding the link title
|
- `tkBrackets` : the brackets surrounding the link title
|
||||||
- `tkHighlight` : ==highlighted== text (non-standard markdown)
|
- `tkHighlight` : ==highlighted== text (non-standard markdown)
|
||||||
- `tkTag` : well, tags
|
- `tkTag` : well, tags
|
||||||
- `tkAliasedLink` : link with alias
|
- `tkAliasedLink` : the concealed part of the link (left part of `[[aaa|bbb]]`)
|
||||||
- `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]]`)
|
|
||||||
|
|
||||||
`tkHighlight`, has nothing to do with links but I added it anyway, since I like
|
`tkHighlight`, has nothing to do with links but I added it anyway, since I like
|
||||||
highlighting text when taking notes.
|
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
|
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*
|
Section 3: Usage *telekasten.usage*
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ unlet b:current_syntax
|
|||||||
|
|
||||||
syn region Comment matchgroup=Comment start="<!--" end="-->" contains=tkTag keepend
|
syn region Comment matchgroup=Comment start="<!--" end="-->" contains=tkTag keepend
|
||||||
|
|
||||||
syntax region tkLink matchgroup=tkBrackets start=/\[\[/ end=/\]\]/ display oneline
|
syntax region tkLink matchgroup=tkBrackets start=/\[\[/ end=/\]\]/ keepend display oneline contains=tkAliasedLink
|
||||||
syntax region tkHighlight matchgroup=tkBrackets start=/==/ end=/==/ display oneline contains=tkHighlightedAliasedLink
|
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/\-_]*"
|
||||||
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 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 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'
|
let b:current_syntax = 'telekasten'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user