0.0.2 • Published 9 years ago

metalsmith-simple-excerpt v0.0.2

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

metalsmith-simple-excerpt

A Metalsmith Plugin to create excerpts from file contents. Reads the first parts of the content Buffer, creates a subset of words and saves them to the file.

Installation

Install via git:

$ git clone https://github.com/kevingimbel/metalsmith-simple-excerpt node_modules/metalsmith-simple-excerpt

Install with npm

$ npm install metalsmith-simple-excerpt

Usage

Plug the excerpt into your Metalsmith pipeline. Important simpleExcerpt must be called before transforming the markdown files!

var simpleExcerpt = require('metalsmith-simple-excerpt');

var ms = Metalsmith(__dirname);
ms.use(simpleExcerpt({
  size: 50,
  bufferSize: 300,
  encoding: 'utf-8'  
});

Options

NameTypeDefaultDescription
sizeInteger50Count of returned words.
bufferSizeInteger300Buffer length to read from
encodingStringutf-8Desired file Encoding