feat(config): P3 config batch — group 4 (valid_html_tags, emoji, color_tag_template)
- valid_html_tags: HTML export now passes the allowlisted inline tags through verbatim (b/i/sub/sup/kbd/div/center/strong/em/...) and escapes the rest, via a render-time tag-aware escaper (write_escaped_allowing/match_allowed_tag) — mirroring upstream's s:safe_html_line regex rather than a parser change. `span` is always allowed so colour spans render. - emoji_enable: render-time `:alias:` -> glyph substitution (curated common set), default on; with_emoji builder + substitute_emoji/emoji_for. - color_tag_template: :VimwikiColorize now wraps via a configurable template (g:nuwiki_color_tag_template / setup color_tag_template), splitting on __CONTENT__ with __COLORFG__ -> colour; both clients. Colour spans render in export via the valid_html_tags span passthrough. Default template reproduces the prior `<span style="color:NAME">` output (harness colorize tests green). Renderer gets with_valid_html_tags + with_emoji; export.rs wires both from HtmlConfig. Tests: valid_html_tags passthrough + escape, emoji on/off (html_export.rs). Full rust suite + both harnesses green (Neovim 307, Vim 301/18/21); clippy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1085,8 +1085,14 @@ function! nuwiki#commands#colorize(...) abort
|
||||
if l:color ==# ''
|
||||
return
|
||||
endif
|
||||
let l:open_tag = '<span style="color:' . l:color . '">'
|
||||
let l:close_tag = '</span>'
|
||||
" vimwiki `color_tag_template`: split on __CONTENT__ into open/close, with
|
||||
" __COLORFG__ replaced by the colour. Configurable via g:nuwiki_color_tag_template.
|
||||
let l:tpl = get(g:, 'nuwiki_color_tag_template',
|
||||
\ '<span style="color:__COLORFG__">__CONTENT__</span>')
|
||||
let l:tpl = substitute(l:tpl, '__COLORFG__', l:color, 'g')
|
||||
let l:parts = split(l:tpl, '__CONTENT__', 1)
|
||||
let l:open_tag = get(l:parts, 0, '')
|
||||
let l:close_tag = get(l:parts, 1, '')
|
||||
|
||||
if l:visual
|
||||
let l:sp = getpos("'<")
|
||||
|
||||
Reference in New Issue
Block a user