pikchr

vb pikchr [OPTIONS] [INFILE] [OUTFILE]

Description

Accepts a pikchr script as input and outputs the rendered script as an SVG graphic. The INFILE and OUTFILE options default to stdin resp. stdout, and the names - can be used as aliases for those streams.

The -div-indent/center/left/right flags may not be combined.

Options

-div

On success, add a DIV wrapper around the resulting SVG output which limits its max-width to its computed maximum ideal size

-div-indent

Like -div but indent the div

-div-center

Like -div but center the div

-div-left

Like -div but float the div left

-div-right

Like -div but float the div right

-div-toggle

Set the toggle CSS class on the div (used by the JavaScript-side post-processor)

-div-source

Set the source CSS class on the div, which tells CSS to hide the SVG and reveal the source by default.

-src

Store the input pikchr’s source code in the output as a separate element adjacent to the SVG one. Implied by -div-source.

-dark

Change pikchr colors to assume a dark-mode theme.

Examples

  • Render a simple Pikchr diagram to stdout

$ vb sys echo "box \"Hello\"; right; circle" > diagram.pikchr
$ vb pikchr diagram.pikchr
<svg xmlns='http://www.w3.org/2000/svg' style='font-size:initial;' class="pikchr" viewBox="0 0 184.32 76.32" data-pikchr-date="20250319161943">
<path d="M2.16,74.16L110.16,74.16L110.16,2.16L2.16,2.16Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56.16" y="38.16" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">Hello</text>
<circle cx="146.16" cy="38.16" r="36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
  • Render to an SVG file with a centered DIV wrapper

$ vb sys echo "box \"Start\"; arrow; box \"End\"" > flow.pikchr
$ vb pikchr -div-center flow.pikchr flow.svg