Merge branch 'colorcodes' into 'dev'. Closes PR #616.
This colors all CSS color codes found alone in inline code blocks to the color they mention.
This commit is contained in:
commit
e6d6830db7
@ -344,7 +344,27 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:tag_code(value)
|
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:r = eval("0x".l:str[1:2])
|
||||||
|
let l:g = eval("0x".l:str[3:4])
|
||||||
|
let l:b = eval("0x".l:str[5:6])
|
||||||
|
|
||||||
|
let l:fg_color =
|
||||||
|
\ (((0.299 * r + 0.587 * g + 0.114 * b) / 0xFF) > 0.5)
|
||||||
|
\ ? "black" : "white"
|
||||||
|
|
||||||
|
let l:retstr .=
|
||||||
|
\ " style='background-color:" . l:str .
|
||||||
|
\ ";color:" . l:fg_color . ";'"
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:retstr .= '>'.s:safe_html_preformatted(l:str).'</code>'
|
||||||
|
return l:retstr
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
@ -886,6 +886,12 @@ For Markdown syntax these variations are used: >
|
|||||||
Furthermore, there are a number of words which are highlighted extra flashy:
|
Furthermore, there are a number of words which are highlighted extra flashy:
|
||||||
TODO, DONE, STARTED, FIXME, FIXED, XXX.
|
TODO, DONE, STARTED, FIXME, FIXED, XXX.
|
||||||
|
|
||||||
|
When rendered as HTML, code blocks containing only a hash prefixed 6 digit hex
|
||||||
|
number will be colored as themselves. For example >
|
||||||
|
`#ffe119`
|
||||||
|
Becomes >
|
||||||
|
<code style='background-color:#ffe119;color:black;'>#ffe119</code>
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
5.2. Links *vimwiki-syntax-links*
|
5.2. Links *vimwiki-syntax-links*
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user