diff --git a/runtime/syntax/lsp_markdown.vim b/runtime/syntax/lsp_markdown.vim index 90d3185673..4be7595807 100644 --- a/runtime/syntax/lsp_markdown.vim +++ b/runtime/syntax/lsp_markdown.vim @@ -1,23 +1,34 @@ " Vim syntax file -" Language: lsp_markdown -" Maintainer: Michael Lingelbach :p:h') .. '/markdown.vim' syn cluster mkdNonListItem add=mkdEscape,mkdNbsp +" Don't highlight invalid markdown syntax in LSP docstrings. +syn clear markdownError + syn clear markdownEscape syntax region markdownEscape matchgroup=markdownEscape start=/\\\ze[\\\x60*{}\[\]()#+\-,.!_>~|"$%&'\/:;<=?@^ ]/ end=/./ containedin=ALL keepend oneline concealends -" conceal html entities +" Conceal backticks (which delimit code fragments). +" We ignore g:markdown_syntax_conceal here. +syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart concealends +syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart concealends +syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend concealends + +" Highlight code fragments. +hi def link markdownCode Special + +" Conceal HTML entities. syntax match mkdNbsp / / conceal cchar= syntax match mkdLt /</ conceal cchar=< syntax match mkdGt />/ conceal cchar=> syntax match mkdAmp /&/ conceal cchar=& syntax match mkdQuot /"/ conceal cchar=" -hi def link mkdEscape special +hi def link mkdEscape Special