astro/packages/astro-prism/Prism.astro

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

15 lines
399 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-06 04:39:26 +00:00
const { classLanguage, html } = runHighlighterWithAstro(lang, code);
---
<pre class={[className, classLanguage].filter(Boolean).join(' ')}><code class={classLanguage} set:html={html} /></pre>