feat(config): P3 config batch — group 1 (clean config + plumbing)

Config plumbing for the whole config batch (HtmlConfig + WikiConfig fields,
RawWiki deserialization, From/defaults) plus these behaviors:

- rss_name / rss_max_items: HtmlConfig fields (wired into write_rss in the RSS
  group).
- toc_link_format: build_toc_text emits [[#anchor]] (no description) for 1,
  [[#anchor|title]] for 0.
- generated_links_caption: build_links_text emits [[page|FirstHeading]] from a
  page->heading map (ops::page_captions) when enabled.
- table_reduce_last_col: column_widths clamps the last column to width 1 when
  set; threaded through table_align_edit/table_move_column_edit + commands.
- color_dic now ships a populated default palette (red/green/blue/...).
- commentstring aligned to upstream's no-space `%%%s`.
- auto_chdir (default off): :lcd into the owning wiki root on buffer enter;
  both clients (ftplugin.lua setup_auto_chdir + Vim NuwikiAutoChdir augroup),
  with config.wiki_root_for / nuwiki#commands#wiki_root_for resolvers.

Also seeded HtmlConfig fields for later groups (valid_html_tags,
list/text_ignore_newline, emoji_enable, user_htmls, color_tag_template) and
WikiConfig (create_link, dir_link, bullet_types, cycle_bullets).

Tests: toc_link_format, generated_links_caption, table_reduce_last_col,
config defaults + JSON round-trip for every new key. Full rust suite +
both keymap harnesses green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 12:04:36 +00:00
parent 03005d0931
commit b2f2fc88bd
11 changed files with 522 additions and 48 deletions
+10 -2
View File
@@ -628,6 +628,7 @@ impl LanguageServer for Backend {
&wiki.config.toc_header,
wiki.config.toc_header_level,
wiki.config.list_margin.max(0) as usize,
wiki.config.toc_link_format,
)
})
};
@@ -642,11 +643,17 @@ impl LanguageServer for Backend {
if wiki.config.auto_generate_links {
let edit = self.documents.get(&uri).and_then(|doc| {
let current = index::page_name_from_uri(&uri, Some(&wiki.config.root));
let pages = wiki
let (pages, captions) = wiki
.index
.read()
.ok()
.map(|i| i.page_names())
.map(|i| {
let caps = wiki
.config
.generated_links_caption
.then(|| commands::ops::page_captions(&i));
(i.page_names(), caps)
})
.unwrap_or_default();
commands::ops::links_rebuild_edit(
&doc.text,
@@ -658,6 +665,7 @@ impl LanguageServer for Backend {
&wiki.config.links_header,
wiki.config.links_header_level,
wiki.config.list_margin.max(0) as usize,
captions.as_ref(),
)
});
if let Some(edit) = edit {