Skip to content

Commit

Permalink
Make completion and ObsidianFollowLink working for heading in chinese
Browse files Browse the repository at this point in the history
  • Loading branch information
huangshuai committed Aug 9, 2024
1 parent 7466e3f commit 4bea625
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/obsidian/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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-]*"

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4bea625

Please sign in to comment.