Skip to content

How do I make multiple mermaid diagrams as subfigures? #11482

Answered by roaldarbol
roaldarbol asked this question in Q&A
Discussion options

You must be logged in to vote

Ah, figured a way!
Since subfigures need their own labels/tags, and the way to achieve that is through a figure div, you can simply nest figure divs:

Input Output
---
title: "Subfigures"
format: html
---

::::{#fig-intro-diagram layout-ncol=2}

:::{#fig-intro-1}
```{mermaid}
flowchart TD
  A[High-level behaviour] --> B[Low-level behaviour]
```
:::

:::{#fig-intro-2}
```{mermaid}
flowchart TD
  A[High-level behaviour] --> B[Low-level behaviour]
  C[Environment] -.-> A & B
```
:::

This is a caption.
::::

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by roaldarbol
Comment options

You must be logged in to vote
5 replies
@roaldarbol
Comment options

@cscheid
Comment options

@mcanouil
Comment options

@cscheid
Comment options

@mcanouil
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants