mkcat

Concatenate source files to an abstract syntax tree

Usage no npm install needed!

<script type="module">
  import mkcat from 'https://cdn.skypack.dev/mkcat';
</script>

README

Cat

Build Status npm version Coverage Status

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.

Install

npm i mkcat --save

For the command line interface install mkdoc globally (npm i -g mkdoc).

Usage

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);

Example

Source files:

mkcat API.md README.md | mkout

Help

mkcat [options] [files...]

Concatenate source files to an abstract syntax tree.

  --no-ast    Disable AST output, prints input
  -h, --help  Display this help and exit
  --version   Print the version and exit

Report bugs to https://github.com/mkdoc/mkcat/issues

API

cat

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.

  • opts Object processing options.
  • cb Function callback function.

Options

  • files Array list of files to concatenate.
  • input Readable input stream to read before files.
  • output Writable output stream.
  • encoding String=utf8 character encoding.
  • buffer Boolean=false callback with Buffer.
  • stringify Boolean=false callback with a string.
  • ast Boolean=false callback with the parsed AST.
  • serialize Boolean=false pipe to a serialize stream.

License

MIT


Created by mkdoc.