Socket
Socket
Sign inDemoInstall

unified

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unified - npm Package Compare versions

Comparing version 2.1.2 to 2.1.4

26

history.md

@@ -1,9 +0,23 @@

<!--mdast setext-->
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings-->
2.1.4 / 2016-01-24
==================
2.1.3 / 2016-01-24
==================
* Add section on `unified-bridges` ([`1adb6ac`](https://github.com/wooorm/unified/commit/1adb6ac))
* Add list of processors ([`2670ade`](https://github.com/wooorm/unified/commit/2670ade))
* Remove support for Component ([`85207f4`](https://github.com/wooorm/unified/commit/85207f4))
* Remove support for Bower ([`3e09ed6`](https://github.com/wooorm/unified/commit/3e09ed6))
* Remove distribution files from source ([`7acb775`](https://github.com/wooorm/unified/commit/7acb775))
* Refactor to replace mocha with tape ([`1533d17`](https://github.com/wooorm/unified/commit/1533d17))
* Refactor `readme.md` ([`f323dfd`](https://github.com/wooorm/unified/commit/f323dfd))
2.1.2 / 2015-10-23
==================
* Refactor browserify system ([c95686d](https://github.com/wooorm/unified/commit/c95686d))
* Refactor browserify system ([`c95686d`](https://github.com/wooorm/unified/commit/c95686d))

@@ -13,3 +27,3 @@ 2.1.1 / 2015-10-14

* Fix component and duo support ([3eacf6a](https://github.com/wooorm/unified/commit/3eacf6a))
* Fix component and duo support ([`3eacf6a`](https://github.com/wooorm/unified/commit/3eacf6a))

@@ -19,4 +33,4 @@ 2.1.0 / 2015-10-10

* Add support for processor data ([e9b9f7e](https://github.com/wooorm/unified/commit/e9b9f7e))
* Add references to `hast` ([d1a1c7e](https://github.com/wooorm/unified/commit/d1a1c7e))
* Add support for processor data ([`e9b9f7e`](https://github.com/wooorm/unified/commit/e9b9f7e))
* Add references to `hast` ([`d1a1c7e`](https://github.com/wooorm/unified/commit/d1a1c7e))

@@ -26,5 +40,5 @@ 2.0.0 / 2015-09-16

* Remove `type` support ([8748cfe](https://github.com/wooorm/unified/commit/8748cfe))
* Remove `type` support ([`8748cfe`](https://github.com/wooorm/unified/commit/8748cfe))
1.0.0 / 2015-07-31
==================

@@ -106,3 +106,4 @@ /**

* the Processor constructor.
* @return {Processor}
* @return {Processor} - Either `context` or a new
* Processor instance.
*/

@@ -109,0 +110,0 @@ function use() {

{
"name": "unified",
"version": "2.1.2",
"version": "2.1.4",
"description": "Text processing framework: Parse / Transform / Compile",

@@ -14,3 +14,3 @@ "license": "MIT",

"retext",
"mdast"
"remark"
],

@@ -32,2 +32,3 @@ "dependencies": {

},
"bugs": "https://github.com/wooorm/unified/issues",
"author": "Titus Wormer <tituswormer@gmail.com>",

@@ -38,32 +39,29 @@ "files": [

"devDependencies": {
"browserify": "^11.0.0",
"browserify": "^13.0.0",
"eslint": "^1.0.0",
"esmangle": "^1.0.0",
"istanbul": "^0.3.0",
"istanbul": "^0.4.0",
"jscs": "^2.0.0",
"jscs-jsdoc": "^1.0.0",
"mdast": "^1.0.0",
"mdast-comment-config": "^1.0.0",
"mdast-github": "^1.0.0",
"mdast-lint": "^1.0.0",
"mdast-man": "^1.0.0",
"mdast-toc": "^1.0.0",
"mdast-validate-links": "^1.0.0",
"mocha": "^2.0.0"
"remark": "^3.0.0",
"remark-comment-config": "^2.0.0",
"remark-github": "^4.0.0",
"remark-lint": "^2.0.0",
"remark-man": "^2.0.0",
"remark-toc": "^2.0.0",
"remark-validate-links": "^2.0.0",
"tape": "^4.4.0"
},
"scripts": {
"test-api": "mocha --check-leaks test.js",
"test-coveralls": "istanbul cover _mocha --report lcovonly -- --check-leaks test.js",
"test-coverage": "istanbul cover _mocha -- -- test.js",
"test-travis": "npm run test-coveralls",
"test": "npm run test-api",
"build-md": "remark . --quiet --frail",
"build-bundle": "browserify index.js -s AttachWare > unified.js",
"build-mangle": "esmangle unified.js > unified.min.js",
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"lint-api": "eslint .",
"lint-style": "jscs --reporter inline .",
"lint": "npm run lint-api && npm run lint-style",
"make": "npm run lint && npm run test-coverage",
"build-md": "mdast . --quiet",
"build-bundle": "browserify index.js -s AttachWare > unified.js",
"postbuild-bundle": "esmangle unified.js > unified.min.js",
"build": "npm run build-md && npm run build-bundle"
"test-api": "node test.js",
"test-coverage": "istanbul cover test.js",
"test": "npm run build && npm run lint && npm run test-coverage"
}
}

@@ -1,2 +0,2 @@

# unified [![Build Status](https://img.shields.io/travis/wooorm/unified.svg)](https://travis-ci.org/wooorm/unified) [![Coverage Status](https://img.shields.io/codecov/c/github/wooorm/unified.svg)](https://codecov.io/github/wooorm/unified)
# unified [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]

@@ -6,9 +6,7 @@ Text processing framework: Parse / Transform / Compile.

This library provides the boilerplate to make parsing and compiling pluggable.
It’s in use by [**mdast**](https://github.com/wooorm/mdast),
[**retext**](https://github.com/wooorm/retext), and
[**hast**](https://github.com/wooorm/hast).
It’s in use by [**remark**][remark], [**retext**][retext], and [**hast**][hast].
## Installation
[npm](https://docs.npmjs.com/cli/install):
[npm][npm-install]:

@@ -19,10 +17,8 @@ ```bash

**unified** is also available for [bower](http://bower.io/#install-packages),
[component](https://github.com/componentjs/component), and [duo](http://duojs.org/#getting-started),
and as an AMD, CommonJS, and globals module, [uncompressed](unified.js) and
[compressed](unified.min.js).
**unified** is also available for [duo][duo-install], and as an AMD,
CommonJS, and globals module, [uncompressed and compressed][releases].
## Usage
From [**mdast**](https://github.com/wooorm/mdast/blob/master/index.js):
From [**remark**][remark-index]:

@@ -43,2 +39,6 @@ ```js

* [List of Processors](#list-of-processors)
* [Bridges](#bridges)
* [API](#api)

@@ -48,3 +48,3 @@

* [Processor([processor])](#processorprocessor)
* [Processor(\[processor\])](#processorprocessor)

@@ -55,17 +55,17 @@ * [processor.Parser](#processorparser)

* [Processor#use(plugin[, input...])](#processoruseplugin-input)
* [Processor#use(plugin\[, input...\])](#processoruseplugin-input)
* [Plugin](#plugin)
* [function attacher(processor[, input...])](#function-attacherprocessor-input)
* [function transformer(node, file[, next])](#function-transformernode-file-next)
* [function attacher(processor\[, input...\])](#function-attacherprocessor-input)
* [function transformer(node, file\[, next\])](#function-transformernode-file-next)
* [Processor#parse(file[, options])](#processorparsefile-options)
* [Processor#parse(file\[, options\])](#processorparsefile-options)
* [Processor#run(node[, file][, done])](#processorrunnode-file-done)
* [Processor#run(node\[, file\]\[, done\])](#processorrunnode-file-done)
* [function done(err, node, file)](#function-doneerr-node-file)
* [Processor#stringify(node[, file][, options])](#processorstringifynode-file-options)
* [Processor#stringify(node\[, file\]\[, options\])](#processorstringifynode-file-options)
* [Processor#process(file[, options][, done])](#processorprocessfile-options-done)
* [Processor#process(file\[, options\]\[, done\])](#processorprocessfile-options-done)

@@ -78,5 +78,25 @@ * [function done(err, doc, file)](#function-doneerr-doc-file)

## List of Processors
* [**remark**][remark]
— Markdown processor powered by plugins.
* [**retext**][retext]
— Extensible system for analysing and manipulating natural language.
* [**hast**][hast]
— HTML processor powered by plugins.
## Bridges
Bridges are a concept which support two-way transformation between processors.
See [**unified-bridge**][unified-bridge] for more information.
* [**remark-retext**][remark-retext]
— Transformation from markdown to natural language (currently
it’s not possible to return to markdown);
## API
### unified(options)
### `unified(options)`

@@ -111,7 +131,7 @@ Create a new `Processor` constructor.

### Processor(\[processor\])
### `Processor([processor])`
> Note that all methods on the instance are also available as functions on the
> constructor, which, when invoked, create a new instance.
>
>
> Thus, invoking `new Processor().process()` is the same as

@@ -131,7 +151,7 @@ > `Processor.process()`.

### processor.Parser
### `processor.Parser`
### processor.Compiler
### `processor.Compiler`
The constructors passed to [`unified`](#unifiedoptions) at `'Parser'`
The constructors passed to [`unified`][unified-options] at `'Parser'`
and `'Compiler'` are stored on `Processor` instances. The `Parser`

@@ -141,9 +161,9 @@ is responsible for parsing a virtual file into a syntax tree, and the

When a processor is constructed, both are passed to [unherit](https://github.com/wooorm/unherit),
which ensures that plug-ins can change how the processor instance parses
and compiles without affecting other processors.
When a processor is constructed, both are passed to [unherit][], which
ensures that plug-ins can change how the processor instance parses and
compiles without affecting other processors.
`Parser`s must have a `parse` method, `Compiler`s a `compile` method.
### Processor#use(plugin\[, input...\])
### `Processor#use(plugin[, input...])`

@@ -159,3 +179,3 @@ Change the way the processor works by using a plugin.

* `plugin` (`Function`) — [Plugin](#plugin).
* `plugin` (`Function`) — [Plugin][].
* `plugins` (`Array.<Function>`) — List of plugins.

@@ -168,3 +188,3 @@ * `input` (`*`) — Passed to plugin. Specified by its documentation.

#### Plugin
#### `Plugin`

@@ -177,19 +197,15 @@ A **uniware** plugin changes the way the applied-on processor works. It does

Both have their own function. The first is called an
[“attacher”](#function-attacherprocessor-input). The second is named a
[“transformer”](#function-transformernode-file-next). An “attacher” may
return a “transformer”.
Both have their own function. The first is called an [“attacher”][attacher].
The second is named a [“transformer”][transformer]. An “attacher” may return
a “transformer”.
#### function attacher([processor](#processorprocessor)\[, input...\])
#### `function attacher(processor[, input...])`
To modify the processor, create an attacher. An attacher is the thing passed to
[`use`](#processoruseplugin-input). It can
receive plugin specific options, but that’s entirely up to the third-party
developer.
[`use`][use]. It can receive plugin specific options, but that’s entirely up to
the third-party developer.
An **attacher** is invoked when the plugin is
[`use`](https://github.com/wooorm/mdast#mdastuseplugin-options)d, and can
return a transformer which will be called on subsequent
[`process()`](#processorprocessfile-options-done)s and
[`run()`](#processorrunnode-file-done)s.
An **attacher** is invoked when the plugin is [`use`][use]d, and can return
a transformer which will be called on subsequent [`process()`][process]s and
[`run()`][run]s.

@@ -202,5 +218,3 @@ **Signatures**

* `processor` (`Processor`) — Context on which the plugin was
[`use`](https://github.com/wooorm/mdast#mdastuseplugin-options)d;
* `processor` (`Processor`) — Context on which the plugin was [`use`][use]d;
* `input` (`*`) — Passed by the user of a plug-in.

@@ -210,11 +224,10 @@

[`transformer`](#function-transformernode-file-next) (optional).
[`transformer`][transformer] (optional).
#### function transformer(node, file\[, next\])
#### `function transformer(node, file[, next])`
To transform a syntax tree, create a transformer. A transformer is a simple
(generator) function which is invoked each time a file is
[`process()`](#processorprocessfile-options-done)s and
[`run()`](#processorrunnode-file-done)s. A transformer should
change the syntax tree representation of a file.
[`process()`][process]s and [`run()`][run]s. A transformer should change
the syntax tree representation of a file.

@@ -232,3 +245,3 @@ **Signatures**

* `file` (`VFile`) — [Virtual file](https://github.com/wooorm/vfile);
* `file` (`VFile`) — [Virtual file][vfile];

@@ -246,3 +259,3 @@ * `next` (`function([err])`, optional) — If the signature includes both

### Processor#parse(file\[, options\])
### `Processor#parse(file[, options])`

@@ -259,3 +272,3 @@ Parse a document into a syntax tree.

* `file` (`VFile`) — [Virtual file](https://github.com/wooorm/vfile).
* `file` (`VFile`) — [Virtual file][vfile].
* `value` (`string`) — String representation of a file.

@@ -268,3 +281,3 @@ * `options` (`Object`) — Configuration given to the parser.

### Processor#run(node\[, file\]\[, done\])
### `Processor#run(node[, file][, done])`

@@ -284,5 +297,5 @@ Transform a syntax tree by applying plug-ins to it.

* `node` (`Object`) — Syntax tree as returned by `parse()`;
* `file` (`VFile`) — [Virtual file](https://github.com/wooorm/vfile).
* `file` (`VFile`) — [Virtual file][vfile].
* `value` (`string`) — String representation of a file.
* `done` ([`function done(err, node, file)`](#function-doneerr-node-file)).
* `done` ([`function done(err, node, file)`][run-done]).

@@ -297,3 +310,3 @@ **Returns**

#### function done(err, node, file)
#### `function done(err, node, file)`

@@ -313,3 +326,3 @@ Invoked when transformation is complete.

### Processor#stringify(node\[, file\]\[, options\])
### `Processor#stringify(node[, file][, options])`

@@ -329,3 +342,3 @@ Compile a syntax tree into a document.

* `node` (`Object`) — Syntax tree as returned by `parse()`;
* `file` (`VFile`) — [Virtual file](https://github.com/wooorm/vfile).
* `file` (`VFile`) — [Virtual file][vfile].
* `value` (`string`) — String representation of a file.

@@ -342,3 +355,3 @@ * `options` (`Object`) — Configuration.

### Processor#process(file\[, options\]\[, done\])
### `Processor#process(file[, options][, done])`

@@ -355,6 +368,6 @@ Parse / Transform / Compile. When an async transformer is used,

* `file` (`File`) — [Virtual file](https://github.com/wooorm/vfile);
* `file` (`File`) — [Virtual file][vfile];
* `value` (`string`) — String representation of a file;
* `options` (`Object`) — Configuration.
* `done` ([`function done(err?, doc?, file?)`](#function-doneerr-doc-file)).
* `done` ([`function done(err?, doc?, file?)`][process-done]).

@@ -365,3 +378,3 @@ **Returns**

#### function done(err, doc, file)
#### `function done(err, doc, file)`

@@ -381,3 +394,3 @@ Invoked when processing is complete.

### Processor#data
### `Processor#data`

@@ -391,2 +404,56 @@ `JSON.stringify`able dictionary providing information to `Parser`, `Compiler`,

[MIT](LICENSE) © [Titus Wormer](http://wooorm.com)
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[travis-badge]: https://img.shields.io/travis/wooorm/unified.svg
[travis]: https://travis-ci.org/wooorm/unified
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/unified.svg
[codecov]: https://codecov.io/github/wooorm/unified
[npm-install]: https://docs.npmjs.com/cli/install
[duo-install]: http://duojs.org/#getting-started
[releases]: https://github.com/wooorm/unified/releases
[license]: LICENSE
[author]: http://wooorm.com
[remark]: https://github.com/wooorm/remark
[retext]: https://github.com/wooorm/retext
[hast]: https://github.com/wooorm/hast
[unherit]: https://github.com/wooorm/unherit
[vfile]: https://github.com/wooorm/vfile
[unified-bridge]: https://github.com/wooorrm/unified-bridge
[remark-retext]: https://github.com/wooorrm/remark-retext
[remark-index]: https://github.com/wooorm/remark/blob/master/index.js
[unified-options]: #unifiedoptions
[plugin]: #plugin
[attacher]: #function-attacherprocessor-input
[transformer]: #function-transformernode-file-next
[use]: #processoruseplugin-input
[process]: #processorprocessfile-options-done
[process-done]: #function-doneerr-doc-file
[run]: #processorrunnode-file-done
[run-done]: #function-doneerr-node-file
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc