Refactor: Syntax highlighting typeface: match -> region: (Issues #847, #640)

- Less code, Easyer to maintain, to add a markup language
- Faster to load, and to highlight
- Support multiline tags: #847
- Support nested tags
- Support intraword tags: this<b>bold</b>type #640
This commit is contained in:
Tinmarino
2020-08-02 03:51:25 -04:00
parent 5408d74b35
commit 1b16720b7b
9 changed files with 248 additions and 210 deletions
+21 -14
View File
@@ -9,24 +9,31 @@
let s:media_syntax = g:vimwiki_syntax_variables['media']
let s:media_syntax.dTypeface = {}
" text: '''strong'''
let s:media_syntax.dTypeface['bold'] = [
\ ['\S\@<=''''''\|''''''\S\@=', '\S\@<=''''''\|''''''\S\@='],
\ ]
" text: ''italic''
let s:media_syntax.dTypeface['italic'] = [
\ ['\S\@<=''''\|''''\S\@=', '\S\@<=''''\|''''\S\@='],
\ ]
" text: no underline defined
let s:media_syntax.dTypeface['underline'] = []
" text: '''''strong italic'''''
let s:media_syntax.dTypeface['bold_italic'] = [
\ ['\S\@<=''''''''''\|''''''''''\S\@=', '\S\@<=''''''''''\|''''''''''\S\@='],
\ ]
" text: $ equation_inline $
let s:media_syntax.rxEqIn = '\$[^$`]\+\$'
let s:media_syntax.char_eqin = '\$'
" text: '''strong'''
let s:media_syntax.rxBold = "'''[^']\\+'''"
let s:media_syntax.char_bold = "'''"
" text: ''emphasis''
let s:media_syntax.rxItalic = "''[^']\\+''"
let s:media_syntax.char_italic = "''"
" text: '''''strong italic'''''
let s:media_syntax.rxBoldItalic = "'''''[^']\\+'''''"
let s:media_syntax.rxItalicBold = s:media_syntax.rxBoldItalic
let s:media_syntax.char_bolditalic = "'''''"
let s:media_syntax.char_italicbold = s:media_syntax.char_bolditalic
" text: `code`
let s:media_syntax.rxCode = '`[^`]\+`'
let s:media_syntax.char_code = '`'