@@ -788,7 +788,7 @@ function! s:MarkdownHighlightSources(force)
788
788
" Look for code blocks in the current file
789
789
let filetypes = {}
790
790
for line in getline (1 , ' $' )
791
- let ft = matchstr (line , ' ``` \s*\zs[0-9A-Za-z_+-]*\ze.*' )
791
+ let ft = matchstr (line , ' \(`\{3,}\|\~\{3,}\) \s*\zs[0-9A-Za-z_+-]*\ze.*' )
792
792
if ! empty (ft ) && ft !~# ' ^\d*$' | let filetypes[ft ] = 1 | endif
793
793
endfor
794
794
if ! exists (' b:mkd_known_filetypes' )
@@ -819,8 +819,10 @@ function! s:MarkdownHighlightSources(force)
819
819
else
820
820
let include = ' @' . toupper (filetype )
821
821
endif
822
- let command = ' syntax region %s matchgroup=%s start="^\s*```\s*%s.*$" matchgroup=%s end="\s*```$" keepend contains=%s%s'
823
- execute printf (command , group, startgroup, ft , endgroup, include , has (' conceal' ) && get (g: , ' vim_markdown_conceal' , 1 ) && get (g: , ' vim_markdown_conceal_code_blocks' , 1 ) ? ' concealends' : ' ' )
822
+ let command_backtick = ' syntax region %s matchgroup=%s start="^\s*`\{3,}\s*%s.*$" matchgroup=%s end="\s*`\{3,}$" keepend contains=%s%s'
823
+ let command_tilde = ' syntax region %s matchgroup=%s start="^\s*\~\{3,}\s*%s.*$" matchgroup=%s end="\s*\~\{3,}$" keepend contains=%s%s'
824
+ execute printf (command_backtick, group, startgroup, ft , endgroup, include , has (' conceal' ) && get (g: , ' vim_markdown_conceal' , 1 ) && get (g: , ' vim_markdown_conceal_code_blocks' , 1 ) ? ' concealends' : ' ' )
825
+ execute printf (command_tilde, group, startgroup, ft , endgroup, include , has (' conceal' ) && get (g: , ' vim_markdown_conceal' , 1 ) && get (g: , ' vim_markdown_conceal_code_blocks' , 1 ) ? ' concealends' : ' ' )
824
826
execute printf (' syntax cluster mkdNonListItem add=%s' , group)
825
827
826
828
let b: mkd_known_filetypes [ft ] = 1
0 commit comments