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 {
|
|
|
|
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);
|
2021-04-01 14:16:29 -05:00
|
|
|
---
|
|
|
|
|
2022-08-05 23:39:26 -05:00
|
|
|
<pre
|
|
|
|
class={[className, classLanguage].join(
|
|
|
|
' '
|
|
|
|
)}> <code class={classLanguage}><Fragment set:html={html} /></code>
|
2022-08-02 14:53:18 -05:00
|
|
|
</pre>
|