A Metalsmith plugin to hyphenate words.
JavaScript Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.editorconfig
.eslintrc
.gitignore
.npmignore
.travis.yml
LICENSE
Makefile
README.md
index.js
package.json

README.md

metalsmith-hyphenate

Build Status Code Climate Dependency Status

A Metalsmith plugin to hyphenate words. It’s based on Bram Stein’s Hypher hyphenation engine

Installation

$ npm install metalsmith-hyphenate

Usage

The metalsmith-hyphenate work on the HTML files. So, insert this plugin in the pipeline where HTML files are generated; commonly after metalsmith-templates.

CLI

Install via npm and then add the metalsmith-hyphenate to your metalsmith.json.

{
  "plugins": {
    "metalsmith-hyphenate": {
      "elements": ["p", "blockquote"]
    }
  }
}

JavaScript

Pass options to the hyphenate plugin and pass it to Metalsmith with the use method:

var hyphenate = require('metalsmith-hyphenate');

metalsmith.use(hyphenate({
  "elements": ["p", "blockquote"],
  "langModule": "hyphenation.de",
  "ignore": ["archives/*"] // All the files inside 'archive' will not be hyphenated
}));

Options

  • elements - (Array) HTML elements which will be hyphenated. Default is ['p', 'li', 'ol']
  • langModule - (String) Hypher language rules to be used for hyphenation. Default is 'hyphenation.en-us'. You need to install manually — npm install <language-module> – if you are going to use any language rule other than the default.
  • ignore - (Array | String) You can use glob patterns to ignore some files.