meshed.scrap.misc_utils

Misc utils

meshed.scrap.misc_utils.mermaid_pack_nodes(mermaid_code: str, nodes: Iterable[str], packed_node_name: str | None = None, *, arrow: str = '-->') str[source]

Output mermaid code with nodes packed into a single node.

>>> mermaid_code = '''
... graph TD
...   A --> B
...   B --> C
...   A --> D
...   D --> E
...   E --> C
... '''
>>>
>>>
>>> print(mermaid_pack_nodes(mermaid_code, ['B', 'C', 'E'], 'BCE'))  
graph TD
A -->BCE
A --> D
D -->BCE