Skip to main content
Autype renders diagrams directly from text-based diagram languages. Write your diagram code in a fenced code block with the diagram language as the language identifier — it will be automatically rendered as an image in the exported document.
Diagrams are only rendered as images when Render as Image is enabled. You can control this globally via the Styles panel → Code Blocks setting, or override it per block with the renderAsImage attribute directly on the code block.

Basic syntax

Use a fenced code block with a supported diagram language:
The diagram is automatically rendered as a PNG image in the exported PDF/DOCX document.

Supported diagram languages

Mermaid examples

Flowchart

Sequence diagram

Class diagram

PlantUML example

GraphViz example


Captions and anchors

Add caption and anchor attributes to include the diagram in the List of Figures and enable cross-references:
This renders with: Figure 1: System Architecture Reference it elsewhere:

Alignment

Control horizontal alignment with the align attribute:

Rendering as code (renderAsImage=false)

By default, diagram language code blocks are rendered as images. Set renderAsImage=false to display the source code as a regular code block instead:
This is useful when you want to show the diagram source code to the reader rather than the rendered diagram.
When renderAsImage=false is set on a diagram code block, the block is treated as a regular code block. If it has a caption, it appears in the List of Code Listings instead of the List of Figures.

Global default

You can set the default for all code blocks in your document’s style settings:
  • defaults → styles → code → renderAsImage: true (default) or false
The element-level renderAsImage attribute always overrides the global default.

Attribute reference

Diagrams are rendered server-side during document export. In the live editor preview, diagram code blocks are displayed as syntax-highlighted code.