vimwiki

Personal wiki for vim
git clone https://github.com/vimwiki/vimwiki.git
Log | Files | Refs | README | LICENSE

commit 8374bcfccfba980839cf1c743eaaec68e960e56b
parent cde5dbc92a9df4524691b779f5242d26b28776c7
Author: Tinmarino <tinmarino@gmail.com>
Date:   Fri, 17 Mar 2023 03:46:56 -0300

Feature: Support for <mark> in Markdown (issue #1261)

Diffstat:
Mautoload/vimwiki/u.vim | 3++-
Msyntax/vimwiki.vim | 9+++++++++
Atest/issue_1261_mark_tag.vader | 35+++++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/autoload/vimwiki/u.vim b/autoload/vimwiki/u.vim @@ -359,7 +359,8 @@ endfunction function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort " Helper: Create highlight region between two tags - " :param: tag <string> example '<b>' + " :param: tag_pre <string>: opening tag example '<b>' + " :param: tag_post <string>: closing tag example '</b>' " :param: syntax_group <string> example: VimwikiBold " :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag " :param: (1) <boolean> is contained diff --git a/syntax/vimwiki.vim b/syntax/vimwiki.vim @@ -328,6 +328,13 @@ for [color_key, color_value] in items(color_dic) execute cmd endfor +" Html mark tag, feature request in issue #1261 +let cmd = 'syntax region VimwikiMarkTag matchgroup=VimwikiDelimiterColor' + \ . ' start=/<mark>/' + \ . ' end=+</mark>+' + \ . ' ' . b:vimwiki_syntax_concealends +execute cmd + " Comment: home made execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('comment_regex'). @@ -417,6 +424,8 @@ hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline hi def link VimwikiCode PreProc hi def link VimwikiCodeT VimwikiCode +" Mark +hi def VimwikiMarkTag term=bold ctermbg=yellow ctermfg=black guibg=yellow guifg=black hi def link VimwikiPre PreProc hi def link VimwikiPreT VimwikiPre hi def link VimwikiPreDelim VimwikiPre diff --git a/test/issue_1261_mark_tag.vader b/test/issue_1261_mark_tag.vader @@ -0,0 +1,35 @@ +# Issue: #1261: Feature: Support for <mark> in Markdown + + +Given vimwiki (Single line mark): + <mark>Single line</mark> + 01234567890 + + +Execute (Set syntax markdown): + call SetSyntax('markdown') + + +Execute (Assert all is yaml except after the closing ---): + AssertEqual 'VimwikiMarkTag1', GetSyntaxStack(1, 7)[0] . 1 + AssertEqual '02', len(GetSyntaxStack(2, 7)) . 2 + + +Given vimwiki (Multiple line mark): + <mark>Start + Multiple + Line + end</mark> + 01234567890 + + +Execute (Set syntax markdown): + call SetSyntax('markdown') + + +Execute (Assert all is yaml except after the closing ---): + AssertEqual 'VimwikiMarkTag1', GetSyntaxStack(1, 7)[0] . 1 + AssertEqual 'VimwikiMarkTag2', GetSyntaxStack(2, 2)[0] . 2 + AssertEqual 'VimwikiMarkTag3', GetSyntaxStack(3, 2)[0] . 3 + AssertEqual 'VimwikiMarkTag4', GetSyntaxStack(4, 2)[0] . 4 + AssertEqual '05', len(GetSyntaxStack(5, 7)) . 5