From 75c557bcbca7d9ebf461629e2818e7c21786e6f7 Mon Sep 17 00:00:00 2001 From: Rane Brown Date: Wed, 8 Jan 2020 06:03:40 -0700 Subject: [PATCH] Disable syntax for indented code blocks. The behavior within lists is not correct. --- doc/vimwiki.txt | 1 - syntax/vimwiki_markdown.vim | 3 ++- syntax/vimwiki_markdown_custom.vim | 5 +++-- test/syntax.vader | 20 -------------------- 4 files changed, 5 insertions(+), 24 deletions(-) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 8e472dc..150e005 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -3489,7 +3489,6 @@ https://github.com/vimwiki-backup/vimwiki/issues. New:~ * PR #787: |:VimwikiRenameLink| works for all directories: even wiki_root/diary/2019-12-11.md if current file is wiki_root/dir1/file.md. - * Add support for markdown indented code blocks. * Issue #764: fenced code blocks are properly supported for markdown syntax i.e. more than 3 backticks, adds tilde support. * Set default |vimwiki-option-list_margin| = 0 for markdown syntax. diff --git a/syntax/vimwiki_markdown.vim b/syntax/vimwiki_markdown.vim index c4e1617..98249e0 100644 --- a/syntax/vimwiki_markdown.vim +++ b/syntax/vimwiki_markdown.vim @@ -82,7 +82,8 @@ let s:markdown_syntax.rxListDefine = '::\%(\s\|$\)' " Preformatted text (code blocks) let s:markdown_syntax.rxPreStart = '\%(`\{3,}\|\~\{3,}\)' let s:markdown_syntax.rxPreEnd = '\%(`\{3,}\|\~\{3,}\)' -let s:markdown_syntax.rxIndentedCodeBlock = '^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+\(^\s*\n\)' +" TODO see syntax/vimwiki_markdown_custom.vim for more info +" let s:markdown_syntax.rxIndentedCodeBlock = '\%(^\n\)\@1<=\%(\%(\s\{4,}\|\t\+\).*\n\)\+' " Math block let s:markdown_syntax.rxMathStart = '\$\$' diff --git a/syntax/vimwiki_markdown_custom.vim b/syntax/vimwiki_markdown_custom.vim index 2f5e5d6..48812dc 100644 --- a/syntax/vimwiki_markdown_custom.vim +++ b/syntax/vimwiki_markdown_custom.vim @@ -190,9 +190,10 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/ \ VimwikiEqInT, \ @Spell +" TODO fix behavior within lists https://github.github.com/gfm/#list-items " indented code blocks https://github.github.com/gfm/#indented-code-blocks -execute 'syntax match VimwikiIndentedCodeBlock /' . vimwiki#vars#get_syntaxlocal('rxIndentedCodeBlock') . '/' -hi def link VimwikiIndentedCodeBlock VimwikiPre +" execute 'syntax match VimwikiIndentedCodeBlock /' . vimwiki#vars#get_syntaxlocal('rxIndentedCodeBlock') . '/' +" hi def link VimwikiIndentedCodeBlock VimwikiPre " syntax group highlighting hi def link VimwikiImage VimwikiLink diff --git a/test/syntax.vader b/test/syntax.vader index 95eb861..b118ba6 100644 --- a/test/syntax.vader +++ b/test/syntax.vader @@ -226,23 +226,6 @@ Given vimwiki (Markdown, Text and Vim): set hlsearch ~~~~~~~~~~~ - Here is an indented code block: - - int main() - - Must be surrounded by blank lines. - - This isn't a code block: - int main() - - But this is one in a list - - Item - - subitem - - int main() - - - list item - - done - Execute (Set syntax markdown): let g:vimwiki_global_vars['vimwiki_automatic_nested_syntaxes'] = 1 call SetSyntax('markdown') @@ -269,9 +252,6 @@ Execute (Assert Code syntax): AssertEqual SyntaxAt(24, 1), 'vimLineComment' AssertEqual SyntaxAt(25, 1), 'vimCommand' AssertEqual SyntaxAt(26, 1), 'VimwikiPre' - AssertEqual SyntaxAt(30, 1), 'VimwikiIndentedCodeBlock' - AssertEqual SyntaxAt(35, 1), '' - AssertEqual SyntaxAt(40, 1), 'VimwikiIndentedCodeBlock' # 11 Math {{{1