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

Class diagram : manually separate attributes and methods #6330

Open
tamdaz opened this issue Feb 25, 2025 · 1 comment
Open

Class diagram : manually separate attributes and methods #6330

tamdaz opened this issue Feb 25, 2025 · 1 comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@tamdaz
Copy link

tamdaz commented Feb 25, 2025

Proposal

My suggestion is to use a horizontal line to manually separate attributes and functions.

Reason

By default, this library separates attributes from methods using parentheses. However, in strongly typed programming languages, types can sometimes contain parentheses to make it explicit. For Mermaid, it thought it was a method, whereas it's actually an attribute.

Example

classDiagram
class Circle {
    -@radius : Array(Int32)
    ----------------------------
    #initialize(radius : Array(Int32))
    +add_number(number : Int32) self
}

This example shows a class with an attribute and methods. A horizontal line (which is a sequence of - characters) is placed between the two. To ensure that a horizontal line works, at least 3 or 4 - characters must be used.

Screenshots

No response

@tamdaz tamdaz added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Feb 25, 2025
@tamdaz
Copy link
Author

tamdaz commented Feb 25, 2025

For information, the generic of the @numbers attribute (instance var) is surrounded by parantheses, not by < and >. This type refers to the Crystal programming language.
Source: https://crystal-lang.org/reference/1.15/syntax_and_semantics/literals/array.html#generic-type-argument

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: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant