astro/packages/astro-prism/Prism.astro

18 lines
406 B
Text
Raw Permalink Normal View History

---
import { runHighlighterWithAstro } from './dist/highlighter';
export interface Props {
2021-12-22 21:11:05 +00:00
class?: string;
lang?: string;
code: string;
}
const { class: className, lang, code } = Astro.props as Props;
2022-08-06 04:39:26 +00:00
const { classLanguage, html } = runHighlighterWithAstro(lang, code);
---
2022-08-11 16:01:28 +00:00
<pre
class={[className, classLanguage]
.filter(Boolean)
.join(' ')}><code class={classLanguage} set:html={html} /></pre>