Skip to content
Snippets Groups Projects
Commit bc8e55a0 authored by William Faircloth's avatar William Faircloth
Browse files

fix markdown

parent 7083a449
No related branches found
No related tags found
1 merge request!2fix markdown
Pipeline #6092 failed
......@@ -14,17 +14,6 @@
import { marked } from 'marked';
import { afterUpdate } from 'svelte';
const convertLinksToMarkdown = (text: string) => {
return text.replace(/\bhttps?:\/\/[^\s]+/g, (url: string) => {
try {
const validUrl = new URL(url);
return `[${validUrl.hostname}](${validUrl.href})`;
} catch {
return url; // Return as-is if invalid URL
}
});
};
afterUpdate(() => {
window.scrollTo({
top: document.body.scrollHeight,
......@@ -112,7 +101,7 @@
</div>
<div class="answer">
<h3>Archibald</h3>
<div class="bubble">{@html fixURLs(marked.parse(convertLinksToMarkdown(context.response)))}</div>
<div class="bubble">{@html marked.parse(context.response)}</div>
</div>
{/each}
{/if}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment