diff --git a/autoload/vimwiki/u.vim b/autoload/vimwiki/u.vim index 1ef7011..26e91cd 100644 --- a/autoload/vimwiki/u.vim +++ b/autoload/vimwiki/u.vim @@ -408,6 +408,13 @@ function! vimwiki#u#hi_typeface(dic) abort let nested = vimwiki#u#get_syntax_dic().nested + " Bold Italic + if has_key(a:dic, 'bold_italic') + for bi in a:dic['bold_italic'] + call vimwiki#u#hi_tag(bi[0], bi[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline') + endfor + endif + " Italic for i in a:dic['italic'] " -- Italic 1 @@ -436,13 +443,6 @@ function! vimwiki#u#hi_typeface(dic) abort call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineItalicBold', nested, 2) endfor - " Bold Italic - if has_key(a:dic, 'bold_italic') - for bi in a:dic['bold_italic'] - call vimwiki#u#hi_tag(bi[0], bi[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline') - endfor - endif - " Underline for u in a:dic['underline'] " -- Underline 1 diff --git a/autoload/vimwiki/vars.vim b/autoload/vimwiki/vars.vim index 92d34ae..b658d59 100644 --- a/autoload/vimwiki/vars.vim +++ b/autoload/vimwiki/vars.vim @@ -753,19 +753,19 @@ function! s:get_markdown_syntaxlocal() abort \ 'symH': {'type': type(0), 'default': 0}, \ 'typeface': {'type': type({}), 'default': { \ 'bold': vimwiki#u#hi_expand_regex([ - \ ['\%(\\\@ 1 && a:delim[-2:-2] ==# '\') ? a:delim[-2:-1] : a:delim[-1:] + " Hardcode for markdown + let c_start = '[_*]' + let c_end = '[_*]' + + let rx_mult = a:b_can_mult ? '\+' : '' + + let rx_start = '\%(^\|\%(\\\@... is always preferred to .... +Given vimwiki (Typeface: https://github.github.com/gfm/#example-476): + ***foo*** + 12345678901234 + +Execute (Set Markdown): + call SetSyntax('markdown') + +Execute (Assert Syntax): + CommentLine 'Bold Italic normal, with 3 *' + AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 5) + AssertEqual '', SyntaxAt(2, 1) + + +Given vimwiki (Typeface: https://github.github.com/gfm/#example-477): + _____foo_____ + 12345678901234 + +Execute (Set Markdown): + call SetSyntax('markdown') + +Execute (Assert Syntax): + CommentLine 'Bold Italic with 5 _' + CommentLine 'TODO Passed' +# AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 7) +# AssertEqual '', SyntaxAt(2, 1) + # Rule 15 {{{1 # When two potential emphasis or strong emphasis spans overlap, so that the second begins before the first ends and ends after the first ends, the first takes precedence. Thus, for example, *foo _bar* baz_ is parsed as foo _bar baz_ rather than *foo bar* baz. @@ -835,5 +867,17 @@ Execute (Assert Syntax): # Rule 17 {{{1 # Inline code spans, links, images, and HTML tags group more tightly than emphasis. So, when there is a choice between an interpretation that contains one of these elements and one that does not, the former always wins. Thus, for example, *[foo*](bar) is parsed as *foo* rather than as [foo](bar). +Given vimwiki (Typeface: https://github.github.com/gfm/#example-485): + *a `*` b* + *a `a a*a a` b* + 12345678901234 + +Execute (Set Markdown): + call SetSyntax('markdown') + +Execute (Assert Syntax): + CommentLine 'TODO with a * as unique code, a nice trap' + AssertEqual 0, 0 + # vim: foldmethod=marker foldlevel=30 sw=2