2018-04-20 07:03:53 +02:00
|
|
|
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
2012-06-07 02:00:00 +02:00
|
|
|
" Vimwiki syntax file
|
2015-02-23 12:10:42 +01:00
|
|
|
" Home: https://github.com/vimwiki/vimwiki/
|
2020-08-04 00:45:46 +02:00
|
|
|
" Description: Defines markdown syntax
|
|
|
|
" Called: vars.vim => Many other (common) variables are defined there
|
|
|
|
" More in u.vim, base.vim (nested_syntax for multiline code)
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax = g:vimwiki_syntax_variables['markdown']
|
|
|
|
|
2020-08-02 09:51:25 +02:00
|
|
|
|
|
|
|
" TODO mutualise
|
|
|
|
" Get config: possibly concealed chars
|
|
|
|
let b:vimwiki_syntax_conceal = exists('+conceallevel') ? ' conceal' : ''
|
|
|
|
let b:vimwiki_syntax_concealends = has('conceal') ? ' concealends' : ''
|
|
|
|
|
|
|
|
|
|
|
|
" text: **bold** or __bold__
|
2020-08-04 04:16:50 +02:00
|
|
|
let s:markdown_syntax.dTypeface.bold = vimwiki#u#hi_expand_regex([
|
2020-08-04 00:45:46 +02:00
|
|
|
\ ['__', '__'], ['\*\*', '\*\*']])
|
2020-08-02 09:51:25 +02:00
|
|
|
|
|
|
|
" text: *italic* or _italic_
|
2020-08-04 04:16:50 +02:00
|
|
|
let s:markdown_syntax.dTypeface.italic = vimwiki#u#hi_expand_regex([
|
2020-08-04 00:45:46 +02:00
|
|
|
\ ['\*', '\*'], ['_', '_']])
|
2020-08-02 09:51:25 +02:00
|
|
|
|
|
|
|
" text: no underline defined
|
2020-08-04 04:16:50 +02:00
|
|
|
let s:markdown_syntax.dTypeface.underline = []
|
2020-08-02 09:51:25 +02:00
|
|
|
|
|
|
|
" text: *_bold italic_* or _*italic bold*_ or ___bi___ or ***bi***
|
2020-08-04 04:16:50 +02:00
|
|
|
let s:markdown_syntax.dTypeface.bold_italic = vimwiki#u#hi_expand_regex([
|
2020-08-04 00:45:46 +02:00
|
|
|
\ ['\*_', '_\*'], ['_\*', '\*_'], ['\*\*\*', '\*\*\*'], ['___', '___']])
|
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" generic headers
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.rxH = '#'
|
|
|
|
let s:markdown_syntax.symH = 0
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" <hr>, horizontal rule
|
2019-05-24 05:59:13 +02:00
|
|
|
let s:markdown_syntax.rxHR = '\(^---*$\|^___*$\|^\*\*\**$\)'
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" Tables. Each line starts and ends with '|'; each cell is separated by '|'
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.rxTableSep = '|'
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2013-07-14 18:58:46 +02:00
|
|
|
" Lists
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.recurring_bullets = 0
|
|
|
|
let s:markdown_syntax.number_types = ['1.']
|
|
|
|
let s:markdown_syntax.list_markers = ['-', '*', '+', '1.']
|
|
|
|
let s:markdown_syntax.rxListDefine = '::\%(\s\|$\)'
|
2020-06-16 19:46:25 +02:00
|
|
|
let s:markdown_syntax.bullet_types = ['*', '-', '+']
|
2013-07-18 07:55:24 +02:00
|
|
|
|
2020-01-03 15:10:02 +01:00
|
|
|
" Preformatted text (code blocks)
|
2020-01-01 18:58:56 +01:00
|
|
|
let s:markdown_syntax.rxPreStart = '\%(`\{3,}\|\~\{3,}\)'
|
|
|
|
let s:markdown_syntax.rxPreEnd = '\%(`\{3,}\|\~\{3,}\)'
|
2020-01-08 14:03:40 +01:00
|
|
|
" TODO see syntax/vimwiki_markdown_custom.vim for more info
|
|
|
|
" let s:markdown_syntax.rxIndentedCodeBlock = '\%(^\n\)\@1<=\%(\%(\s\{4,}\|\t\+\).*\n\)\+'
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" Math block
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.rxMathStart = '\$\$'
|
|
|
|
let s:markdown_syntax.rxMathEnd = '\$\$'
|
|
|
|
|
2020-08-01 07:12:21 +02:00
|
|
|
" NOTE: There is no multi-line comment syntax for Markdown
|
|
|
|
let s:markdown_syntax.rxMultilineCommentStart = ''
|
|
|
|
let s:markdown_syntax.rxMultilineCommentEnd = ''
|
2018-04-01 21:45:15 +02:00
|
|
|
let s:markdown_syntax.rxComment = '^\s*%%.*$\|<!--[^>]*-->'
|
2017-01-07 21:51:15 +01:00
|
|
|
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*$'
|
2018-04-20 07:03:53 +02:00
|
|
|
let s:markdown_syntax.bold_search = '\%(^\|\s\|[[:punct:]]\)\@<=\*\zs'.
|
|
|
|
\ '\%([^*`[:space:]][^*`]*[^*`[:space:]]\|[^*`[:space:]]\)\ze\*\%([[:punct:]]\|\s\|$\)\@='
|
|
|
|
let s:markdown_syntax.bold_match = '\%(^\|\s\|[[:punct:]]\)\@<=\*__Text__\*'.
|
|
|
|
\ '\%([[:punct:]]\|\s\|$\)\@='
|
|
|
|
let s:markdown_syntax.wikilink = '\[\[\zs[^\\\]|]\+\ze\%(|[^\\\]]\+\)\?\]\]'
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.tag_search = '\(^\|\s\)\zs:\([^:''[:space:]]\+:\)\+\ze\(\s\|$\)'
|
2018-04-20 07:03:53 +02:00
|
|
|
let s:markdown_syntax.tag_match = '\(^\|\s\):\([^:''[:space:]]\+:\)*__Tag__:'.
|
|
|
|
\ '\([^:[:space:]]\+:\)*\(\s\|$\)'
|