Search code examples
visual-studio-codemarkdownmermaid

How to type in multiple spaces in mermaid?


I'm using VS Code to edit my markdown file, and need to make flowcharts (graph) to display workflow.

The problem is VS Code will not properly display the long text title, the last few part will be truncated as showed in follow:

```mermaid
graph LR

azzzzzzzz-->b
```

enter image description here

So I'm thinking of simply adding space after the text. However, I searched through the internet, and cannot find a way to type in multiple space.

```mermaid
graph LR

a[zzz   z   zzzz   ]-->b
```

enter image description here

No matter what I try, the actual title will only display 1 space only. So if anyone can help either on truncate issue of VS Code or teach me how to type in multiple space.

I've been struggling with it for whole day, please help! Thanks a lot!


Solution

  • According to documentation Entity codes to escape characters you have to use the following:

    It is possible to escape characters using the syntax examplified here.

    graph LR
        A["A double quote:#quot;"] -->B["A dec char:#9829;"]
    

    In your example it could be the following:

    ```mermaid
    graph LR
    
    a["zzz #nbsp; z #nbsp; zzzz #nbsp; "]-->b
    ```