0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/astro-prism/Prism.astro

17 lines
402 B
Text
Raw Normal View History

---
import { runHighlighterWithAstro } from './dist/highlighter';
export interface Props {
2021-12-22 16:11:05 -05:00
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].join(' ')}>
<code class={classLanguage}><Fragment set:html={html} /></code>
</pre>