From 23aec3e6c79c0d2071fa196ef202ee813bc4bdad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Sun, 31 May 2026 19:06:42 +0000 Subject: [PATCH] feat(config): custom_wiki2html external converter + base_url for RSS (P2) Add three per-wiki HtmlConfig keys mirroring vimwiki globals: - custom_wiki2html / custom_wiki2html_args: when set, export shells out to the external converter via `sh -c` with vimwiki's exact arg order ( , `-` for empty optionals) instead of the built-in renderer. - base_url: when set, diary RSS item + channel links become /.html instead of file:// URIs. write_page() gains a `force` flag threaded through export_current (false), export_all (its own flag) and the did_save auto-export path (false). Tests: write_page_invokes_custom_wiki2html_converter, write_rss_uses_base_url_for_public_links (html_export.rs), config round-trip + defaults (index_and_config.rs). Docs: README, doc/nuwiki.txt, lua config comment, vimwiki-gap.md item ticked. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 6 ++ crates/nuwiki-lsp/src/commands.rs | 111 +++++++++++++++++++- crates/nuwiki-lsp/src/config.rs | 25 +++++ crates/nuwiki-lsp/src/lib.rs | 2 +- crates/nuwiki-lsp/tests/html_export.rs | 60 ++++++++++- crates/nuwiki-lsp/tests/index_and_config.rs | 12 +++ development/vimwiki-gap.md | 18 +++- doc/nuwiki.txt | 10 ++ lua/nuwiki/config.lua | 3 +- 9 files changed, 236 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d83518f..373e454 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,9 @@ require('nuwiki').setup({ template_default = 'default', template_ext = '.tpl', css_name = 'style.css', + custom_wiki2html = '', -- external converter; empty = built-in renderer + custom_wiki2html_args = '', -- extra args appended to the converter call + base_url = '', -- public URL prefix for RSS item links auto_export = false, -- export on save auto_toc = false, -- auto-refresh TOC on save auto_generate_links = false, -- regen Generated Links on save @@ -358,6 +361,9 @@ Each is a boolean. All default to `true` except `mouse`. | `css_name` | string | `'style.css'` | stylesheet filename | | `auto_export` | bool | `false` | `true` \| `false` (export on save) | | `html_filename_parameterization` | bool | `false` | `true` \| `false` | +| `custom_wiki2html` | string | `''` | external converter command; empty = built-in renderer. Called as ` ` (`-` for empty optionals), matching vimwiki | +| `custom_wiki2html_args` | string | `''` | extra args appended to the `custom_wiki2html` call | +| `base_url` | string | `''` | public URL prefix; when set, diary RSS item links become `/.html` instead of `file://` | | `exclude_files` | list | `{}` | glob patterns | | `color_dic` | table | `{}` | `{ name = 'color', … }` | diff --git a/crates/nuwiki-lsp/src/commands.rs b/crates/nuwiki-lsp/src/commands.rs index 9306830..526bd99 100644 --- a/crates/nuwiki-lsp/src/commands.rs +++ b/crates/nuwiki-lsp/src/commands.rs @@ -1143,7 +1143,7 @@ fn export_current( }))); } let name = crate::index::page_name_from_uri(&p.uri, Some(&cfg.root)); - let outcome = match crate::commands::export_ops::write_page(&doc.ast, &name, cfg) { + let outcome = match crate::commands::export_ops::write_page(&doc.ast, &name, cfg, false) { Ok(o) => o, Err(e) => return Err(format!("nuwiki.export.currentToHtml: {e}")), }; @@ -1222,7 +1222,7 @@ fn export_all(backend: &Backend, args: Vec, force: bool) -> Result