Skip to content

Commit

Permalink
Feature: Support for <mark> in Markdown (issue #1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinmarino committed Mar 17, 2023
1 parent cde5dbc commit 8374bcf
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autoload/vimwiki/u.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions syntax/vimwiki.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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').
Expand Down Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions test/issue_1261_mark_tag.vader
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8374bcf

Please sign in to comment.