Federation progress

This commit is contained in:
Zef Hemel
2023-07-29 23:41:37 +02:00
parent 272bd90ee6
commit fe4887dc78
11 changed files with 112 additions and 49 deletions
+3 -1
View File
@@ -2,11 +2,13 @@ import { editor, system } from "$sb/silverbullet-syscall/mod.ts";
import { asset, store } from "$sb/plugos-syscall/mod.ts";
import { parseMarkdown } from "$sb/silverbullet-syscall/markdown.ts";
import { renderMarkdownToHtml } from "./markdown_render.ts";
import { resolvePath } from "$sb/lib/resolve.ts";
export async function updateMarkdownPreview() {
if (!(await store.get("enableMarkdownPreview"))) {
return;
}
const currentPage = await editor.getCurrentPage();
const text = await editor.getText();
const mdTree = await parseMarkdown(text);
// const cleanMd = await cleanMarkdown(text);
@@ -17,7 +19,7 @@ export async function updateMarkdownPreview() {
annotationPositions: true,
translateUrls: (url) => {
if (!url.includes("://")) {
return decodeURI(url);
url = resolvePath(currentPage, decodeURI(url), true);
}
return url;
},