<script lang="ts">
	interface Props {
		// raw markdown source, used as a fallback when rendering was skipped
		body: string;
		// sanitised html from $lib/markup, or null if the body was empty/too large
		bodyHtml: string | null;
	}

	let { body, bodyHtml }: Props = $props();
</script>

{#if bodyHtml}
	<!-- eslint-disable-next-line svelte/no-at-html-tags -- sanitised in $lib/markup -->
	<article class="markup mt-4">{@html bodyHtml}</article>
{:else if body}
	<article class="mt-4 whitespace-pre-wrap text-foreground-default">{body}</article>
{/if}
