diff --git a/webapp/package-lock.json b/webapp/package-lock.json
index 128216b..afd23de 100644
--- a/webapp/package-lock.json
+++ b/webapp/package-lock.json
@@ -9,6 +9,7 @@
"version": "0.0.1",
"dependencies": {
"crypto-js": "^4.1.1",
+ "marked": "^4.0.17",
"svelte-icons": "^2.1.0",
"svelte-markdown": "^0.2.2"
},
@@ -17,6 +18,7 @@
"@sveltejs/kit": "^1.0.0-next.350",
"@tailwindcss/typography": "^0.5.2",
"@types/crypto-js": "^4.1.1",
+ "@types/marked": "^4.0.3",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"autoprefixer": "^10.4.7",
diff --git a/webapp/package.json b/webapp/package.json
index 7d00230..d959866 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -17,6 +17,7 @@
"@sveltejs/kit": "^1.0.0-next.350",
"@tailwindcss/typography": "^0.5.2",
"@types/crypto-js": "^4.1.1",
+ "@types/marked": "^4.0.3",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"autoprefixer": "^10.4.7",
@@ -36,6 +37,7 @@
"type": "module",
"dependencies": {
"crypto-js": "^4.1.1",
+ "marked": "^4.0.17",
"svelte-icons": "^2.1.0",
"svelte-markdown": "^0.2.2"
}
diff --git a/webapp/src/lib/components/MarkdownRenderer.svelte b/webapp/src/lib/components/MarkdownRenderer.svelte
index 93bca72..07bf8fc 100644
--- a/webapp/src/lib/components/MarkdownRenderer.svelte
+++ b/webapp/src/lib/components/MarkdownRenderer.svelte
@@ -1,9 +1,18 @@
-
+
diff --git a/webapp/src/lib/marked/extensions.ts b/webapp/src/lib/marked/extensions.ts
new file mode 100644
index 0000000..8b4738c
--- /dev/null
+++ b/webapp/src/lib/marked/extensions.ts
@@ -0,0 +1,21 @@
+const InternalLinkExtension = {
+ name: 'internal-link',
+ level: 'inline',
+ start(src: string) {
+ return src.match(/^\[\[/)?.index;
+ },
+ tokenizer(src: string) {
+ const match = src.match(/^\[\[([^\n]+?)]\]/);
+ if (match) {
+ console.log(match);
+ return {
+ type: 'internal-link',
+ raw: match[0],
+ text: match[1].trim()
+ };
+ }
+ return false;
+ }
+};
+
+export default [InternalLinkExtension];
diff --git a/webapp/src/lib/renderers/Heading.svelte b/webapp/src/lib/marked/renderers/Heading.svelte
similarity index 96%
rename from webapp/src/lib/renderers/Heading.svelte
rename to webapp/src/lib/marked/renderers/Heading.svelte
index 2b1eb50..48aa600 100644
--- a/webapp/src/lib/renderers/Heading.svelte
+++ b/webapp/src/lib/marked/renderers/Heading.svelte
@@ -3,7 +3,6 @@
// import { } from 'svelte-markdown';
export let depth: number;
export let raw: string;
- export let text: string;
// const { slug, getOptions } = getContext(key);
// const options = getOptions();
diff --git a/webapp/src/lib/marked/renderers/InternalLink.svelte b/webapp/src/lib/marked/renderers/InternalLink.svelte
new file mode 100644
index 0000000..f9caba1
--- /dev/null
+++ b/webapp/src/lib/marked/renderers/InternalLink.svelte
@@ -0,0 +1,9 @@
+
+
+
+ {text}
diff --git a/webapp/src/lib/renderers/List.svelte b/webapp/src/lib/marked/renderers/List.svelte
similarity index 100%
rename from webapp/src/lib/renderers/List.svelte
rename to webapp/src/lib/marked/renderers/List.svelte
diff --git a/webapp/src/lib/marked/tokenizer.ts b/webapp/src/lib/marked/tokenizer.ts
new file mode 100644
index 0000000..4968082
--- /dev/null
+++ b/webapp/src/lib/marked/tokenizer.ts
@@ -0,0 +1,17 @@
+// Override function
+const tokenizer = {
+ // Obsidian [[internal links]]
+ link(src: string) {
+ const match = src.match(/\[\[([^\n]+?)]\]/);
+ if (match) {
+ return {
+ type: 'internal-link',
+ raw: match[0],
+ text: match[1].trim()
+ };
+ }
+ return false;
+ }
+};
+
+export default tokenizer;
diff --git a/webapp/src/routes/note/[id].svelte b/webapp/src/routes/note/[id].svelte
index 3dc1f93..b226ec1 100644
--- a/webapp/src/routes/note/[id].svelte
+++ b/webapp/src/routes/note/[id].svelte
@@ -30,11 +30,8 @@
if (browser) {
// Decrypt note
const key = location.hash.slice(1);
- const start = performance.now();
plaintext = decrypt({ ...note, key });
- console.log(performance.now() - start);
}
- console.log(note.insert_time);
});