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
|
2018-04-20 07:03:53 +02:00
|
|
|
" Description: Defines markdown syntax
|
2015-02-23 12:10:42 +01:00
|
|
|
" Home: https://github.com/vimwiki/vimwiki/
|
2012-06-07 02:00:00 +02:00
|
|
|
|
2018-04-20 07:03:53 +02:00
|
|
|
|
2017-01-07 21:51:15 +01:00
|
|
|
" see the comments in vimwiki_default.vim for some info about this file
|
|
|
|
|
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' : ''
|
|
|
|
|
|
|
|
|
|
|
|
" Typeface:
|
|
|
|
let s:markdown_syntax.dTypeface = {}
|
|
|
|
|
|
|
|
" text: **bold** or __bold__
|
|
|
|
let s:markdown_syntax.dTypeface['bold'] = [
|
|
|
|
\ ['\S\@<=__\|__\S\@=', '\S\@<=__\|__\S\@='],
|
|
|
|
\ ['\S\@<=\*\*\|\*\*\S\@=', '\S\@<=\*\*\|\*\*\S\@='],
|
|
|
|
\ ]
|
|
|
|
|
|
|
|
" text: *italic* or _italic_
|
|
|
|
let s:markdown_syntax.dTypeface['italic'] = [
|
|
|
|
\ ['\S\@<=\*\|\*\S\@=', '\S\@<=\*\|\*\S\@='],
|
|
|
|
\ ['\S\@<=_\|_\S\@=', '\S\@<=_\|_\S\@='],
|
|
|
|
\ ]
|
|
|
|
|
|
|
|
" text: no underline defined
|
|
|
|
let s:markdown_syntax.dTypeface['underline'] = []
|
|
|
|
|
|
|
|
" text: *_bold italic_* or _*italic bold*_ or ___bi___ or ***bi***
|
|
|
|
let s:markdown_syntax.dTypeface['bold_italic'] = [
|
|
|
|
\ ['\S\@<=\*_\|\*_\S\@=', '\S\@<=_\*\|_\*\S\@='],
|
|
|
|
\ ['\S\@<=_\*\|_\*\S\@=', '\S\@<=\*_\|\*_\S\@='],
|
|
|
|
\ ['\S\@<=\*\*\*\|\*\*\*\S\@=', '\S\@<=\*\*\*\|\*\*\*\S\@='],
|
|
|
|
\ ['\S\@<=___\|___\S\@=', '\S\@<=___\|___\S\@='],
|
|
|
|
\ ]
|
|
|
|
|
|
|
|
|
2012-06-07 02:00:00 +02:00
|
|
|
" text: $ equation_inline $
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.rxEqIn = '\$[^$`]\+\$'
|
|
|
|
let s:markdown_syntax.char_eqin = '\$'
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" text: `code`
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.rxCode = '`[^`]\+`'
|
|
|
|
let s:markdown_syntax.char_code = '`'
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" text: ~~deleted text~~
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.rxDelText = '\~\~[^~`]\+\~\~'
|
|
|
|
let s:markdown_syntax.char_deltext = '\~\~'
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" text: ^superscript^
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.rxSuperScript = '\^[^^`]\+\^'
|
|
|
|
let s:markdown_syntax.char_superscript = '^'
|
2012-06-07 02:00:00 +02:00
|
|
|
|
|
|
|
" text: ,,subscript,,
|
2017-01-07 21:51:15 +01:00
|
|
|
let s:markdown_syntax.rxSubScript = ',,[^,`]\+,,'
|
|
|
|
let s:markdown_syntax.char_subscript = ',,'
|
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\|$\)'
|