Skip to content

Commit 41084cc

Browse files
committed
Add syntax highlighting for shortcut reference links
Shortcut reference links are defined in three of the most common Markdown implementations: - [Pandoc](https://pandoc.org/MANUAL.html#extension-shortcut_reference_links) - [CommonMark](https://spec.commonmark.org/0.29/#shortcut-reference-link) - [Github Flavored Markdown](https://github.github.com/gfm/#shortcut-reference-link)
1 parent e875717 commit 41084cc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

syntax/markdown.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(
8383
syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained
8484
syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
8585
syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline
86+
syn region markdownShortcutLink matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^][]*]\%( \=[[(]\)\@!\)\@=" end="\]" contains=@markdownInline,markdownLineStart
8687

8788
let s:concealends = ''
8889
if has('conceal') && get(g:, 'markdown_syntax_conceal', 1) == 1
@@ -144,6 +145,7 @@ hi def link markdownLinkText htmlLink
144145
hi def link markdownIdDeclaration Typedef
145146
hi def link markdownId Type
146147
hi def link markdownAutomaticLink markdownUrl
148+
hi def link markdownShortcutLink markdownId
147149
hi def link markdownUrl Float
148150
hi def link markdownUrlTitle String
149151
hi def link markdownIdDelimiter markdownLinkDelimiter

0 commit comments

Comments
 (0)