mirror of
https://github.com/tpope/vim-markdown.git
synced 2025-11-17 22:33:41 -05:00
Compare commits
7 Commits
860a64a5d7
...
2178b5cc6a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2178b5cc6a | ||
|
|
f9f845f28f | ||
|
|
04701225ad | ||
|
|
b52db95b7c | ||
|
|
1a4686fce8 | ||
|
|
8817c773d7 | ||
|
|
225338e9b7 |
@@ -54,6 +54,18 @@ function! MarkdownFold() abort
|
||||
return ">2"
|
||||
endif
|
||||
|
||||
" Front matter
|
||||
if v:lnum == 1 && line == '---'
|
||||
let b:markdown_frontmatter = 1
|
||||
return ">1"
|
||||
endif
|
||||
|
||||
" End of front matter
|
||||
if (line == '...') && b:markdown_frontmatter
|
||||
unlet b:markdown_frontmatter
|
||||
return '<1'
|
||||
endif
|
||||
|
||||
return "="
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -85,6 +85,10 @@ syn match markdownBlockquote ">\%(\s\|$\)" contained nextgroup=@markdownBlock
|
||||
|
||||
syn region markdownCodeBlock start="^\n\( \{4,}\|\t\)" end="^\ze \{,3}\S.*$" keepend
|
||||
|
||||
syn include @yamlTop syntax/yaml.vim
|
||||
syntax match YAMLFrontMatter /\%^---\_.\{-}\.\.\.$/ contains=@yamlTop
|
||||
unlet! b:current_syntax
|
||||
|
||||
" TODO: real nesting
|
||||
syn match markdownListMarker "\%(\t\| \{0,4\}\)[-*+]\%(\s\+\S\)\@=" contained
|
||||
syn match markdownOrderedListMarker "\%(\t\| \{0,4}\)\<\d\+\.\%(\s\+\S\)\@=" contained
|
||||
@@ -131,8 +135,8 @@ for s:type in g:markdown_fenced_languages
|
||||
if has_key(s:done_include, matchstr(s:type,'[^.]*'))
|
||||
continue
|
||||
endif
|
||||
exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
|
||||
exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=\S\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
|
||||
exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(`\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=[^[:space:]:]\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
|
||||
exe 'syn region markdownHighlight_'.substitute(matchstr(s:type,'[^=]*$'),'\..*','','').' matchgroup=markdownCodeDelimiter start="^\s*\z(\~\{3,\}\)\s*\%({.\{-}\.\)\='.matchstr(s:type,'[^=]*').'}\=[^[:space:]:]\@!.*$" end="^\s*\z1\ze\s*$" keepend contains=@markdownHighlight_'.tr(matchstr(s:type,'[^=]*$'),'.','_') . s:concealends
|
||||
let s:done_include[matchstr(s:type,'[^.]*')] = 1
|
||||
endfor
|
||||
unlet! s:type
|
||||
|
||||
Reference in New Issue
Block a user