@@ -788,7 +788,7 @@ function! s:MarkdownHighlightSources(force)
788788 " Look for code blocks in the current file
789789 let filetypes = {}
790790 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.*' )
792792 if ! empty (ft ) && ft !~# ' ^\d*$' | let filetypes[ft ] = 1 | endif
793793 endfor
794794 if ! exists (' b:mkd_known_filetypes' )
@@ -819,8 +819,10 @@ function! s:MarkdownHighlightSources(force)
819819 else
820820 let include = ' @' . toupper (filetype )
821821 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' : ' ' )
824826 execute printf (' syntax cluster mkdNonListItem add=%s' , group)
825827
826828 let b: mkd_known_filetypes [ft ] = 1
0 commit comments