Allow fenced languages when embedding in another language

Resolves: https://github.com/tpope/vim-liquid/issues/15
This commit is contained in:
Tim Pope
2022-03-18 15:53:03 -04:00
parent ff1caeadba
commit 6be354e576

View File

@@ -126,19 +126,17 @@ syn region markdownCodeBlock matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{
syn match markdownFootnote "\[^[^\]]\+\]" syn match markdownFootnote "\[^[^\]]\+\]"
syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:" syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
if main_syntax ==# 'markdown' let s:done_include = {}
let s:done_include = {} for s:type in g:markdown_fenced_languages
for s:type in g:markdown_fenced_languages if has_key(s:done_include, matchstr(s:type,'[^.]*'))
if has_key(s:done_include, matchstr(s:type,'[^.]*')) continue
continue endif
endif exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends let s:done_include[matchstr(s:type,'[^.]*')] = 1
let s:done_include[matchstr(s:type,'[^.]*')] = 1 endfor
endfor unlet! s:type
unlet! s:type unlet! s:done_include
unlet! s:done_include
endif
syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]" syn match markdownEscape "\\[][\\`*_{}()<>#+.!-]"
syn match markdownError "\w\@<=_\w\@=" syn match markdownError "\w\@<=_\w\@="