astro/packages/astro-prism/Prism.astro
2022-08-11 16:01:28 +00:00

17 lines
406 B
Text

---
import { runHighlighterWithAstro } from './dist/highlighter';
export interface Props {
class?: string;
lang?: string;
code: string;
}
const { class: className, lang, code } = Astro.props as Props;
const { classLanguage, html } = runHighlighterWithAstro(lang, code);
---
<pre
class={[className, classLanguage]
.filter(Boolean)
.join(' ')}><code class={classLanguage} set:html={html} /></pre>