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.
|
|
|
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).
|
|
|
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.
|
|
|
Styling and Layout
Styling in Pikchr feels like writing a layout script rather than CSS.
|
|
|
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.