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

graph: syntax to prepend group name in subnodes #4516

Open
ioggstream opened this issue Jun 21, 2023 · 1 comment
Open

graph: syntax to prepend group name in subnodes #4516

ioggstream opened this issue Jun 21, 2023 · 1 comment
Labels
Graph: Flow Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@ioggstream
Copy link

Proposal

Mermaid.js should prepend the subgraph name to nested entries starting with @ (or some other symbol).

This will simplify reusing graphs with specific patterns (e.g., networks, hosts, organizational patterns).

Note

This can even be implemented via a pre-processor, without altering the mermaid parser.

Example

graph

subgraph location1-net1
@-web
@-db
end

subgraph location1-net2
@-web
@-db
end


should render to

graph
subgraph location1-net1
location1-net1-web
location1-net1-db
end

subgraph location1-net2
location1-net2-web
location1-net2-db
end

Screenshots

No response

@ioggstream ioggstream added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Jun 21, 2023
@nirname
Copy link
Contributor

nirname commented Jul 18, 2023

I like the idea, but the preprocessor is not the best choice, because it actually must be aware of syntax. Otherwise there are chances that it will ruin the diagram. What if someone would need this '@' special-meaning symbol in the node title?

I suggest 2 main options:

  • Either include it in grammar
  • Or put it in a config

And my questions are:

  • Do you need to apply that rule for a separate node or for the whole graph only?
  • Does it affect the name of node or the title?
  • If it affects the name of the node, should I rename other occurrences of it?
    graph
    
    subgraph A
    @a
    @b
    end
    
    data --> @a
    %% or
    data --> a
    

There is different but very similar idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Graph: Flow Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants