Skip to content

Differences in label: syntax?Β #128

@stdedos

Description

@stdedos

Hellou there,

Related to this Mermaid discussion: https://github.com/orgs/mermaid-js/discussions/7332

I’m seeing different rendering in mkdocs (via mkdocs-mermaid2) vs GitHub / https://mermaid.live/edit for blank lines inside a shape label:.
tl;dr it seems that there is no way to render one new line between πŸ“‹ List and the steps - even when <br/> is used

I realize that mkdocs does NOT render according to Commonmark rules. Also, I am new to mkdocs - so my config might not be the best.

Here's my gfm comment source:

For this diagram

````md
```mermaid
flowchart LR
    List@{ shape: braces, label: "πŸ“‹ List

    ☐ Step A
    β˜‘ Step B
    β˜‘ Step C
    ☐ Step D
    ☐ Step E
    ☐ Step F
    ☐ Step G" }
```
````

I want to add exactly one empty line between `πŸ“‹ List` and the steps.

All my attempts, however, give different results:

1. ````md
   ```mermaid
   flowchart LR
       List@{ shape: braces, label: "πŸ“‹ List
 
       ☐ Step A
       β˜‘ Step B
       β˜‘ Step C
       ☐ Step D
       ☐ Step E
       ☐ Step F
       ☐ Step G" }
   ```
   ````
 
   ```mermaid
   flowchart LR
       List@{ shape: braces, label: "πŸ“‹ List
 
       ☐ Step A
       β˜‘ Step B
       β˜‘ Step C
       ☐ Step D
       ☐ Step E
       ☐ Step F
       ☐ Step G" }
   ```

2. ````md
   ```mermaid
   flowchart LR
       List@{ shape: braces, label: "πŸ“‹ List<br>
 
       ☐ Step A
       β˜‘ Step B
       β˜‘ Step C
       ☐ Step D
       ☐ Step E
       ☐ Step F
       ☐ Step G" }
   ```
   ````
 
   ```mermaid
   flowchart LR
       List@{ shape: braces, label: "πŸ“‹ List<br>
 
       ☐ Step A
       β˜‘ Step B
       β˜‘ Step C
       ☐ Step D
       ☐ Step E
       ☐ Step F
       ☐ Step G" }
   ```

3. ````md
   ```mermaid
   flowchart LR
       List@{ shape: braces, label: "πŸ“‹ List<br><br>
 
       ☐ Step A
       β˜‘ Step B
       β˜‘ Step C
       ☐ Step D
       ☐ Step E
       ☐ Step F
       ☐ Step G" }
   ```
   ````
 
   ```mermaid
   flowchart LR
       List@{ shape: braces, label: "πŸ“‹ List<br><br>
 
       ☐ Step A
       β˜‘ Step B
       β˜‘ Step C
       ☐ Step D
       ☐ Step E
       ☐ Step F
       ☐ Step G" }
   ```


4. ````md
   ```mermaid
   flowchart LR
       List@{ shape: braces, label: "πŸ“‹ List
       <br>
       ☐ Step A
       β˜‘ Step B
       β˜‘ Step C
       ☐ Step D
       ☐ Step E
       ☐ Step F
       ☐ Step G" }
   ```
   ````
   ```mermaid
   flowchart LR
       List@{ shape: braces, label: "πŸ“‹ List
       <br>
       ☐ Step A
       β˜‘ Step B
       β˜‘ Step C
       ☐ Step D
       ☐ Step E
       ☐ Step F
       ☐ Step G" }
   ```

... except 3 and 4 (which both render 3 `<br/>`s)

I have looked at the help:
* There is no mentioning of `label:` parameter in `shape:`, and
* In https://mermaid.ai/open-source/syntax/flowchart.html#parameters of Icon Shape, it merely says `label: The text label associated with the icon. This can be any string. If not defined, no label will be displayed.` - without specifying what syntax the `label:` has.

According to Commonmark rules, a newline with an empty line is enough to generate a paragraph.

I am very new to Mermaid - so it might be mentioned somewhere else.

Thank you for your time and effort

Environment:

$ uv pip list | grep mkdocs-
mkdocs-autorefs            1.4.3
mkdocs-get-deps            0.2.0
mkdocs-material            9.7.1
mkdocs-material-extensions 1.3.1
mkdocs-mermaid2-plugin     1.2.3
# mkdocs.yml
site_name: A

docs_dir: docs
theme:
  name: material
  features:
    - content.code.annotate

plugins:
  - search
  - mermaid2:
      # Different from the 10.7.0 default
      version: 11.12.2
  # - commonmark
  # Stay on `mkdocs==1.4.3` (which forces quite a few downgrades), or
  # https://github.com/mkdocs/mkdocs/issues/1835#issuecomment-1664770402, or
  # "just don't do it"
  - mkdocstrings:
      handlers:
        python:
          options:
            docstring_style: restructuredtext
            show_source: true

markdown_extensions:
  - tables
  - toc:
      permalink: true
  - pymdownx.inlinehilite
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:mermaid2.fence_mermaid_custom
  - pymdownx.highlight

Metadata

Metadata

Assignees

No one assigned

    Labels

    AnnoyanceNot a bug, but should be fixed.mermaid-jsThis isssue relates to the mermaid javascript library

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions