2021-04-01 14:16:29 -05:00
|
|
|
---
|
2022-08-02 14:53:18 -05:00
|
|
|
import { runHighlighterWithAstro } from './dist/highlighter';
|
2021-04-01 14:16:29 -05:00
|
|
|
|
2021-09-01 14:49:01 -05:00
|
|
|
export interface Props {
|
2021-12-22 16:11:05 -05:00
|
|
|
class?: string;
|
|
|
|
lang?: string;
|
|
|
|
code: string;
|
2021-09-01 14:49:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const { class: className, lang, code } = Astro.props as Props;
|
2022-08-02 14:53:18 -05:00
|
|
|
const { classLanguage, html } = runHighlighterWithAstro(lang, code)
|
2021-04-01 14:16:29 -05:00
|
|
|
---
|
|
|
|
|
2022-08-02 14:53:18 -05:00
|
|
|
<pre class={[className, classLanguage].join(' ')}>
|
|
|
|
<code class={classLanguage}><Fragment set:html={html} /></code>
|
|
|
|
</pre>
|