File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -854,19 +854,23 @@ function! s:SyntaxInclude(filetype)
854854 return grouplistname
855855endfunction
856856
857+ function ! s: IsHighlightSourcesEnabledForBuffer ()
858+ " Enable for markdown buffers, and for liquid buffers with markdown format
859+ return &filetype = ~# ' markdown' || get (b: , ' liquid_subtype' , ' ' ) = ~# ' markdown'
860+ endfunction
857861
858862function ! s: MarkdownRefreshSyntax (force)
859863 " Use != to compare &syntax's value to use the same logic run on
860864 " $VIMRUNTIME/syntax/synload.vim.
861865 "
862866 " vint: next-line -ProhibitEqualTildeOperator
863- if & filetype = ~# ' markdown ' && line (' $' ) > 1 && &syntax != ' OFF'
867+ if s: IsHighlightSourcesEnabledForBuffer () && line (' $' ) > 1 && &syntax != ' OFF'
864868 call s: MarkdownHighlightSources (a: force )
865869 endif
866870endfunction
867871
868872function ! s: MarkdownClearSyntaxVariables ()
869- if & filetype = ~# ' markdown '
873+ if s: IsHighlightSourcesEnabledForBuffer ()
870874 unlet ! b: mkd_included_filetypes
871875 endif
872876endfunction
Original file line number Diff line number Diff line change 22 unlet! b:mkd_known_filetypes
33 unlet! b:mkd_included_filetypes
44 unlet! g:vim_markdown_math
5+ unlet! b:liquid_subtype
56
67Given markdown;
78a **b** c
855856Execute (fenced code block with extended info strings):
856857 AssertEqual SyntaxOf('a'), 'mkdCode'
857858
859+ Given liquid;
860+ ```vim
861+ let g:a = 1
862+ ```
863+
864+ Execute (fenced code block syntax in liquid file with markdown subtype):
865+ let b:liquid_subtype = 'markdown'
866+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'MarkdownRefreshSyntax')
867+ call b:func(0)
868+ AssertEqual SyntaxOf('g:a'), 'vimVar'
869+
858870# Code Blocks in pre and code tag
859871
860872Given markdown;
You can’t perform that action at this time.
0 commit comments