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,
    }),
  ],
});

範例

表格

任務清單

刪除線與自動連結

註腳