Content-Length: 304119 | pFad | http://github.com/Grawl/posthtml-richtypo

E2 GitHub - Grawl/posthtml-richtypo: Process HTML node text with Richtypo
Skip to content

Grawl/posthtml-richtypo

Repository files navigation

PostHTML Richtypo plugin

NPM Deps Build Coverage Standard Code Style Chat

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&nbsp;enrich your&nbsp;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

Richtypo rules

TODO

  • More flexible replacement for 'attribute' (but PostHTML have nothing like CSS selectors)
  • Allow providing rules by names, like 'ru' or 'fr'
  • Remove richtypo-rules-en from dependencies, use common rules as fallback
  • Fix tests
  • Fix coverage

Contributing

See PostHTML Guidelines and contribution guide.

License MIT

About

Process HTML node text with Richtypo

Topics

Resources

License

Stars

Watchers

Forks









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/Grawl/posthtml-richtypo

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy