0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00
astro/packages/astro-prism/Prism.astro

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
406 B
Text
Raw Normal View History

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