@silvenon/remark-smartypantsdeprecated

remark plugin to implement SmartyPants

Usage no npm install needed!

<script type="module">
  import silvenonRemarkSmartypants from 'https://cdn.skypack.dev/@silvenon/remark-smartypants';
</script>

README

@silvenon/remark-smartypants

remark plugin to implement SmartyPants.

npm install @silvenon/remark-smartypants
const remark = require('remark')
const smartypants = require('@silvenon/remark-smartypants')

const content = remark()
  .use(smartypants)
  .processSync('# "Hello World!"')

console.log(String(content))
// # “Hello World!”
// (notice smart quotes)

"Why?" I hear nobody ask. Because I wanted to implement SmartyPants in MDX:

const mdx = require('@mdx-js/mdx')
const smartypants = require('@silvenon/remark-smartypants')

// let's pretend that support for top-level async/await exists...
const result = await mdx('# "Hello World!"', {
  remarkPlugins: [
    smartypants,
  ],
})

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

const content = remark()
  .use(smartypants, { dashes: 'oldschool' })
  .processSync('en dash (--), em dash (---)')