blob: ce83e606408782261c1fc54cc84959d302b14c6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
---
import { Marked } from 'marked';
import markedShiki from 'marked-shiki';
import { highlighterPromise } from '../utils/highlighter';
interface Props {
content: string;
class?: string;
}
const { content, class: className } = Astro.props;
const highlighter = await highlighterPromise;
const html = await new Marked()
.use(
markedShiki({
highlight(code, lang, props) {
return highlighter.codeToHtml(code, {
lang,
theme: 'min-dark'
});
}
})
)
.parse(content);
---
<div class:list={['markdown', className]} set:html={html} />
|