classDiagram classname has no bold style in preview and has clipped problem when generating png with theme

Author: imba-tjdCreated Apr 7, 2026Updated Apr 7, 2026
Labelsbug

Describe the bug When using classDiagram, the classname has no bold style in preview. But if you set a theme and export it to png, there is bold style, and the text are not fully shown.

To Reproduce

---
config:
  theme: default
---
classDiagram
    class TheClass {
    }

Any theme can trigger this bug. But it's ok if no theme or export to pdf.

Screenshots

Preview:

Image

Exported to png:

Image

Desktop:

  • OS: Windows11 25H2
  • Browser Edge
  • Version 146.0.3856.97

Additional context

https://mermaid.ai/live/edit seems to correctly render the preview. My issue is on https://mermaid.ai/app

Source: mermaid-js/mermaid-live-editor