This is a remark plugin to make plain quotation marks ('
, "
) content-aware. Inspired by smartquote from typst.
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.
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));
}
});
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));
}
});