Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/silvenon/remark-smartypants
remark plugin to implement SmartyPants
https://github.com/silvenon/remark-smartypants
mdx remark smartypants
Last synced: 3 days ago
JSON representation
remark plugin to implement SmartyPants
- Host: GitHub
- URL: https://github.com/silvenon/remark-smartypants
- Owner: silvenon
- License: mit
- Created: 2020-01-13T18:54:21.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T20:56:10.000Z (5 months ago)
- Last Synced: 2024-04-15T22:40:50.365Z (5 months ago)
- Topics: mdx, remark, smartypants
- Language: TypeScript
- Homepage:
- Size: 934 KB
- Stars: 49
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# remark-smartypants
[![package version](https://badgen.net/npm/v/remark-smartypants)][npm]
[![number of downloads](https://badgen.net/npm/dt/remark-smartypants)][npm][remark] plugin to implement [SmartyPants]. Now with 100% more ESM!
## Installing
```sh
# using npm
npm install remark-smartypants# using yarn
yarn add remark-smartypants
```## Usage
Example using [remark]:
```js
import remark from "remark";
import smartypants from "remark-smartypants";const result = await remark().use(smartypants).process("# <>");
console.log(String(result));
// # «Hello World!»
```I created this plugin because I wanted to add SmartyPants to [MDX]:
```js
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](https://github.com/retextjs/retext-smartypants) under the hood, so it takes the same options:
```js
const result = await remark()
.use(smartypants, { dashes: "oldschool" })
.process("en dash (--), em dash (---)");
```## License
[MIT License, Copyright (c) Matija Marohnić](./LICENSE)
[npm]: https://www.npmjs.com/package/remark-smartypants
[remark]: https://remark.js.org
[SmartyPants]: https://daringfireball.net/projects/smartypants
[MDX]: https://mdxjs.com