Load source files
Concatenate stdin and documents passed as files, buffer into a single markdown document, parse using commonmark, convert the parsed AST to newline-delimited JSON.
npm i mkcat --save
For the command line interface install mkdoc globally (npm i -g mkdoc).
Create the stream and write a commonmark document:
var cat = require('mkcat')
, ast = require('mkast');
cat({files: ['README.md']})
.pipe(ast.stringify({indent: 2}))
.pipe(process.stdout);Read files:
mkcat README.md | mkoutRead stdin:
cat README.md | mkcat | mkoutHowever this is not recommended because file path information is lost which is important for some processing tools.
Concatenate stdin with files:
cat README.md | mkcat API.md DEVELOPER.md | mkoutUsage: mkcat [options] [files...]
Reads markdown documents.
Options
-h, --help Display help and exit
--version Print the version and exit
[email protected]
cat(opts[, cb])Concatenate stdin with files.
Callback takes the form function(err, result) where the type of result
will change depending upon the options given.
When none of the buffer, stringify and ast options are given the
the callback is invoked with no result when the serialize stream finishes.
Returns a buffered reader stream.
optsObject processing options.cbFunction callback function.
filesArray list of files to concatenate.inputReadable input stream to read before files.outputWritable output stream.encodingString=utf8 character encoding.bufferBoolean=false callback withBuffer.stringifyBoolean=false callback with astring.astBoolean=false callback with the parsed AST.serializeBoolean=false pipe to a serialize stream.
MIT
Created by mkdoc on April 18, 2016