smartypants()

引用符、ダッシュ、三点リーダーの組版的な置換を適用します。

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

シグネチャ

function smartypants(options?: SmartypantsOptions): UnifastPlugin

パラメータ

options?

適用する置換の設定

プロパティデフォルト説明
quotesbooleantrue直線的な引用符をカーリー引用符に置き換える
dashesbooleantrue– を en ダッシュに、— を em ダッシュに置き換える
ellipsesbooleantrue… を三点リーダー文字に置き換える

使い方

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

const result = compile(md, {
  plugins: [
    smartypants({
      quotes: true,
      dashes: true,
      ellipses: true,
    }),
  ],
});

使用例

組版的な置換

ソース結果
"Hello"カーリーなダブルクォート
'Hi'カーリーなシングルクォート
--en ダッシュ (–)
---em ダッシュ (—)
...三点リーダー (…)