function renderIframe(node, options = {}) {
const { width, border } = options;
const iframe = document.createElement('iframe');
iframe.style.width = width || '100%';
iframe.style.border = border || 'none';
iframe.addEventListener('load', async function() {
const doc = iframe.contentWindow.document;
const tailwindScript = doc.createElement('script');
doc.head.append(tailwindScript);
tailwindScript.addEventListener('load', function() {
doc.body.append(node);
iframe.style.height = options?.height || `${doc.body.offsetHeight}px`;
});
tailwindScript.src = 'https://cdn.tailwindcss.com/3.3.3?plugins=forms,typography,aspect-ratio';
});
return iframe;
}