Drawdown bake is a tool for baking markdown documents with drawdown diagram scripts into markdown documents with diagram images

npm install drawdown-bake --save-devOnce installed the tool can be manually run by
node node_modules/.bin/drawdown-bake ./docs ./bakedThis will make the baker walk trough ./docs recursively and search for markdown files to bake.
For every file found it will:
- Extract all drawdown scripts.
- Create an image representation of the diagram. The image will be stored into
./baked/assets. - Scripts will be replaced with image references.
- Create new makrdown file into its relative directory within
./baked. - All non makrdown-ish files will be copied as is.
In a project drawdawn-bake can be used as a npm script in the package.json:
{
"scripts": {
"bake": "drawdown-bake ./src ./baked",
},
}Now, every time a new fresh documentation badge is needed it can be baked by:
npm run bakedrawdown-bake <source-dir> <destination-dir> [options]| Option | Defaults | Description |
|---|---|---|
| ext | md,markdown | CVS file extensions for markdown files to be baked |
| layout | .drawdown‑preview‑layout | Path to a JSON file with drawdown layout information. |
| no‑layout | --- | Will make the baker use automatic diagram layouts. Using --layout and --no-layout together will cause an error |
| web‑dir | <module>/web | A path to the directory which holds the browser version of the baker. Internally this tool uses puppeteer and chromium to render the SVG scripts produced by the drawdown-svg-render |
| web‑port | 8989 | Port number for the minimalistic web server to listen to. This server is used to serve the browser version of the baker which is later used by the chromium spawned by the puppeteer |
Bake only .txt and .md files
drawdown-bake ./docs ./baked --ext=txt,mdBake with custom layout file
drawdown-bake ./docs ./baked --layout=my_layout.jsonBake with automatic layout
drawdown-bake ./docs ./baked --no-layoutUsing different port for the built-in http-server (in case the default :8989 is already used)
drawdown-bake ./docs ./baked --web-port=8787