ttrpg-tools/src/markdown/index.ts

12 lines
323 B
TypeScript
Raw Normal View History

2026-02-26 00:17:23 +08:00
import { Marked } from 'marked';
import { createDirectives } from 'marked-directive';
2026-02-26 00:47:26 +08:00
// 使用 marked-directive 来支持指令语法
2026-02-26 00:17:23 +08:00
const marked = new Marked().use(createDirectives());
export function parseMarkdown(content: string): string {
2026-02-26 16:35:57 +08:00
return marked.parse(content.trimStart()) as string;
2026-02-26 00:17:23 +08:00
}
export { marked };