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:Supported diagram languages
Mermaid examples
Flowchart
Sequence diagram
Class diagram
PlantUML example
GraphViz example
Captions and anchors
Addcaption and anchor attributes to include the diagram in the List of Figures and enable cross-references:
Alignment
Control horizontal alignment with thealign attribute:
Rendering as code (renderAsImage=false)
By default, diagram language code blocks are rendered as images. SetrenderAsImage=false to display the source code as a regular code block instead:
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) orfalse
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.
