gfm()

创建 GFM 插件,启用 GitHub Flavored Markdown 扩展。

import { gfm } from "@unifast/node";

签名

function gfm(options?: GfmPluginOptions): UnifastPlugin

参数

options?

各项 GFM 特性的配置

属性类型默认值描述
tablesbooleantrue启用以 | 为语法的管道表格
taskListbooleantrue启用 - [x] / - [ ] 任务列表复选框
strikethroughbooleantrue启用 deleted 删除线语法
footnotesbooleantrue启用 1 脚注引用与定义
autolinkbooleantrue自动将裸 URL 转换为链接

用法

import { compile, gfm } from "@unifast/node";

const result = compile(md, {
  plugins: [
    gfm({
      tables: true,
      taskList: true,
      strikethrough: true,
      footnotes: true,
      autolink: true,
    }),
  ],
});

示例

表格

任务列表

删除线与自动链接

脚注