Always use curly quotes

Downloads in past


2022.0.18 years ago8 years agoMinified + gzip package size for typographic-quotes in KB


!NPM versionnpm-imagenpm-url !Build Statustravis-imagetravis-url !Coveralls Statuscoveralls-imagecoveralls-url !Dependency Statusdepstat-imagedepstat-url
Always use curly quotesrtfm

Micro module to help eliminate one of the bad typewriter habitshabits.


npm install --save typographic-quotes


Use typographic quotes for your text with respect to your locale, basically for proper primary and secondary quotes. Pass object with specified locale field as second parameter. locale field is mandatory. This module relies on typographic-quotes-l10n-dbquotesDB in choosing proper quotes for every language.
In American English, double quotes are used normally (the “primary” style). If quote marks are used inside another pair of quote marks, then single quotes are used as the “secondary” style. For example: “Didn't she say ‘I like red best’ when asked her favorite wine?” he wondered to himself.
from the Wikipedia
var quotes = require('typographic-quotes');

// in american english (en-us) primary quotes are “”, and secondary are ‘’.
// in danish (da) primary quotes are »«, and secondary are ›‹.

// `locale` field is mandatory
quotes(`foo 'foo' bar`, { locale: 'en-us' }); // foo “foo” bar
quotes(`foo 'foo' bar`, { locale: 'da' });    // foo »foo« bar
quotes(`foo "foo 'inside' bar" bar`, { locale: 'en-us' }); // foo “foo ‘inside’ bar” bar
quotes(`foo 'foo "inside" bar' bar`, { locale: 'da' });    // foo »foo ›inside‹ bar« bar


If you want to see proper apostrophes too, take a look at apostrophestypographic-apostrophes and apostrophes-for-possessive-pluralstypographic-apostrophes-for-possessive-plurals typographic modules. Use first one before this module, second after: apostrophes → quotes → apostrophes-for-possessive-plurals (order is important). Check complex usage in typography playgroundplayground.


MIT © Vladimir Starkov