unified

Project: unifiedjs/unified-engine

Package: unified-engine@9.0.4

  1. Dependents: 19
  2. Engine to process multiple files with unified
  1. unified 174
  2. processor 4
  3. engine 4

unified-engine

Build Coverage Downloads Sponsors Backers Chat

Engine to process multiple files with unified, allowing users to configure from the file system.

Projects

The following projects wrap the engine:

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install unified-engine

Use

The following example processes all files in the current directory with a Markdown extension with remark, allows configuration from .remarkrc and package.json files, ignoring files from .remarkignore files, and more.

import {engine} from 'unified-engine'
import {remark} from 'remark'

engine(
  {
    processor: remark,
    files: ['.'],
    extensions: ['md', 'markdown', 'mkd', 'mkdn', 'mkdown'],
    pluginPrefix: 'remark',
    rcName: '.remarkrc',
    packageField: 'remarkConfig',
    ignoreName: '.remarkignore',
    color: true
  },
  done
)

function done(error) {
  if (error) throw error
}

Contents

API

This package exports the following identifiers: engine. There is no default export.

engine(options, callback)

Process files according to options and call callback when done.

options

function callback(error[, code, context])

Called when processing is complete, either with a fatal error if processing went horribly wrong (probably due to incorrect configuration), or a status code and the processing context.

Parameters

Plugins

doc/plugins.md describes in detail how plugins can add more files to be processed and handle all transformed files.

Configuration

doc/configure.md describes in detail how configuration files work.

Ignoring

doc/ignore.md describes in detail how ignore files work.

Contribute

See contributing.md in unifiedjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer