fix(parity): close the 2026-06-02 re-audit config/command findings
CI / cargo fmt --check (push) Successful in 19s
CI / cargo clippy (push) Successful in 37s
CI / cargo test (push) Successful in 29s
CI / editor keymaps (push) Successful in 1m36s

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:
2026-06-02 10:50:38 +00:00
parent 079e7246ac
commit 9441fe918c
19 changed files with 603 additions and 202 deletions
-52
View File
@@ -245,7 +245,6 @@ fn render_page_html_substitutes_title_content_and_extras() {
DiaryDate::from_ymd(2026, 5, 11).unwrap(),
&c.html,
None,
-1,
extras,
)
.unwrap();
@@ -265,7 +264,6 @@ fn render_page_html_uses_metadata_date_when_set() {
DiaryDate::from_ymd(2026, 5, 11).unwrap(),
&c.html,
None,
-1,
HashMap::new(),
)
.unwrap();
@@ -285,7 +283,6 @@ fn render_page_html_numbers_headers_when_enabled() {
DiaryDate::from_ymd(2026, 5, 11).unwrap(),
&c.html,
None,
-1,
HashMap::new(),
)
.unwrap();
@@ -308,7 +305,6 @@ fn render_page_html_numbering_skips_headers_above_start_level() {
DiaryDate::from_ymd(2026, 5, 11).unwrap(),
&c.html,
None,
-1,
HashMap::new(),
)
.unwrap();
@@ -331,7 +327,6 @@ fn render_page_html_no_header_numbering_by_default() {
DiaryDate::from_ymd(2026, 5, 11).unwrap(),
&c.html,
None,
-1,
HashMap::new(),
)
.unwrap();
@@ -350,7 +345,6 @@ fn render_page_html_root_path_for_nested_pages() {
DiaryDate::today_utc(),
&c.html,
None,
-1,
HashMap::new(),
)
.unwrap();
@@ -370,7 +364,6 @@ fn render_page_html_extra_var_overrides_default() {
DiaryDate::today_utc(),
&c.html,
None,
-1,
extras,
)
.unwrap();
@@ -393,7 +386,6 @@ fn render_page_html_substitutes_vimwiki_percent_template() {
DiaryDate::from_ymd(2026, 5, 11).unwrap(),
&c.html,
None,
-1,
HashMap::new(),
)
.unwrap();
@@ -420,7 +412,6 @@ fn render_page_html_strips_wiki_extension_from_links() {
DiaryDate::today_utc(),
&c.html,
Some(".wiki"),
-1,
HashMap::new(),
)
.unwrap();
@@ -430,49 +421,6 @@ fn render_page_html_strips_wiki_extension_from_links() {
assert!(html.contains("href=\"posts/index.html\""), "plain: {html}");
}
#[test]
fn render_page_html_list_margin_only_styles_top_level_list() {
// `list_margin >= 0` forces a `margin-left:<n>em` on the outermost
// list; nested lists and the default of `-1` stay unstyled.
let ast = parse("- a\n - b\n");
let c = cfg("/tmp/x");
let styled = export::render_page_html(
&ast,
Some("{{content}}".into()),
"index",
DiaryDate::today_utc(),
&c.html,
None,
2,
HashMap::new(),
)
.unwrap();
assert!(
styled.contains("<ul style=\"margin-left:2em\">"),
"top-level margin: {styled}"
);
// Exactly one styled list — the nested `<ul>` is plain.
assert_eq!(
styled.matches("margin-left").count(),
1,
"only top: {styled}"
);
let plain = export::render_page_html(
&ast,
Some("{{content}}".into()),
"index",
DiaryDate::today_utc(),
&c.html,
None,
-1,
HashMap::new(),
)
.unwrap();
assert!(!plain.contains("margin-left"), "default unstyled: {plain}");
}
// ===== fallback_template + DEFAULT_CSS =====
#[test]