Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line breaks are not rendered correctly in class diagrams #6160

Open
LucasHaug opened this issue Dec 30, 2024 · 1 comment
Open

Line breaks are not rendered correctly in class diagrams #6160

LucasHaug opened this issue Dec 30, 2024 · 1 comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect

Comments

@LucasHaug
Copy link

Description

When using \n in class diagrams, the line break is not rendered, the \n symbol is rendered instead.

The issue #1745 was closed some time ago, but the solution is no longer valid.

Steps to reproduce

The following two diagrams can be used to reproduce the error in version 11.4.0:

Diagram from the issue #1745:

classDiagram
    DuOamBaseMsgHandler : # uint8_t m_phyId
    DuOamBaseMsgHandler : # string m_moduleName
    DuOamBaseMsgHandler : # weak_ptr m_ptrDuPlaneDataStore
    DuOamBaseMsgHandler : # shared_ptr m_ptrDataTree
    DuOamBaseMsgHandler : # int32_t m_initStatus
    DuOamBaseMsgHandler: + virtual ~DuOamBaseMsgHandler()
    DuOamBaseMsgHandler: + someFunction()
    DuOamBaseMsgHandler: + DuOamBaseMsgHandler(const uint8_t& ccId, \n const string_view moduleName, \n weak_ptr ptrDuMplaneDataStore)
    DuOamBaseMsgHandler: + someFunction()

Diagram from the mermaid class diagram documentation:

---
title: Animal example
---
classDiagram
    note "From Duck till Zebra"
    Animal <|-- Duck
    note for Duck "can fly\ncan swim\ncan dive\ncan help in debugging"
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
        +String beakColor
        +swim()
        +quack()
    }
    class Fish{
        -int sizeInFeet
        -canEat()
    }
    class Zebra{
        +bool is_wild
        +run()
    }

Screenshots

Screenshot for the diagram from the issue #1745 in mermaid live:

image

Screenshot for the diagram from the documentation:

image

Code Sample

No response

Setup

  • Mermaid Live:

    • Version: 11.4.0
    • Edge: Version 131.0.2903.112 (Official build) (64-bit)
    • Chrome: Version 131.0.6778.204 (Official Build) (64-bit)
    • Firefox: 133.0.3 (64-bit)
  • Mermaid CLI docker:

    • Image: ghcr.io/mermaid-js/mermaid-cli/mermaid-cli:11.4.3-beta.2

Suggested Solutions

No response

Additional Context

No response

@LucasHaug LucasHaug added Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect labels Dec 30, 2024
@LucasHaug
Copy link
Author

I investigated this a little bit more using the docker images, and from what I've seen, the line break stopped working in the following version minlag/mermaid-cli:11.2.2-beta.6, when using minlag/mermaid-cli:11.2.2-beta.5 the line breaks still work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Bug / Error Something isn't working or is incorrect
Projects
None yet
Development

No branches or pull requests

1 participant