---
/**
 * Portable Text HTML block component
 *
 * Renders raw HTML blocks that couldn't be converted to Portable Text.
 * Sanitizes HTML to prevent XSS attacks.
 */
import { sanitizeContent } from "../utils/sanitize.js";

export interface Props {
	node: {
		_type: "htmlBlock";
		_key: string;
		html: string;
	};
}

const { node } = Astro.props;

if (!node?.html) {
	return null;
}

const sanitized = sanitizeContent(node.html);
---

<div class="emdash-html-block" set:html={sanitized} />

<style>
	.emdash-html-block {
		margin: 1.5rem 0;
	}
</style>
