Unified
Details
-
The syntax trees used in unified are unist nodes
-
A node is a plain JavaScript objects with a type field
-
Syntax trees
-
List of processors
-
List of plugins
-
When processing a document, metadata is often gathered about that document
- vfile is a virtual file format that stores data, metadata, and messages about files for unified and its plugins.
-
Processors are configured with plugins or with the data method.
-
unified can integrate with the file system with unified-engine. CLI apps can be created with unified-args, Gulp plugins with unified-engine-gulp, and Atom Linters with unified-engine-atom.
Quickstart
var unified = require('unified')
var markdown = require('remark-parse')
var remark2rehype = require('remark-rehype')
var doc = require('rehype-document')
var format = require('rehype-format')
var html = require('rehype-stringify')
var report = require('vfile-reporter')
unified()
.use(markdown)
.use(remark2rehype)
.use(doc, {title: '👋🌍'})
.use(format)
.use(html)
.process('# Hello world!', function (err, file) {
console.error(report(err || file))
console.log(String(file))
})