外观
render_markdown
约 181 字小于 1 分钟
2025-08-01
@candriajs/git-neko-kit / render_markdown
函数: render_markdown()
render_markdown(
md
):Promise
<string
>
渲染 markdown 内容为 HTML
参数
md
string
要渲染的 markdown 字符串
返回
Promise
<string
>
渲染后的 HTML 字符串
Description
使用配置好的 markdown-it 实例渲染 markdown 内容
示例
const html = await render_markdown(`# 标题
- 无序列表项1
- 无序列表项2
- 子列表项
1. 有序列表项1
2. 有序列表项2
`);
-> <h1>标题</h1>
<ul style="list-style: none;">
<li>无序列表项1</li>
<li>无序列表项2</li>
<ul style="list-style: none;">
<li>子列表项</li>
</ul>
</ul>
<ol style="list-style: none;">
<li>有序列表项1</li>
<li>有序列表项2</li>
</ol>