pull/674/head
Zef Hemel 2024-01-28 13:48:27 +01:00
parent 744badaf81
commit 98194b59b8
2 changed files with 13 additions and 0 deletions

View File

@ -103,14 +103,25 @@ async function renamePage(
// Replace all links found in place following the patterns [[Page]] and [[Page@pos]] as well as [[Page$anchor]] // Replace all links found in place following the patterns [[Page]] and [[Page@pos]] as well as [[Page$anchor]]
const newText = text.replaceAll(`[[${oldName}]]`, () => { const newText = text.replaceAll(`[[${oldName}]]`, () => {
// Plain link format
updatedReferences++; updatedReferences++;
return `[[${newName}]]`; return `[[${newName}]]`;
}).replaceAll(`[[${oldName}|`, () => {
// Aliased link format
updatedReferences++;
return `[[${newName}|`;
}).replaceAll(`[[${oldName}@`, () => { }).replaceAll(`[[${oldName}@`, () => {
// Link with position format
updatedReferences++; updatedReferences++;
return `[[${newName}@`; return `[[${newName}@`;
}).replaceAll(`[[${oldName}$`, () => { }).replaceAll(`[[${oldName}$`, () => {
// Link with anchor format
updatedReferences++; updatedReferences++;
return `[[${newName}$`; return `[[${newName}$`;
}).replaceAll(`[[${oldName}#`, () => {
// Link with header format
updatedReferences++;
return `[[${newName}#`;
}); });
if (text !== newText) { if (text !== newText) {
console.log("Changes made, saving..."); console.log("Changes made, saving...");

View File

@ -17,6 +17,8 @@ _The changes below are not yet released “properly.” To try them out early, c
* Bug fixes: * Bug fixes:
* Improved Ctrl/Cmd-click (to open links in a new window) behavior: now actually follow `@pos` and `$anchor` links. * Improved Ctrl/Cmd-click (to open links in a new window) behavior: now actually follow `@pos` and `$anchor` links.
* Right-clicking links now opens the browser's native context menu again * Right-clicking links now opens the browser's native context menu again
* `tags` in [[Frontmatter]] are now properly indexed again when listed as an array
* Page links with aliases are now properly renamed
* Internal changes: * Internal changes:
* Big refactor: of navigation and browser history, fixed some {[Page: Rename]} bugs along the way * Big refactor: of navigation and browser history, fixed some {[Page: Rename]} bugs along the way
* Plugs now can no longer define their own markdown syntax, migrated all plug-specific syntax into the main parser. This should remove a bunch of editor “flashing” especially during sync. * Plugs now can no longer define their own markdown syntax, migrated all plug-specific syntax into the main parser. This should remove a bunch of editor “flashing” especially during sync.