Skip to content

silvenon/remark-smartypants

Folders and files

NameName
Last commit message
Last commit date
Dec 31, 2023
Apr 15, 2024
Nov 15, 2023
Apr 15, 2024
Apr 15, 2024
Jan 13, 2020
Sep 24, 2024
Jul 8, 2024
Jul 8, 2024
Jul 7, 2024
Nov 15, 2023
Apr 15, 2024
Apr 15, 2024
Apr 17, 2024
Apr 15, 2024

Repository files navigation

remark-smartypants

package version number of downloads

remark plugin to implement SmartyPants. Now with 100% more ESM!

Installing

# using npm
npm install remark-smartypants

# using yarn
yarn add remark-smartypants

Usage

Example using remark:

import remark from "remark";
import smartypants from "remark-smartypants";

const result = await remark().use(smartypants).process("# <<Hello World!>>");

console.log(String(result));
// # «Hello World!»

I created this plugin because I wanted to add SmartyPants to MDX:

import mdx from "@mdx-js/mdx";
import smartypants from "remark-smartypants";

const result = await mdx("# ---Hello World!---", {
  remarkPlugins: [smartypants],
});

Note that angle quotes in the former example (<<...>>) are probably impossible in MDX because there they are invalid syntax.

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

const result = await remark()
  .use(smartypants, { dashes: "oldschool" })
  .process("en dash (--), em dash (---)");

License

MIT License, Copyright (c) Matija Marohnić