0.3.7 • Published 8 years ago

spike-html-standards v0.3.7

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

Spike HTML Standard Plugin Pack

npm tests dependencies coverage

Spike html standards plugin pack for reshape

Note: This project is in early development, and versioning is a little different. Read this for more details.

Installation

npm install spike-html-standards -S

Note: This project is compatible with node v6+ only

Usage

This is nothing more than a light wrapper around a reshape configuration object. Options are filtered into their appropriate plugins internally. All are optional.

const reshape = require('reshape')
const htmlStandards = require('spike-html-standards')

reshape(htmlStandards(/* options */))
  .process(someHtml)
  .then((res) => console.log(res.output()))

By default, the html standard plugin pack includes:

Based on the way they are ordered there are a couple limitations to keep in mind:

  • You cannot use a layout block/extend inside of an include
  • Any expression delimiters rendered from a content or retext transform will be output as plaintext, not as an expression
  • Output from a content transform will be processed by retext in that order

Any of these plugins can be customized by passing options described below.

Options

NameDescriptionDefault
rootRoot path used to resolve layouts and includes
filenameName of the file being compiled, used for error traces and as the include/layout root if not otherwise provided
addDependencyToObject with addDependency method that will get file paths for tracked deps from includes/layouts
webpackShortcut for webpack users to set the root and addDependencyTo options more easily. Pass webpack loader context.
delimitersDelimiters used for html-escaped expressions['{{', '}}']
unescapeDelimitersDelimiters used for unescaped expressions['{{{', '}}}']
markdownOptions passed in to markdown-it constructor{ typographer: true, linkify: true }
contentOptions passed to the reshape-content plugin{ md: renderMarkdown }
parsercustom html parser if desired. pass false to use the default html parsersugarml
retextPlugins to be passed to the reshape-retext plugin[smartypants] (ref)
localsAdded directly to the output object, used when compiling a reshape template to html{}
aliasAlias option to be passed to the include plugin
minifyMinifies the html output by removing excess spaces and line breaksfalse

License & Contributing