kjelsrud.dev/node_modules/remark-smartypants
2023-07-19 21:31:30 +02:00
..
index.d.ts 🎉 initiate project *astro_rewrite* 2023-07-19 21:31:30 +02:00
index.js 🎉 initiate project *astro_rewrite* 2023-07-19 21:31:30 +02:00
license 🎉 initiate project *astro_rewrite* 2023-07-19 21:31:30 +02:00
package.json 🎉 initiate project *astro_rewrite* 2023-07-19 21:31:30 +02:00
readme.md 🎉 initiate project *astro_rewrite* 2023-07-19 21:31:30 +02:00

remark-smartypants

remark plugin to implement SmartyPants. Now with 100% more ESM!

npm install remark-smartypants
import remark from 'remark'
import smartypants from 'remakr-smartypants'

const result = await remark()
  .use(smartypants)
  .process('# <<Hello World!>>')

console.log(String(result))
// # «Hello World!»

I created this plugin because I wanted to add SmartyPants to MDX:

import mdx from '@mdx-js/mdx'
import smartypants from 'remark-smartypants'

const result = await mdx('# <<Hello World!>>', {
  remarkPlugins: [
    smartypants,
  ],
})

This plugin uses retext-smartypants under the hood, so it takes the same options:

const result = await remark()
  .use(smartypants, { dashes: 'oldschool' })
  .process('en dash (--), em dash (---)')