Fixes #1222
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { type ParseTree, traverseTree } from "./tree.ts";
|
||||
|
||||
const builtinPrefixes = [
|
||||
"/tag:",
|
||||
"/search:",
|
||||
"tag:",
|
||||
"search:",
|
||||
];
|
||||
|
||||
// [[Wikilinks]] use absolute paths and should pass pathToResolve with a leading / to this function
|
||||
@@ -26,9 +26,7 @@ export function resolvePath(
|
||||
}
|
||||
|
||||
function strippableSlashPrefix(p: string) {
|
||||
return p.startsWith("/") &&
|
||||
// Don't remove prefix / for built-in prefixes
|
||||
!builtinPrefixes.some((prefix) => p.startsWith(prefix));
|
||||
return p.startsWith("/");
|
||||
}
|
||||
|
||||
export function isLocalPath(path: string): boolean {
|
||||
@@ -97,3 +95,7 @@ export function relativeToAbsolutePath(page: string, linkTo: string): string {
|
||||
|
||||
return [...splitPage, ...splitLink].join("/");
|
||||
}
|
||||
|
||||
export function isBuiltinPath(path: string): boolean {
|
||||
return builtinPrefixes.some((prefix) => path.startsWith(prefix));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@ import { syntaxTree } from "@codemirror/language";
|
||||
import { Decoration } from "@codemirror/view";
|
||||
import type { Client } from "../client.ts";
|
||||
import { decoratorStateField, isCursorInRange, LinkWidget } from "./util.ts";
|
||||
import { resolvePath } from "@silverbulletmd/silverbullet/lib/resolve";
|
||||
import {
|
||||
isBuiltinPath,
|
||||
resolvePath,
|
||||
} from "@silverbulletmd/silverbullet/lib/resolve";
|
||||
import {
|
||||
encodePageURI,
|
||||
encodeRef,
|
||||
@@ -45,7 +48,8 @@ export function cleanWikiLinkPlugin(client: Client) {
|
||||
}
|
||||
if (
|
||||
pageRef.page === "" ||
|
||||
client.plugSpaceRemotePrimitives.isLikelyHandled(pageRef.page)
|
||||
client.plugSpaceRemotePrimitives.isLikelyHandled(pageRef.page) ||
|
||||
isBuiltinPath(pageRef.page)
|
||||
) {
|
||||
// Empty page name with local @anchor use or a link to a page that dynamically generated by a plug
|
||||
fileExists = true;
|
||||
|
||||
Reference in New Issue
Block a user