summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/markdown.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils/markdown.ts b/src/utils/markdown.ts
new file mode 100644
index 0000000..946d8d8
--- /dev/null
+++ b/src/utils/markdown.ts
@@ -0,0 +1,11 @@
+import { marked } from "marked";
+
+marked.setOptions({
+ breaks: true,
+ gfm: true,
+});
+
+export function markdownToHtml(markdown: string): string {
+ const html = marked.parse(markdown);
+ return typeof html === "string" ? html : "";
+}