remark-smartquote
v0.0.1
Published
Context-aware quote plugin for Remark
Downloads
7
Maintainers
Readme
remark-smartquote
This is a remark plugin to make plain quotation marks ('
, "
) content-aware. Inspired by smartquote from typst.
Example
When using remark-smartquote
, given the following markdown:
"I thought it was 'If a body catch a body,'" I said.
...remark will output:
“I thought it was ‘If a body catch a body,’” I said.
Usage
import { remark } from 'remark';
import smartquote from 'remark-smartquote';
const input = `"I thought it was 'If a body catch a body,'" I said.`;
remark()
.use(smartquote)
.process(input, (err, file) => {
if (err) {
console.error(err);
} else {
console.log(String(file));
}
});
Options
options.quotes
Type: [string, string, string, string]
Default: ['‘', '’', '“', '”']
An array of qutoes to use. [opening-single, closing-single, opening-double, closing-double]
remark()
.use(smartquote, { quotes: ['‚', '‘', '„', '“'] })
.process(input, (err, file) => {
if (err) {
console.error(err);
} else {
console.log(String(file));
}
});