# prepress
[![Node.js CI](https://github.com/MikeHopcroft/prepress/actions/workflows/ci.yaml/badge.svg)](https://github.com/MikeHopcroft/prepress/actions/workflows/ci.yaml)
[![Coverage Status](https://coveralls.io/repos/github/MikeHopcroft/prepress/badge.svg?branch=main)](https://coveralls.io/github/MikeHopcroft/prepress?branch=main)
`Prepress` is a command-line utility for programmatically generating content for
[fenced code blocks](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks) in [markdown](https://www.markdownguide.org/) files.
The tool assists in authoring and maintaining code blocks used for examples in documentation.
`Prepress` can generate content for specially marked code blocks by
* incorporating the contents of a file
* capturing the output of a native executable or script
* logging interactive sessions with programs like the node read-eval-print-loop.
The examples in this `README.md` file were generated using `prepress`.
You can view the `prepress` input used to generate this page at [documentation/README.src.md](https://raw.githubusercontent.com/MikeHopcroft/prepress/main/documentation/README.src.md).
## Installation
`Prepress` is a [Node.js](https://nodejs.org/en/) program,
written in [TypeScript](https://www.typescriptlang.org/).
In order to use `prepress` you must have
[Node](https://nodejs.org/en/download/) installed on your machine.
`Prepress` has been tested with Node version [13.7.0](https://nodejs.org/download/release/v16.0.0/). Here's how to verify that Node is installed:
[//]: # (spawn node --version)
~~~
$ node --version
v16.0.0
~~~
Once you have Node, you can install the [prepress](https://www.npmjs.com/package/prepress) package directly from [npm](https://www.npmjs.com):
~~~
$ npm install -g prepress
~~~
This will make the `prepress` command available in your shell. You can verify your installation by typing
[//]: # (script prepress --help)
~~~
~~~
## Running Prepress
`Prepress` transforms _markdown source files_ into markdown files, by supplying the contents for [specially marked code blocks](#authoring-markdown-for-prepress). The source file names must end with the extension, `".src.md"`. The generated markdown files will have the regular `".md"` extension.
The syntax for the `prepress` command is
~~~
$ prepress [