Append or prepend a message
By default appends a message to a stream, use the message option to change the message; to prepend set the prepend option.
When no message is given the default generator message is used.
npm i mkmsg --save
For the command line interface install mkdoc globally (npm i -g mkdoc).
Create the stream and write a commonmark document:
var msg = require('mkmsg')
, ast = require('mkast');
ast.src('This is a markdown paragraph.')
.pipe(msg())
.pipe(ast.stringify({indent: 2}))
.pipe(process.stdout);Append the default generator message:
mkcat README.md | mkmsg | mkoutAppend a custom message:
mkcat README.md | mkmsg -m "Commit: $(git rev-parse HEAD)" | mkoutPrepend a custom message:
mkcat README.md | mkmsg -p -m "Commit: $(git rev-parse HEAD)" | mkoutUsage: mkmsg [options]
Message injection.
Options
-m, --message=[MSG] Custom message, parsed as markdown
-p, --prepend Prepend message to the stream
-h, --help Display help and exit
--version Print the version and exit
[email protected]
msg([opts][, cb])Append or prepend a message string.
The message string is parsed as markdown and written to the end of the
document unless prepend is given.
The document node itself is omitted; it's content nodes are written to the stream.
Returns an output stream.
optsObject processing options.cbFunction callback function.
inputReadable input stream.outputWritable output stream.messageString markdown message.prependBoolean prepend message to the stream.
MIT
Created by mkdoc on April 18, 2016