Spaces:
Sleeping
Sleeping
File size: 612 Bytes
fc69895 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<script lang="ts">
import type { Token } from "$lib/utils/marked";
import CodeBlock from "../CodeBlock.svelte";
interface Props {
tokens: Token[];
loading?: boolean;
}
let { tokens, loading = false }: Props = $props();
// Derive rendered tokens for memoization
const renderedTokens = $derived(tokens);
</script>
{#each renderedTokens as token}
{#if token.type === "text"}
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html token.html}
{:else if token.type === "code"}
<CodeBlock code={token.code} rawCode={token.rawCode} loading={loading && !token.isClosed} />
{/if}
{/each}
|