Massive restructure of plugin API

This commit is contained in:
Zef Hemel
2022-10-14 15:11:33 +02:00
parent 982623fc38
commit 7d28b53b75
70 changed files with 826 additions and 969 deletions
+6 -6
View File
@@ -2,9 +2,9 @@ import type {
FileData,
FileEncoding,
} from "../../common/spaces/space_primitives.ts";
import { renderToText, replaceNodesMatching } from "../../common/tree.ts";
import { renderToText, replaceNodesMatching } from "$sb/lib/tree.ts";
import type { FileMeta } from "../../common/types.ts";
import { parseMarkdown } from "../../syscall/silverbullet-syscall/markdown.ts";
import { parseMarkdown } from "$sb/silverbullet-syscall/markdown.ts";
const pagePrefix = "💭 ";
@@ -55,7 +55,7 @@ async function translateLinksWithPrefix(
text: string,
prefix: string,
): Promise<string> {
let tree = await parseMarkdown(text);
const tree = await parseMarkdown(text);
replaceNodesMatching(tree, (tree) => {
if (tree.type === "WikiLinkPage") {
// Add the prefix in the link text
@@ -67,12 +67,12 @@ async function translateLinksWithPrefix(
return text;
}
export async function getFileMetaCloud(name: string): Promise<FileMeta> {
return {
export function getFileMetaCloud(name: string): Promise<FileMeta> {
return Promise.resolve({
name,
size: 0,
contentType: "text/markdown",
lastModified: 0,
perm: "ro",
};
});
}