Skip to content

Sequence Diagram Message Lines Rendered with stroke="none" #1006

Description

@FrankLedo

Environment

  • mermaid-cli version: 11.4.0, 11.10.1, 11.12.0 (all tested)
  • Node version: 22.18.0
  • OS: macOS 25.0.0 (Darwin)
  • Output format: SVG

Description

When generating sequence diagrams with mmdc (mermaid-cli), the message lines (arrows between participants) are rendered with stroke="none" as an inline attribute, making them invisible in the output.

Steps to Reproduce

  1. Create a simple sequence diagram:
sequenceDiagram
    participant A as Alice
    participant B as Bob
    A->>B: Hello Bob!
    B->>A: Hello Alice!
Loading
  1. Generate SVG with transparent background:
npx mmdc -i diagram.mmd -o diagram.svg -b transparent
  1. Inspect the generated SVG:
grep 'class="messageLine' diagram.svg

Expected Behavior

Message lines should use the CSS class definition:

<line class="messageLine0" stroke-width="2" marker-end="url(#arrowhead)" .../>

Where the CSS defines:

.messageLine0 {
    stroke-width: 1.5;
    stroke-dasharray: none;
    stroke: #333;
}

Actual Behavior

Message lines are rendered with inline stroke="none":

<line class="messageLine0" stroke-width="2" stroke="none" marker-end="url(#arrowhead)" .../>

The inline stroke="none" overrides the CSS class definition, making the lines invisible.

Impact

  • Sequence diagrams appear broken with only actors visible
  • Message lines and arrows are completely invisible
  • Affects all v11.x versions tested (11.4.0, 11.10.1, 11.12.0)

Workaround

Post-process the SVG to remove the inline stroke="none" attribute:

const content = fs.readFileSync('diagram.svg', 'utf8');
const fixed = content.replace(
    /(<line[^>]*class="messageLine\d+"[^>]*)\s+stroke="none"/g,
    '$1'
);
fs.writeFileSync('diagram.svg', fixed, 'utf8');

Additional Context

  • Flow diagrams render correctly without this issue
  • The CSS class definition is present and correct in the generated SVG
  • Only the inline attribute needs to be removed for proper rendering

Regression

This appears to affect all v11.x versions, suggesting it may have been introduced in the v11 rewrite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions