2

I have the following Mermaid code that renders the following diagram:

enter image description here

flowchart LR;
    classDef socket fill:#f9f,stroke:#333,stroke-width:4px;
    subgraph host1[Client Host]
        subgraph "Client Process (Browser)"
            app1[Browser Code] <--> socket1[Socket<br/>TCP/64206]:::socket
        end
        subgraph os1[OS]
            socket1 <--> tcp1[Transport Layer] <--> ip1[Internet Layer] <--> link1[Link Layer]
        end
    end
    subgraph host2[Server Host]
        subgraph os2[OS]
            link2[Link Layer] <--> ip2[Internet Layer] <--> tcp2[Transport Layer]
        end
        subgraph "Server Process (Web Server)"
            tcp2 <--> socket2[Socket<br/>TCP/80]:::socket <--> app2[Server Code]
        end
    end
    link1 <--> link2
    ip1 <-.-> ip2
    tcp1 <-.-> tcp2
    socket1 <-.-> socket2

I would like to change the layout of the blocks so that the host1 subgraph is laid out top-down and host2 is laid out bottom-up. That is, the two Link Layer blocks should be rendered at the bottom, directly above them the Internet Layers, then the Transport Layers, then the Sockets and finally the Code blocks at the top. Is there a way to do it in Mermaid? Alternatively, is there a convenient way to edit the SVG to obtain the desired layout?

Ron Inbar
  • 2,044
  • 1
  • 16
  • 26
  • 2
    Looks like there's [an open issue about this](https://github.com/mermaid-js/mermaid/issues/1682) that hasn't been addressed, yet. It doesn't seem like Mermaid supports this. – samuei Mar 15 '21 at 05:15

0 Answers0