From 4bea62588b28ade6700577fa016fc4cf549a8cc9 Mon Sep 17 00:00:00 2001 From: huangshuai Date: Fri, 9 Aug 2024 17:48:26 +0800 Subject: [PATCH] Make completion and `ObsidianFollowLink` working for heading in chinese --- lua/obsidian/util.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/obsidian/util.lua b/lua/obsidian/util.lua index 1db3d044e..b0485c8ea 100644 --- a/lua/obsidian/util.lua +++ b/lua/obsidian/util.lua @@ -1125,7 +1125,7 @@ util.get_icon = function(path) end -- We are very loose here because obsidian allows pretty much anything -util.ANCHOR_LINK_PATTERN = "#[%w%d][^#]*" +util.ANCHOR_LINK_PATTERN = "#[%w%d\u{4e00}-\u{9fff}][^#]*" util.BLOCK_PATTERN = "%^[%w%d][%w%d-]*" @@ -1238,7 +1238,7 @@ util.standardize_anchor = function(anchor) -- Replace whitespace with "-". anchor = string.gsub(anchor, "%s", "-") -- Remove every non-alphanumeric character. - anchor = string.gsub(anchor, "[^#%w_-]", "") + anchor = string.gsub(anchor, "[^#%w_-\u{4e00}-\u{9fff}]", "") return anchor end