first commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { linkify, linkHref } from '$lib/format';
|
||||
|
||||
let { text }: { text: string | undefined | null } = $props();
|
||||
const value = $derived(text ?? '');
|
||||
const tokens = $derived(linkify(value));
|
||||
</script>
|
||||
|
||||
{#each tokens as tok, i (i)}
|
||||
{#if tok.kind === 'url'}
|
||||
<a href={linkHref(tok.content)} target="_blank" rel="noreferrer">{tok.content}</a>
|
||||
{:else}
|
||||
{tok.content}
|
||||
{/if}
|
||||
{/each}
|
||||
Reference in New Issue
Block a user