Skip to content

Commit

Permalink
fix: escape parens in heading backling search
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas committed Jun 5, 2024
1 parent 7bbd96f commit cacc934
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/telescope/_extensions/neorg/backlinks/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ M.build_backlink_regex = function(workspace_path, current_file, heading)
end
local heading_text = heading:gsub("^%** ", "")
heading_text = heading_text:gsub("^%(.%)%s?", "")
heading_text = heading_text:gsub("%(", "\\(")
heading_text = heading_text:gsub("%)", "\\)")
-- TODO: file sep may be `\` on Windows (currently in discussion)
-- use `current_file:regex_string("[/\\]", Path.const.regex_charset.rust)` instead
return ([[\{:\$/%s:(#|%s) %s\}]]):format(current_file, heading_prefix, heading_text) -- {:$/workspace_path:(# heading or ** heading)}
Expand Down

0 comments on commit cacc934

Please sign in to comment.