---
import { JSDOM } from 'jsdom'
import Container from './Container.astro'

const language = Astro.props['data-language'] ?? 'text'

const html = await Astro.slots.render('default')

const rawCode = new JSDOM(html).window.document.body.textContent
---

<pre {...Astro.props}><slot /></pre>

{language === 'astro' && <Container set:html={rawCode} />}
