Skip to content

Commit 9db8d82

Browse files
committed
Fixes #1850
1 parent 06e4a4c commit 9db8d82

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugs/index/refactor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ async function renamePage(oldName: string, newName: string) {
220220
let newTail = text.substring(link.pos);
221221

222222
// Only relative links need to be updated
223-
if (/^[^/][^\]]+?(?<!]])\)/.test(newTail)) {
223+
if (text.substring(link.pos - 2, link.pos) !== "[[") {
224224
newLink = absoluteToRelativePath(newName, newLink);
225225
newTail = newTail.replace(/^.*?(?=@\d*|#|\$|\))/, newLink);
226226
// Wrap in <> if link has spaces
@@ -448,7 +448,7 @@ async function updateBacklinks(
448448
for (const link of linksInPage) {
449449
let newTail = text.substring(link.pos);
450450
let newLink = newName;
451-
if (/^[^\]]+?(?<!]])\)/.test(newTail)) {
451+
if (text.substring(link.pos - 2, link.pos) !== "[[") {
452452
// Is [Markdown link]()
453453
if (newTail.startsWith("/") || newTail.startsWith("</")) {
454454
// Is absolute mdlink, update with full path with leading /

0 commit comments

Comments
 (0)