美人鱼图:调整图周围的白色 space

mermaid diagrams: Adjust white space around graph

我在用 Rstudio 编译的 Rmd 报告中使用了美人鱼图。在 HTML/PDF 输出中,图表上方和下方有很多空白 space,请参见下面的示例。

# Header
Text
```{r}
library(DiagrammeR)
mermaid("
graph TD
    classDef style_main_node fill:orange,stroke:#333,stroke-width:0px;
    classDef style_sub_node fill:lightgray,stroke:#333,stroke-width:0px;

0(Top)
0 --> A1(Left)
0 --> B1(Center)
0 --> C1(Right)

    class 0 style_main_node;
    class A1,B1,C1 style_sub_node;
")
```
Text

有没有办法裁剪掉图表周围的 off/adjust 白色 space? 也可能改变它的大小?

只需指定图表周围的高度和宽度:height = '100%', width = '100%'

# Header
Text
```{r}
library(DiagrammeR)
mermaid("
graph TD
    classDef style_main_node fill:orange,stroke:#333,stroke-width:0px;
    classDef style_sub_node fill:lightgray,stroke:#333,stroke-width:0px;

0(Top)
0 --> A1(Left)
0 --> B1(Center)
0 --> C1(Right)

    class 0 style_main_node;
    class A1,B1,C1 style_sub_node;
", height = '100%', width = '100%')
```
Text