mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
18 lines
408 B
Text
18 lines
408 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].join(
|
|
' '
|
|
)}> <code class={classLanguage}><Fragment set:html={html} /></code>
|
|
</pre>
|