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

This commit is contained in:
Tinmarino
2023-03-17 03:46:56 -03:00
parent cde5dbc92a
commit 8374bcfccf
3 changed files with 46 additions and 1 deletions
+2 -1
View File
@@ -359,7 +359,8 @@ endfunction
function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort
" Helper: Create highlight region between two tags " 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: syntax_group <string> example: VimwikiBold
" :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag " :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag
" :param: (1) <boolean> is contained " :param: (1) <boolean> is contained
+9
View File
@@ -328,6 +328,13 @@ for [color_key, color_value] in items(color_dic)
execute cmd execute cmd
endfor 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 " Comment: home made
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('comment_regex'). 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 VimwikiCode PreProc
hi def link VimwikiCodeT VimwikiCode 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 VimwikiPre PreProc
hi def link VimwikiPreT VimwikiPre hi def link VimwikiPreT VimwikiPre
hi def link VimwikiPreDelim VimwikiPre hi def link VimwikiPreDelim VimwikiPre
+35
View File
@@ -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