Change anchor reference syntax

This commit is contained in:
Zef Hemel
2023-11-03 12:01:33 +01:00
parent 28b0e9f9e9
commit e0b6fbed3e
20 changed files with 47 additions and 31 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ export async function brokenLinksCommand() {
traverseTree(tree, (tree) => {
if (tree.type === "WikiLinkPage") {
// Add the prefix in the link text
const [pageName] = tree.children![0].text!.split("@");
const [pageName] = tree.children![0].text!.split(/[@$]/);
if (pageName.startsWith("!")) {
return true;
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { cacheFileListing } from "../federation/federation.ts";
// Completion
export async function pageComplete(completeEvent: CompleteEvent) {
const match = /\[\[([^\]@:\{}]*)$/.exec(completeEvent.linePrefix);
const match = /\[\[([^\]@$:\{}]*)$/.exec(completeEvent.linePrefix);
if (!match) {
return null;
}
+2 -2
View File
@@ -41,8 +41,8 @@ async function actionClickOrActionEnter(
case "WikiLink": {
let pageLink = mdTree.children![1]!.children![0].text!;
let pos;
if (pageLink.includes("@")) {
[pageLink, pos] = pageLink.split("@");
if (pageLink.includes("@") || pageLink.includes("$")) {
[pageLink, pos] = pageLink.split(/[@$]/);
if (pos.match(/^\d+$/)) {
pos = +pos;
}