posthtml-richtypo
v1.0.2
Published
PostHTML Richtypo plugin
Downloads
10
Maintainers
Readme
PostHTML Richtypo plugin
Apply typography rules to text into HTML node
Before:
<p data-richtypo>There are 1000 "rules" to enrich your text</p>
After:
<p data-richtypo>There are 1000 «rules» to enrich your text</p>
Install
npm i posthtml posthtml-richtypo
Usage
const fs = require('fs');
const posthtml = require('posthtml');
const richtypoPlugin = require('posthtml-richtypo');
const {
quotes,
sectionSigns,
shortWords,
} = require('richtypo-rules-ru');
posthtml()
.use(richtypoPlugin({
attribute: 'data-typo',
rules: [
quotes,
sectionSigns,
shortWords,
],
}))
.process(html)
.then(result => fs.writeFileSync('./after.html', result.html));
Options
{string} attribute
to change text into
Default: 'data-richtypo'
{array} rules
to apply typography
Default: richtypo-rules-en
Contributing
See PostHTML Guidelines and contribution guide.