mkast v1.2.12
Tree
Converts nodes to and from JSON
Transforms commonmark nodes to and from JSON for piping between processes.
Install
npm i mkastUsage
Serialize commonmark nodes to line-delimited JSON:
var mkast = require('mkast')
, ast = mkast.parse('# Title\n<? @include file.md ?>');
mkast.serialize(ast).pipe(process.stdout);For more information see the api docs.
API
parser
parser(stream[, cb])Parse line-delimited JSON to vanilla objects.
When a callback function is given it is added as a listener for
the error and finish events on the parser stream.
Returns the parser stream.
streamObject input stream.cbFunction callback function.
deserialize
deserialize([stream][, cb])Deserialize line-delimited JSON to commonmark nodes.
When a callback function is given it is added as a listener for
the error and eof events on the deserializer stream.
The eof event can fire multiple times so the callback may be called
multiple times.
Returns the deserializer stream.
streamObject input stream.cbFunction callback function.
serialize
serialize(node[, opts][, cb])Serialize a commonmark AST node to line-delimited JSON.
When the node is of the document type it's direct descendants are
detached from the document and streamed as independent lines. So that
consumers of the stream will know when the document ends a node
with an eof type is sent to indicate the end of file (EOF).
When injecting documents into a stream it may be desirable to disable this behaviour, to do so use:
{eof: false}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.
nodeObject input AST node.optsObject processing options.cbFunction callback function.
License
MIT
Created by mkdoc on April 2, 2016
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago