Socket
Socket
Sign inDemoInstall

retext-smartypants

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retext-smartypants

retext plugin to implement SmartyPants


Version published
Weekly downloads
321K
increased by1.2%
Maintainers
1
Weekly downloads
 
Created

What is retext-smartypants?

The retext-smartypants package is a plugin for the retext ecosystem that transforms plain ASCII punctuation into typographically correct punctuation. It is useful for converting straight quotes to curly quotes, double hyphens to em dashes, and other similar transformations to improve the readability and appearance of text.

What are retext-smartypants's main functionalities?

Convert straight quotes to curly quotes

This feature converts straight quotes (" and ') to their curly counterparts (“ and ’).

const retext = require('retext');
const smartypants = require('retext-smartypants');
const report = require('vfile-reporter');

retext()
  .use(smartypants)
  .process('"Hello, world!" she said.', function (err, file) {
    if (err) throw err;
    console.log(String(file));
    console.error(report(file));
  });

Convert double hyphens to em dashes

This feature converts double hyphens (--) to em dashes (—).

const retext = require('retext');
const smartypants = require('retext-smartypants');
const report = require('vfile-reporter');

retext()
  .use(smartypants)
  .process('This is an example--with an em dash.', function (err, file) {
    if (err) throw err;
    console.log(String(file));
    console.error(report(file));
  });

Convert triple dots to ellipses

This feature converts triple dots (...) to ellipses (…).

const retext = require('retext');
const smartypants = require('retext-smartypants');
const report = require('vfile-reporter');

retext()
  .use(smartypants)
  .process('Wait... what?', function (err, file) {
    if (err) throw err;
    console.log(String(file));
    console.error(report(file));
  });

Other packages similar to retext-smartypants

Keywords

FAQs

Package last updated on 26 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc