--- import { replacePlaceholdersInHtml } from '@libs/placeholder' import { Prism } from '@astrojs/prism' interface Props { /** * Defines if extra JS snippet should be added to StackBlitz or not. * @default false */ addStackblitzJs?: boolean /** * The example code. * If an array is passed, elements will be joined with a new line. */ code: string | string[] /** * The CSS class(es) to be added to the preview wrapping `div` element. */ class?: string /** * The preview wrapping `div` element ID. */ id?: string /** * Language used to display the code. * @default 'html' */ lang?: string /** * Defines if the markup should be visible or not. * @default true */ showMarkup?: boolean /** * Defines if the preview should be visible or not. * @default true */ showPreview?: boolean } const { addStackblitzJs = false, code, class: className, id, lang = 'html', showMarkup = true, showPreview = true } = Astro.props let markup = Array.isArray(code) ? code.join('\n') : code markup = replacePlaceholdersInHtml(markup) const simplifiedMarkup = markup .replace( //g, (match, classes) => `...` ) .replace( //g, (match, classes) => `...` ) ---
{ showPreview && (
) } { showMarkup && ( <> {showPreview && (
{lang}
)}
) }