Giter Site home page Giter Site logo

metalsmith-hyphenate's Introduction

metalsmith-hyphenate

Build Status Code Climate Greenkeeper badge

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.

Disable hyphenation on specific elements

Hyphenation can be disabled on an element by annotating the element or any of its ancestors with data-hyphenate="false".

<p data-hyphenate="false">There now is your insular city of the Manhattoes, belted round by wharves as Indian isles by coral reefs—commerce surrounds it with her surf.</p>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.