Feature: Markdown: Support SetExt Heading (Issue #209)

Like these
==========

See: https://spec.commonmark.org/0.29/#setext-headings

Note: work for follow_link and VimwikiTOC
This commit is contained in:
Tinmarino
2020-08-04 00:44:01 -04:00
parent 40f02293bf
commit fc056cfeca
8 changed files with 202 additions and 26 deletions

View File

@ -186,6 +186,18 @@ for s:i in range(1,6)
\ '/me=s-1 transparent fold'
endfor
" SetExt header
" TODO mutualise SetExt Regexp
let setex_header1_re = '^\s\{0,3}[^>].*\n\s\{0,3}==\+$'
let setex_header2_re = '^\s\{0,3}[^>].*\n\s\{0,3}--\+$'
execute 'syntax match VimwikiHeader1'
\ . ' /'. setex_header1_re . '/ '
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,@Spell'
execute 'syntax match VimwikiHeader2'
\ . ' /'. setex_header2_re . '/ ' .
\ 'contains=VimwikiTodo,VimwikiHeaderChar,VimwikiNoExistsLink,VimwikiCode,'.
\ 'VimwikiLink,@Spell'
let s:options = ' contained transparent contains=NONE'

View File

@ -63,8 +63,25 @@ let s:markdown_syntax.rxMultilineCommentEnd = ''
let s:markdown_syntax.rxComment = '^\s*%%.*$\|<!--[^>]*-->'
let s:markdown_syntax.rxTags = '\%(^\|\s\)\@<=:\%([^:[:space:]]\+:\)\+\%(\s\|$\)\@='
let s:markdown_syntax.header_search = '^\s*\(#\{1,6}\)\([^#].*\)$'
let s:markdown_syntax.header_match = '^\s*\(#\{1,6}\)#\@!\s*__Header__\s*$'
" Used in code (base.vim)
"""""""""""""""""""""""""
" Header
" TODO mutualise with rxHeader in vars.vim := Define atx_regex only onces
" TODO regex_or function => (1|2)
let atx_header_search = '^\s*\(#\{1,6}\)\([^#].*\)$'
let atx_header_match = '^\s*\(#\{1,6}\)#\@!\s*__Header__\s*$'
let setex_header_search = '^\s\{0,3}\zs[^>].*\ze\n'
let setex_header_search .= '^\s\{0,3}[=-]\{2,}$'
let setex_header_match = '^\s\{0,3}>\@!__Header__\n'
let setex_header_match .= '^\s\{0,3}[=-][=-]\+$'
let s:markdown_syntax.header_search = '\%(' . atx_header_search . '\|' . setex_header_search . '\)'
let s:markdown_syntax.header_match = '\%(' . atx_header_match . '\|' . setex_header_match . '\)'
let s:markdown_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs'.
\ '\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
let s:markdown_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'.