So, we have a Svelte component that uses the svelte-markdown package to render Markdown into readable text on the frontend, which works great until it comes to rendering links. I need to always have the target attribute and cannot figure out how to do this. Their online documentation is minimal. Can anyone offer suggestions?
Here is the relevant code as it stands currently:
<script lang="ts">import SvelteMarkdown from 'svelte-markdown';import LinkComponent from './MDRenderer.svelte';export let response: string = "";let responseEl: HTMLElement;</script><div class="prose max-w-[80%] text-white text-ellipsis overflow-x-hidden mb-8" bind:this={responseEl}><SvelteMarkdown source={response} renderers={{link: LinkComponent}} /></div>
I did try creating a custom component following their online docs with the following code and importing it, but the links were still rendered without the target attribute.
<script>export let href = "";export let title = undefined;</script><a {href} {title} target="_blank"><slot /></a>