commit 21f5069e48d92af17a0b8b805342e956282e19ac parent 1b2643ea1917b2b85de3f79b7464eec6f47eb102 Author: Hugo Hörnquist <hugo@lysator.liu.se> Date: Sat, 26 Jan 2019 10:29:29 +0100 Code-blocks auto-color. Diffstat:
M | autoload/vimwiki/html.vim | | | 12 | +++++++++++- |
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim @@ -344,7 +344,17 @@ endfunction function! s:tag_code(value) - return '<code>'.s:safe_html_preformatted(s:mid(a:value, 1)).'</code>' + let l:retstr = '<code' + + let l:str = s:mid(a:value, 1) + let l:match = match(l:str, '^#[a-fA-F0-9]\{6\}$') + + if l:match != -1 + let l:retstr .= " style='background-color: " . l:str . ";'" + endif + + let l:retstr .= '>'.s:safe_html_preformatted(l:str).'</code>' + return l:retstr endfunction