diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-02-25 21:11:01 -0500 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-02-25 23:10:00 -0500 |
| commit | f1b124a0423cdaf4d8a6bd62a2059722e9afdf2b (patch) | |
| tree | 589ffd527a21b0a1325a2890e356ca250c815aaa /ui/lib/store | |
| parent | fa0f653f141efee3f5a01e1fa696d29140ec12c2 (diff) | |
Split Markdown rendering out into its own JS module.
Diffstat (limited to 'ui/lib/store')
| -rw-r--r-- | ui/lib/store/messages.svelte.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ui/lib/store/messages.svelte.js b/ui/lib/store/messages.svelte.js index dadade6..e6fe7f3 100644 --- a/ui/lib/store/messages.svelte.js +++ b/ui/lib/store/messages.svelte.js @@ -1,6 +1,5 @@ import { DateTime } from 'luxon'; -import { marked } from 'marked'; -import DOMPurify from 'dompurify'; +import * as markdown from '$lib/markdown.js'; const RUN_COALESCE_MAX_INTERVAL = 10 /* min */ * 60 /* sec */ * 1000; /* ms */ @@ -13,7 +12,7 @@ export class Messages { addMessage(channel, id, { at, sender, body }) { let parsedAt = DateTime.fromISO(at); - let renderedBody = DOMPurify.sanitize(marked.parse(body, { breaks: true })); + let renderedBody = markdown.render(body); const message = { id, at: parsedAt, body, renderedBody }; // You might be thinking, can't this be |
