@x-govuk/govuk-eleventy-plugin
Version:
Write documentation using Markdown and publish it using GOV.UK styles
18 lines (14 loc) • 470 B
JavaScript
import { smartypantsu } from 'smartypants'
import { normalise } from '../utils.js'
/**
* Convert ASCII punctuation characters into ‘smart’ typographic equivalents
*
* @param {string} string - Value to transform
* @returns {string} `string` with smart typographic punctuation
* @example
* smart('Her Majesty\'s Government') // Her Majesty’s Government
*/
export function smart(string) {
string = normalise(string, '')
return smartypantsu(string, 2)
}