Add markdown syntax support for indented code blocks.
This commit is contained in:
parent
59e1229da6
commit
3ec0c9cd91
@ -3486,6 +3486,7 @@ https://github.com/vimwiki-backup/vimwiki/issues.
|
||||
2.5 (in progress)~
|
||||
|
||||
New:~
|
||||
* 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.
|
||||
|
@ -79,9 +79,10 @@ let s:markdown_syntax.number_types = ['1.']
|
||||
let s:markdown_syntax.list_markers = ['-', '*', '+', '1.']
|
||||
let s:markdown_syntax.rxListDefine = '::\%(\s\|$\)'
|
||||
|
||||
" Preformatted text
|
||||
" 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\)'
|
||||
|
||||
" Math block
|
||||
let s:markdown_syntax.rxMathStart = '\$\$'
|
||||
|
@ -190,7 +190,9 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
||||
\ VimwikiEqInT,
|
||||
\ @Spell
|
||||
|
||||
|
||||
" 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
|
||||
|
||||
" syntax group highlighting
|
||||
hi def link VimwikiImage VimwikiLink
|
||||
|
@ -112,10 +112,10 @@ Execute (Assert Syntax link):
|
||||
Given vimwiki (Markdown Links):
|
||||
Inline link: >
|
||||
[Looks like this](URL)
|
||||
|
||||
|
||||
Image link: >
|
||||
![Looks like this](URL)
|
||||
|
||||
|
||||
Reference-style links: >
|
||||
a) [Link Name][Id]
|
||||
b) [Id][], using the "implicit link name" shortcut
|
||||
@ -201,11 +201,11 @@ Execute (Assert Syntax Code):
|
||||
Given vimwiki (Markdown, Text and Vim):
|
||||
this is markdown
|
||||
this is TODO
|
||||
|
||||
|
||||
```
|
||||
this is text
|
||||
```
|
||||
|
||||
|
||||
```vim
|
||||
" this is vim
|
||||
set hlsearch
|
||||
@ -226,6 +226,23 @@ 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')
|
||||
@ -252,6 +269,9 @@ 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
|
||||
@ -260,14 +280,14 @@ Execute (Assert Code syntax):
|
||||
|
||||
Given vimwiki (Math markdown):
|
||||
math inline: $ \sum_i a_i^2 = 1 $
|
||||
|
||||
|
||||
math block:
|
||||
$$
|
||||
\sum_i a_i^2
|
||||
\sum_i a_i^2
|
||||
=
|
||||
1
|
||||
$$
|
||||
|
||||
|
||||
math block env:
|
||||
$$%align%
|
||||
\sum_i a_i^2 &= 1 + 1 \\
|
||||
@ -290,14 +310,14 @@ Execute (Assert math syntax):
|
||||
|
||||
Given vimwiki (Math wiki):
|
||||
math inline: $ \sum_i a_i^2 = 1 $
|
||||
|
||||
|
||||
math block:
|
||||
{{$
|
||||
\sum_i a_i^2
|
||||
\sum_i a_i^2
|
||||
=
|
||||
1
|
||||
}}$
|
||||
|
||||
|
||||
math block env:
|
||||
{{$%align%
|
||||
\sum_i a_i^2 &= 1 + 1 \\
|
||||
|
Loading…
Reference in New Issue
Block a user