2021-04-01 19:16:29 +00:00
|
|
|
---
|
2022-08-02 19:53:18 +00:00
|
|
|
import { runHighlighterWithAstro } from './dist/highlighter';
|
2021-04-01 19:16:29 +00:00
|
|
|
|
2021-09-01 19:49:01 +00:00
|
|
|
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);
|
2021-04-01 19:16:29 +00:00
|
|
|
---
|
|
|
|
|
2022-08-06 04:39:26 +00:00
|
|
|
<pre
|
|
|
|
class={[className, classLanguage].join(
|
|
|
|
' '
|
|
|
|
)}> <code class={classLanguage}><Fragment set:html={html} /></code>
|
2022-08-02 19:53:18 +00:00
|
|
|
</pre>
|