# plotwork render

> Page: https://docs.plotwork.dev/cli/commands/render. Index of every page: https://docs.plotwork.dev/llms.txt

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.1.0 render`, or `plotwork render` once the package is installed. |
| What does it write? | One SVG. |
| Does it use the network? | No. 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](https://docs.plotwork.dev/cli/configuration.md). |
| How do I read this in a terminal? | `plotwork render --help` |

## Synopsis

```sh
plotwork render <file|link> [--out <svg>] [--theme light|dark|auto] [--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. |
| `--theme light\|dark\|auto` | the theme of the settings, else `light` | The colours to draw in; `auto` draws one picture that follows the reader. |
| `--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.svg
```

Draw it in the dark theme.

```sh
plotwork render checkout.diagram --theme dark --out checkout.dark.svg
```

Write the picture of a view link a tool returned, with no request.

```sh
plotwork render "<viewUrl>" --out flow.svg
```

## Exit 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](https://docs.plotwork.dev/cli/commands.md) | Every command of the command line |
| [Viewing diagrams](https://docs.plotwork.dev/viewing-diagrams.md) | The view links a tool returns |
| [Editing an existing diagram](https://docs.plotwork.dev/editing-existing-diagrams.md) | Why the source is embedded |
| [Exit codes and output formats](https://docs.plotwork.dev/cli/exit-codes-and-output.md) | What every code and format means |
