Disable syntax for indented code blocks.

The behavior within lists is not correct.
This commit is contained in:
Rane Brown 2020-01-08 06:03:40 -07:00
parent d9412218e3
commit 75c557bcbc
4 changed files with 5 additions and 24 deletions

View File

@ -3489,7 +3489,6 @@ https://github.com/vimwiki-backup/vimwiki/issues.
New:~ New:~
* PR #787: |:VimwikiRenameLink| works for all directories: even * PR #787: |:VimwikiRenameLink| works for all directories: even
wiki_root/diary/2019-12-11.md if current file is wiki_root/dir1/file.md. 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 * Issue #764: fenced code blocks are properly supported for markdown
syntax i.e. more than 3 backticks, adds tilde support. syntax i.e. more than 3 backticks, adds tilde support.
* Set default |vimwiki-option-list_margin| = 0 for markdown syntax. * Set default |vimwiki-option-list_margin| = 0 for markdown syntax.

View File

@ -82,7 +82,8 @@ let s:markdown_syntax.rxListDefine = '::\%(\s\|$\)'
" Preformatted text (code blocks) " Preformatted text (code blocks)
let s:markdown_syntax.rxPreStart = '\%(`\{3,}\|\~\{3,}\)' let s:markdown_syntax.rxPreStart = '\%(`\{3,}\|\~\{3,}\)'
let s:markdown_syntax.rxPreEnd = '\%(`\{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 " Math block
let s:markdown_syntax.rxMathStart = '\$\$' let s:markdown_syntax.rxMathStart = '\$\$'

View File

@ -190,9 +190,10 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
\ VimwikiEqInT, \ VimwikiEqInT,
\ @Spell \ @Spell
" TODO fix behavior within lists https://github.github.com/gfm/#list-items
" indented code blocks https://github.github.com/gfm/#indented-code-blocks " indented code blocks https://github.github.com/gfm/#indented-code-blocks
execute 'syntax match VimwikiIndentedCodeBlock /' . vimwiki#vars#get_syntaxlocal('rxIndentedCodeBlock') . '/' " execute 'syntax match VimwikiIndentedCodeBlock /' . vimwiki#vars#get_syntaxlocal('rxIndentedCodeBlock') . '/'
hi def link VimwikiIndentedCodeBlock VimwikiPre " hi def link VimwikiIndentedCodeBlock VimwikiPre
" syntax group highlighting " syntax group highlighting
hi def link VimwikiImage VimwikiLink hi def link VimwikiImage VimwikiLink

View File

@ -226,23 +226,6 @@ Given vimwiki (Markdown, Text and Vim):
set hlsearch 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): Execute (Set syntax markdown):
let g:vimwiki_global_vars['vimwiki_automatic_nested_syntaxes'] = 1 let g:vimwiki_global_vars['vimwiki_automatic_nested_syntaxes'] = 1
call SetSyntax('markdown') call SetSyntax('markdown')
@ -269,9 +252,6 @@ Execute (Assert Code syntax):
AssertEqual SyntaxAt(24, 1), 'vimLineComment' AssertEqual SyntaxAt(24, 1), 'vimLineComment'
AssertEqual SyntaxAt(25, 1), 'vimCommand' AssertEqual SyntaxAt(25, 1), 'vimCommand'
AssertEqual SyntaxAt(26, 1), 'VimwikiPre' AssertEqual SyntaxAt(26, 1), 'VimwikiPre'
AssertEqual SyntaxAt(30, 1), 'VimwikiIndentedCodeBlock'
AssertEqual SyntaxAt(35, 1), ''
AssertEqual SyntaxAt(40, 1), 'VimwikiIndentedCodeBlock'
# 11 Math {{{1 # 11 Math {{{1