12 lines
342 B
TypeScript
12 lines
342 B
TypeScript
|
|
import { Marked } from 'marked';
|
||
|
|
import { createDirectives } from 'marked-directive';
|
||
|
|
|
||
|
|
// 使用 marked-directive 来支持通过 @solidjs/element 添加的 UI 组件
|
||
|
|
const marked = new Marked().use(createDirectives());
|
||
|
|
|
||
|
|
export function parseMarkdown(content: string): string {
|
||
|
|
return marked.parse(content) as string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export { marked };
|