Command reference
plotwork render
Draw the first diagram of a file, or a view link, to an SVG that carries its source. It is a command of the Plotwork command line, the npm package @buun_group/plotwork.
TL;DR
| Question | Answer |
|---|---|
| What does it do? | Draw the first diagram of a file, or a view link, to an SVG that carries its source. |
| How do I run it? | npx -y @buun_group/plotwork@0.10.0 render, or plotwork render once the package is installed. |
| What does it write? | One SVG, and the settings file, when the defaults differ from an organisation's legend choice or diagram style that was read. |
| Does it use the network? | No, unless PLOTWORK_API_KEY is set and --org, PLOTWORK_ORG or brand.organization of the settings names an organisation: then two requests to the Plotwork API read its legend choice and diagram style, which are written over the settings file's defaults. A view link is decoded on this machine. |
| Does it read the repository settings? | Yes: the header defaults of the settings file apply to every diagram. See Configuration. |
| How do I read this in a terminal? | plotwork render --help |
Synopsis
sh
plotwork render <file|link> [--out <svg>] [--scheme light|dark|auto] [--theme plotwork|slate|ocean|forest|sunset|mono|contrast] [--no-embed-source] [--config <file>]What it does
Draws the first diagram of a Markdown or .diagram file to one SVG. The source is written into the SVG, so read can give it back later; --no-embed-source leaves it out.
The file can also be a viewUrl, svgUrl, or pngUrl a Plotwork tool returned. Quote it: the diagram is decoded from the link on this machine and never fetched.
Options
| Option | Default | What it does |
|---|---|---|
--out <svg> | the file name with .svg, or diagram.svg for a link | The SVG to write. |
--scheme light|dark|auto | the scheme of the settings, else light | The color scheme to draw in; auto draws one picture that follows the reader. |
--theme plotwork|slate|ocean|forest|sunset|mono|contrast | the header's theme= | The colour theme, written into the header of the picture's source. |
--no-embed-source | the source is embedded | Leave the source out of the SVG. |
--config <file> | PLOTWORK_CONFIG, else the nearest plotwork.config.json or .plotwork/config.json from the file up to the repository root | The repository settings file to read: header defaults, and the style rules check applies. |
Examples
Draw a diagram file to an SVG.
sh
plotwork render checkout.diagram --out checkout.svgDraw it in the dark scheme.
sh
plotwork render checkout.diagram --scheme dark --out checkout.dark.svgDraw it in the ocean colour theme.
sh
plotwork render checkout.diagram --theme oceanWrite the picture of a view link a tool returned, with no request.
sh
plotwork render "<viewUrl>" --out flow.svgExit codes
| Code | When |
|---|---|
0 | The SVG was written. |
1 | The diagram has an error, or the file holds no diagram. |
2 | A mistake in the command line: an unknown option, a missing operand, a file or glob that matches nothing, or a settings file that cannot be read. |
See also
| Doc | Why |
|---|---|
| Command reference | Every command of the command line |
| Viewing diagrams | The view links a tool returns |
| Editing an existing diagram | Why the source is embedded |
| Exit codes and output formats | What every code and format means |