Negligible Psychological Misery
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

typographic-em-dash

1.0.11 • Public • Published

typographic-em-dash Build Status Coverage Status

Micro module to fix a common typographic issue that is hard to fix with most keyboard layouts.

This is mainly meant for French typography, it replaces -- by an em dash (en, fr). If the locale is French and we have a pair like — foo —, the first space after the first em dash and the space preceding the second dash will be a narrow no-break space (en, fr).

Submit a PR to src/db.js to add support for your locale.

Install

npm:

npm install --save typographic-em-dash

Usage

var dash = require('typographic-em-dash')
 
dash(`--foo--`, { locale: 'fr' })
// will be replaced by —foo—
dash(`-- foo --`, { locale: 'fr' })
// will be replaced by —NNBSfooNNBs— where NNBS is a narrow no-break space
dash(`--foo--`, { locale: 'en' })
// will be replaced by —foo—
dash(`-- foo --`, { locale: 'en' })
// will be replaced by — foo —

This module can also be used through textr.

License

MIT © Zeste de Savoir

Keywords

install

npm i typographic-em-dash

Downloadsweekly downloads

258

version

1.0.11

license

MIT

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability