← Back to Guides
DiagramsPikchr Diagrams in Markdown
Published on 2026-02-22

Pikchr Diagrams in Markdown

A PIC-like markup language for technical drawing embedded directly in Markdown.

Pikchr (pronounced “picture”) is a specialized language closely matching the legendary PIC language created at Bell Labs in the 1980s. Created by Richard Hipp (the author of SQLite), Pikchr is designed to generate highly precise, mathematical, and logic-based diagrams in scalable SVG format.

To use Pikchr in MarkdownToPrettyPDF, wrap your code in a pikchr code block.

Basic Geometry

Pikchr commands are highly imperative. You tell it exactly what shapes to draw and where to draw them relative to the previous shapes.

syntax
box "Hello"
arrow
ellipse "World"
PikchrPikchr diagram

The above script draws a box containing “Hello”, an arrow pointing right, and an ellipse containing “World”. The layout defaults to left-to-right.

Directions and Precise Placement

Pikchr excels at precise geometric placement by referencing points on previously drawn objects (like .e for east, .s for south, .nw for north-west).

syntax
           box "START" fill lightblue
           arrow down
        A: ellipse "Step 1"
           arrow right
        B: box "Step 2"
           arrow down
        C: ellipse "Step 3"
           
           # Draw an arrow from Step 3 to Step 1
           arrow from C.w to A.s
PikchrPikchr diagram

Creating Logic Gates and Technical Artifacts

Because Pikchr was built by C programmers, it natively understands how to draw fundamental technical concepts like disk drives, documents, and logic gates.

syntax
           line dashed
           box "CPU" fit
           arrow "data" above
      MEM: cylinder "Memory"
           
           line from CPU.s down
           text "I/O" italic
PikchrPikchr diagram

Styling and Layout

Styling in Pikchr feels like writing a layout script rather than CSS.

syntax
box wid 200% ht 150% fill lightgreen "Main Node"
arrow dotted right 200%
circle rad 50% fill orange "A"
PikchrPikchr diagram

When to Use Pikchr

Pikchr is a fantastic choice if you find tools like Mermaid or Graphviz arbitrarily moving your nodes in ways you don’t like. Since Pikchr uses relative spatial commands (draw an arrow from the bottom of Box A to the top of Box B), you retain absolute control over the final architectural image.