Skip to content

Mermaid diagrams: text labels overflow since 9.0.13 #5168

@frankie567

Description

@frankie567

Context

No response

Bug description

Labels in nodes and arrows are overflowing the size of their nodes.

Capture d’écran 2023-03-08 à 14 26 12

It happens since version 9.0.13. More specifically, it has probably been introduced by this commit: 5065bf9

Here is how it looked like in 9.0.12 and before:

Capture d’écran 2023-03-08 à 14 35 21

Suspected root cause

The variable --md-mermaid-font-family is now only defined under the .mermaid class and not in :root anymore. For some reasons, Mermaid compiler may not be able to pick it and thus compute the size of the nodes with its default font instead.

Workaround

If I manually set the variable in :root in custom CSS, it solves the issue:

:root > * {
  --md-mermaid-font-family: var(--md-text-font-family), sans-serif;
}

Related links

Reproduction

example.zip

Steps to reproduce

  1. Enable Mermaid superfence extension.
  2. Add a Mermaid diagram with long labels on nodes and arrows.

Browser

Chrome, Safari, Firefox

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions