smartypants()
Menerapkan penggantian tipografis untuk tanda kutip, dash, dan ellipsis.
import { smartypants } from "@unifast/node";Signature
function smartypants(options?: SmartypantsOptions): UnifastPluginParameter
options?
Konfigurasi penggantian apa saja yang akan diterapkan
| Properti | Tipe | Default | Deskripsi |
|---|---|---|---|
quotes | boolean | true | Mengganti tanda kutip lurus dengan tanda kutip melengkung |
dashes | boolean | true | Mengganti – dengan en-dash dan — dengan em-dash |
ellipses | boolean | true | Mengganti … dengan karakter ellipsis |
Penggunaan
import { compile, smartypants } from "@unifast/node";
const result = compile(md, {
plugins: [
smartypants({
quotes: true,
dashes: true,
ellipses: true,
}),
],
});Contoh
Penggantian tipografis
| Sumber | Hasil |
|---|---|
"Hello" | tanda kutip ganda melengkung |
'Hi' | tanda kutip tunggal melengkung |
-- | en-dash (–) |
--- | em-dash (—) |
... | ellipsis (…) |