File tree 2 files changed +18
-2
lines changed
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)
854
854
return grouplistname
855
855
endfunction
856
856
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
857
861
858
862
function ! s: MarkdownRefreshSyntax (force)
859
863
" Use != to compare &syntax's value to use the same logic run on
860
864
" $VIMRUNTIME/syntax/synload.vim.
861
865
"
862
866
" vint: next-line -ProhibitEqualTildeOperator
863
- if & filetype = ~# ' markdown ' && line (' $' ) > 1 && &syntax != ' OFF'
867
+ if s: IsHighlightSourcesEnabledForBuffer () && line (' $' ) > 1 && &syntax != ' OFF'
864
868
call s: MarkdownHighlightSources (a: force )
865
869
endif
866
870
endfunction
867
871
868
872
function ! s: MarkdownClearSyntaxVariables ()
869
- if & filetype = ~# ' markdown '
873
+ if s: IsHighlightSourcesEnabledForBuffer ()
870
874
unlet ! b: mkd_included_filetypes
871
875
endif
872
876
endfunction
Original file line number Diff line number Diff line change 2
2
unlet! b:mkd_known_filetypes
3
3
unlet! b:mkd_included_filetypes
4
4
unlet! g:vim_markdown_math
5
+ unlet! b:liquid_subtype
5
6
6
7
Given markdown;
7
8
a **b** c
855
856
Execute (fenced code block with extended info strings):
856
857
AssertEqual SyntaxOf('a'), 'mkdCode'
857
858
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
+
858
870
# Code Blocks in pre and code tag
859
871
860
872
Given markdown;
You can’t perform that action at this time.
0 commit comments