fix(parity): close the 2026-06-02 re-audit config/command findings
Implements the remaining fourth-pass findings (gap doc updated):
- list_margin: rework to upstream's buffer-side meaning. Drop the
nuwiki-only HTML em-margin (renderer field/method + render_page_html
param removed) and prepend max(0, list_margin) leading spaces to every
generated bullet in build_toc_text / build_links_text /
build_tag_links_text / diary::build_index_body; headings stay at col 0.
From<RawWiki> derives 0 for markdown wikis when unset. Negatives can't
resolve 'shiftwidth' server-side, so they collapse to zero indent
(documented divergence).
- diary_months: per-wiki Vec<String> (default 12 English names), threaded
into the diary-index month labels; missing/empty slots fall back to the
English name.
- diary_caption_level: widen u8 -> i8 so vimwiki's -1 (min: -1) parses;
build_index_body clamps < 0 to base tree level 0.
- VimwikiRemoveDone: regain upstream's -range. All four defs are now
-bang -range, dispatched via remove_done(bang, range, l1, l2) in both
clients: ! -> whole buffer, explicit range -> new list_remove_done_range
({range:[l1-1,l2-1]}), else current list. Server remove_done_edit gained
an Option<(u32,u32)> range that filters whole-doc victims by start line.
markdown_header_style is deferred: the generators emit vimwiki syntax only
(caption_line never writes markdown headers), so there's no markdown header
to attach the style to. Logged as the "generated-content is vimwiki-only"
intentional divergence pending a later markdown generated-content effort.
Tests: list_margin indent, markdown list_margin-0 default, diary_months
custom + fallback, negative caption_level clamp/parse, ranged remove-done
(server + both keymap harnesses). 553 lsp/core tests pass; clippy clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -46,10 +46,6 @@ pub struct HtmlRenderer {
|
||||
/// names fall through to the default `class="color-<name>"`
|
||||
/// rendering. Matches vimwiki's `color_dic`.
|
||||
colors: HashMap<String, String>,
|
||||
/// vimwiki `list_margin`: left margin (in `em`) applied to the
|
||||
/// outermost list. `-1` (the default) emits no inline style and
|
||||
/// defers to the stylesheet; `>= 0` forces `margin-left:<n>em`.
|
||||
list_margin: i32,
|
||||
/// vimwiki `html_header_numbering`: the heading level at which automatic
|
||||
/// section numbering begins (`0` = off, the default). When `>= 1`, every
|
||||
/// heading at that level or deeper is prefixed with a dotted section
|
||||
@@ -73,7 +69,6 @@ impl HtmlRenderer {
|
||||
template: None,
|
||||
vars: HashMap::new(),
|
||||
colors: HashMap::new(),
|
||||
list_margin: -1,
|
||||
header_numbering: 0,
|
||||
header_numbering_sym: String::new(),
|
||||
}
|
||||
@@ -110,13 +105,6 @@ impl HtmlRenderer {
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the vimwiki `list_margin`. `-1` defers to the stylesheet;
|
||||
/// `>= 0` forces a `margin-left:<n>em` on the outermost list.
|
||||
pub fn with_list_margin(mut self, margin: i32) -> Self {
|
||||
self.list_margin = margin;
|
||||
self
|
||||
}
|
||||
|
||||
/// Supply a `color_dic`: vimwiki colour-tag names mapped to their
|
||||
/// CSS values. A name listed here is rendered as `style="color:V"`;
|
||||
/// missing names fall through to `class="color-<name>"`.
|
||||
@@ -329,16 +317,8 @@ impl HtmlRenderer {
|
||||
}
|
||||
|
||||
fn render_list(&self, n: &ListNode, w: &mut dyn Write) -> io::Result<()> {
|
||||
self.render_list_nested(n, w, true)
|
||||
}
|
||||
|
||||
fn render_list_nested(&self, n: &ListNode, w: &mut dyn Write, top: bool) -> io::Result<()> {
|
||||
let tag = if n.ordered { "ol" } else { "ul" };
|
||||
if top && self.list_margin >= 0 {
|
||||
writeln!(w, "<{tag} style=\"margin-left:{}em\">", self.list_margin)?;
|
||||
} else {
|
||||
writeln!(w, "<{tag}>")?;
|
||||
}
|
||||
writeln!(w, "<{tag}>")?;
|
||||
for item in &n.items {
|
||||
self.render_list_item(item, w)?;
|
||||
}
|
||||
@@ -368,7 +348,7 @@ impl HtmlRenderer {
|
||||
self.render_inlines(&n.children, w)?;
|
||||
if let Some(sublist) = &n.sublist {
|
||||
w.write_all(b"\n")?;
|
||||
self.render_list_nested(sublist, w, false)?;
|
||||
self.render_list(sublist, w)?;
|
||||
}
|
||||
w.write_all(b"</li>\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user