Table of Contents
AST Transformer
.
Transforms commonmark AST documents to and from JSON for piping between processes.
Install
npm i mkast
Usage
Serialize commonmark AST to line-delimited JSON:
var cmark = require('commonmark')
, parser = new cmark.Parser()
, mkast = require('mkast')
, ast = parser.parse('# Title\n<? @include file.md ?>');
mkast.serialize(ast).pipe(process.stdout);
For more information see the api docs.
API
deserialize
deserialize(stream[, cb])
Parse line-delimited JSON to commonmark AST.
When a callback function is given it is added as a listener for
the error and eof events on the deserializer stream.
Returns the deserializer stream.
stream
Object input stream.cb
Function callback function.
deserialize
deserialize(stream[, cb])
Deserialize line-delimited JSON to commonmark AST documents.
When a callback function is given it is added as a listener for
the error and eof events on the deserializer stream.
Returns the deserializer stream.
stream
Object input stream.cb
Function callback function.
serialize
serialize(buffer[, cb])
Serialize a commonmark AST to line-delimited JSON.
When a callback function is given it is added as a listener for
the error and finish events on the serializer stream.
Returns the serializer stream.
buffer
Object input AST.cb
Function callback function.
License
MIT.
Generated by mdp(1).