X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/157b835b53c82ad7d52cc5083683eb3129429128..f9a841ef7c6cd7a8c97035896c5ba683069be236:/syntax/mkd.vim?ds=inline diff --git a/syntax/mkd.vim b/syntax/mkd.vim index 56f219a..eb87165 100644 --- a/syntax/mkd.vim +++ b/syntax/mkd.vim @@ -15,7 +15,10 @@ if version < 600 so :p:h/html.vim else runtime! syntax/html.vim - unlet b:current_syntax + + if exists('b:current_syntax') + unlet b:current_syntax + endif endif if version < 600 @@ -45,9 +48,9 @@ syn region htmlBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" " [link](URL) | [link][id] | [link][] syn region mkdFootnotes matchgroup=mkdDelimiter start="\[^" end="\]" -syn region mkdLink matchgroup=mkdDelimiter start="\\\@/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell syn region mkdCode start=/\(\([^\\]\|^\)\\\)\@]*>" end="" syn region mkdCode start="]*>" end="" -syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ +syn region mkdFootnote start="\[^" end="\]" +syn match mkdCode /^\s*\n\(\(\s\{8,}[^ ]\|\t\t\+[^\t]\).*\n\)\+/ +syn match mkdIndentCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/ contained syn match mkdListItem "^\s*[-*+]\s\+" syn match mkdListItem "^\s*\d\+\.\s\+" +syn region mkdNonListItemBlock start="\n\(\_^\_$\|\s\{4,}[^ ]\|\t+[^\t]\)\@!" end="^\(\s*\([-*+]\|\d\+\.\)\s\+\)\@=" contains=@mkdNonListItem,@Spell syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/ syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/ syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/ @@ -88,9 +94,24 @@ syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contain syn match htmlH1 /^.\+\n=\+$/ contains=@Spell syn match htmlH2 /^.\+\n-\+$/ contains=@Spell +if get(g:, 'vim_markdown_math', 0) + syn region mkdMath matchgroup=mkdDelimiter start="\\\@ + let b:current_syntax = "mkd" delcommand HtmlHiLink