From a22a05d8c34e03e70d726638667467dcb85ef787 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 13 Apr 2024 02:22:46 -0700
Subject: feat(user): markdown biography

---
 src/lib/MarkdownLink.svelte | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 src/lib/MarkdownLink.svelte

(limited to 'src/lib/MarkdownLink.svelte')

diff --git a/src/lib/MarkdownLink.svelte b/src/lib/MarkdownLink.svelte
new file mode 100644
index 00000000..d6fdefe0
--- /dev/null
+++ b/src/lib/MarkdownLink.svelte
@@ -0,0 +1,21 @@
+<script lang="ts">
+	export let href: string;
+	export let text: string;
+
+	try {
+		let url = new URL(href);
+
+		switch (url.protocol) {
+			case 'javascript:':
+				href = '#';
+				break;
+
+			default:
+				break;
+		}
+	} catch (error) {
+		href = '#';
+	}
+</script>
+
+<a {href} target="_blank">{text}</a>
-- 
cgit v1.2.3

