From 49c1e9d1fc3d6bf8748756a8543d8c1b7287940f Mon Sep 17 00:00:00 2001 From: moxie Date: Sun, 15 Mar 2026 06:41:37 +0200 Subject: refactor: move template/mkdir features to user-configured autocmds - Remove auto-mkdir autocmd from init.lua (now user-configured) - Remove template system entirely (now user-configured) - Rename io.lua -> utils.lua - Inline single-use functions (handle_web_link, handle_file_link, etc.) - Remove security warnings for external files - Remove unused config options: use_template, template, date_fmt - Simplify utils.resolve() without wiki root validation - Update all documentation examples BREAKING CHANGE: Users must now add their own autocmds for: - Auto-creating directories on save (BufWritePre) - Applying templates to new files (BufNewFile) See README.md for updated configuration examples. --- lua/muwiki/paths.lua | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'lua/muwiki/paths.lua') diff --git a/lua/muwiki/paths.lua b/lua/muwiki/paths.lua index f679888..c2f8fdb 100644 --- a/lua/muwiki/paths.lua +++ b/lua/muwiki/paths.lua @@ -26,26 +26,6 @@ function M.strip_file_protocol(url) return url:gsub('^file://', '') end -function M.is_within_wiki(filepath, wiki_root) - local real_path = vim.fn.resolve(filepath) - local real_root = vim.fn.resolve(wiki_root) - - local normalized_path = vim.fs.normalize(real_path) - local normalized_root = vim.fs.normalize(real_root) - - return vim.startswith(normalized_path, normalized_root) -end - -function M.validate_within_wiki(resolved_path, wiki_root, original_path) - if not M.is_within_wiki(resolved_path, wiki_root) then - vim.notify( - string.format('Warning: Resolved path outside wiki root: %s', original_path), - vim.log.levels.WARN - ) - end - return resolved_path -end - local ALLOWED_SCHEMES = { http = true, https = true, -- cgit v1.2.3