Skip to content

MkClassDiagram

Show source on GitHub

Node to display the class hierarchy of a class. Supports multiple modes.

Example: Baseclass diagram

Jinja

{{ _mk.MkClassDiagram | MkClassDiagram(mode="baseclasses") }}

Python

MkClassDiagram(klass=MkClassDiagram, mode='baseclasses', direction='TD')
graph TD
  93860740162176["mkclassdiagram.MkClassDiagram"]
  93860742534992["mkdiagram.MkDiagram"]
  93860742841280["mkcode.MkCode"]
  93860744077920["mkcontainer.MkContainer"]
  93860744073616["mknode.MkNode"]
  93860744080896["node.Node"]
  140589822947552["builtins.object"]
  93860742534992 --> 93860740162176
  93860742841280 --> 93860742534992
  93860744077920 --> 93860742841280
  93860744073616 --> 93860744077920
  93860744080896 --> 93860744073616
  140589822947552 --> 93860744080896
```` mermaid
graph TD
  93860740162176["mkclassdiagram.MkClassDiagram"]
  93860742534992["mkdiagram.MkDiagram"]
  93860742841280["mkcode.MkCode"]
  93860744077920["mkcontainer.MkContainer"]
  93860744073616["mknode.MkNode"]
  93860744080896["node.Node"]
  140589822947552["builtins.object"]
  93860742534992 --> 93860740162176
  93860742841280 --> 93860742534992
  93860744077920 --> 93860742841280
  93860744073616 --> 93860744077920
  93860744080896 --> 93860744073616
  140589822947552 --> 93860744080896
````
<pre class="mermaid"><code>graph TD
  93860740162176["mkclassdiagram.MkClassDiagram"]
  93860742534992["mkdiagram.MkDiagram"]
  93860742841280["mkcode.MkCode"]
  93860744077920["mkcontainer.MkContainer"]
  93860744073616["mknode.MkNode"]
  93860744080896["node.Node"]
  140589822947552["builtins.object"]
  93860742534992 --&gt; 93860740162176
  93860742841280 --&gt; 93860742534992
  93860744077920 --&gt; 93860742841280
  93860744073616 --&gt; 93860744077920
  93860744080896 --&gt; 93860744073616
  140589822947552 --&gt; 93860744080896</code></pre>

Example: Subclass diagram

Jinja

{{ _mk.MkContainer | MkClassDiagram(mode="subclasses", direction="LR") }}

Python

MkClassDiagram(klass=MkContainer, mode='subclasses', direction='LR')
graph LR
  93860744077920["mkcontainer.MkContainer"]
  93860744078912["mkblock.MkBlock"]
  93860738712912["mkhtmlblock.MkHtmlBlock"]
  93860738889984["mkdetailsblock.MkDetailsBlock"]
  93860738695328["mktabs.MkTabBlock"]
  93860738890976["mkadmonition.MkAdmonition"]
  93860740371472["mkblockquote.MkBlockQuote"]
  93860742841280["mkcode.MkCode"]
  93860742534992["mkdiagram.MkDiagram"]
  93860740162176["mkclassdiagram.MkClassDiagram"]
  93860739173616["mkpipdeptree.MkPipDepTree"]
  93860740334656["mktreeview.MkTreeView"]
  93860738888176["mktemplate.MkTemplate"]
  93860742986000["mkclidoc.MkCliDoc"]
  93860742945248["mkmaterialbadge.MkMaterialBadge"]
  93860742946240["mkimagecompare.MkImageCompare"]
  93860743870752["mkimageslideshow.MkImageSlideshow"]
  93860742971840["mkiframe.MkIFrame"]
  93860740316816["mkcard.MkCard"]
  93860743668384["mkinstallguide.MkInstallGuide"]
  93860742514848["mkcodeofconduct.MkCodeOfConduct"]
  93860742511520["mkcommitconventions.MkCommitConventions"]
  93860742513296["mkpullrequestguidelines.MkPullRequestGuidelines"]
  93860743852160["mkdevenvsetup.MkDevEnvSetup"]
  93860743856272["mkdevtools.MkDevTools"]
  93860743265184["mkreprrawrendered.MkReprRawRendered"]
  93860741615712["mkcommandoutput.MkCommandOutput"]
  93860740594544["mkcommentedcode.MkCommentedCode"]
  93860743226512["mkconfigsetting.MkConfigSetting"]
  93860738860160["mkpluginflow.MkPluginFlow"]
  93860743872528["mklist.MkList"]
  93860740306432["mkbasetable.MkBaseTable"]
  93860740242912["mktable.MkTable"]
  93860740243904["mkhtmltable.MkHtmlTable"]
  93860738696320["mktabs.MkTab"]
  93860738698096["mktabcontainer.MkTabContainer"]
  93860742988944["mktabbedblocks.MkTabbedBlocks"]
  93860742990720["mktabbed.MkTabbed"]
  93860742992496["mkcritic.MkCritic"]
  93860743889648["mkannotations.MkAnnotation"]
  93860743892976["mkannotations.MkAnnotations"]
  93860743894752["mkfootnotes.MkFootNote"]
  93860743895744["mkfootnotes.MkFootNotes"]
  93860742973616["mkdefinitionlist.MkDefinition"]
  93860740301712["mkdefinitionlist.MkDefinitionList"]
  93860738687184["mkpage.MkPage"]
  93860739017392["mktemplatepage.MkTemplatePage"]
  93860739018384["mkclasspage.MkClassPage"]
  93860739885664["mkmodulepage.MkModulePage"]
  93860738689744["mkshowcase.MkShowcase"]
  93860738690736["mkspeechbubble.MkSpeechBubble"]
  93860738691728["mktasklist.MkTask"]
  93860739012720["mktasklist.MkTaskList"]
  93860739014496["mktimeline.MkTimeline"]
  93860738873792["mkshields.MkShields"]
  93860739080688["mkmetadatabadges.MkMetadataBadges"]
  93860744077920 --> 93860744078912
  93860744078912 --> 93860738712912
  93860744078912 --> 93860738889984
  93860744078912 --> 93860738695328
  93860744077920 --> 93860738890976
  93860744077920 --> 93860740371472
  93860744077920 --> 93860742841280
  93860742841280 --> 93860742534992
  93860742534992 --> 93860740162176
  93860742534992 --> 93860739173616
  93860742841280 --> 93860740334656
  93860744077920 --> 93860738888176
  93860738888176 --> 93860742986000
  93860738888176 --> 93860742945248
  93860738888176 --> 93860742946240
  93860738888176 --> 93860743870752
  93860738888176 --> 93860742971840
  93860738888176 --> 93860740316816
  93860738888176 --> 93860743668384
  93860738888176 --> 93860742514848
  93860738888176 --> 93860742511520
  93860738888176 --> 93860742513296
  93860738888176 --> 93860743852160
  93860738888176 --> 93860743856272
  93860738888176 --> 93860743265184
  93860738888176 --> 93860741615712
  93860738888176 --> 93860740594544
  93860738888176 --> 93860743226512
  93860738888176 --> 93860738860160
  93860744077920 --> 93860743872528
  93860744077920 --> 93860740306432
  93860740306432 --> 93860740242912
  93860740306432 --> 93860740243904
  93860744077920 --> 93860738696320
  93860744077920 --> 93860738698096
  93860738698096 --> 93860742988944
  93860738698096 --> 93860742990720
  93860744077920 --> 93860742992496
  93860744077920 --> 93860743889648
  93860744077920 --> 93860743892976
  93860744077920 --> 93860743894752
  93860744077920 --> 93860743895744
  93860744077920 --> 93860742973616
  93860744077920 --> 93860740301712
  93860744077920 --> 93860738687184
  93860738687184 --> 93860739017392
  93860739017392 --> 93860739018384
  93860739017392 --> 93860739885664
  93860744077920 --> 93860738689744
  93860744077920 --> 93860738690736
  93860744077920 --> 93860738691728
  93860744077920 --> 93860739012720
  93860744077920 --> 93860739014496
  93860744077920 --> 93860738873792
  93860744077920 --> 93860739080688
```` mermaid
graph LR
  93860744077920["mkcontainer.MkContainer"]
  93860744078912["mkblock.MkBlock"]
  93860738712912["mkhtmlblock.MkHtmlBlock"]
  93860738889984["mkdetailsblock.MkDetailsBlock"]
  93860738695328["mktabs.MkTabBlock"]
  93860738890976["mkadmonition.MkAdmonition"]
  93860740371472["mkblockquote.MkBlockQuote"]
  93860742841280["mkcode.MkCode"]
  93860742534992["mkdiagram.MkDiagram"]
  93860740162176["mkclassdiagram.MkClassDiagram"]
  93860739173616["mkpipdeptree.MkPipDepTree"]
  93860740334656["mktreeview.MkTreeView"]
  93860738888176["mktemplate.MkTemplate"]
  93860742986000["mkclidoc.MkCliDoc"]
  93860742945248["mkmaterialbadge.MkMaterialBadge"]
  93860742946240["mkimagecompare.MkImageCompare"]
  93860743870752["mkimageslideshow.MkImageSlideshow"]
  93860742971840["mkiframe.MkIFrame"]
  93860740316816["mkcard.MkCard"]
  93860743668384["mkinstallguide.MkInstallGuide"]
  93860742514848["mkcodeofconduct.MkCodeOfConduct"]
  93860742511520["mkcommitconventions.MkCommitConventions"]
  93860742513296["mkpullrequestguidelines.MkPullRequestGuidelines"]
  93860743852160["mkdevenvsetup.MkDevEnvSetup"]
  93860743856272["mkdevtools.MkDevTools"]
  93860743265184["mkreprrawrendered.MkReprRawRendered"]
  93860741615712["mkcommandoutput.MkCommandOutput"]
  93860740594544["mkcommentedcode.MkCommentedCode"]
  93860743226512["mkconfigsetting.MkConfigSetting"]
  93860738860160["mkpluginflow.MkPluginFlow"]
  93860743872528["mklist.MkList"]
  93860740306432["mkbasetable.MkBaseTable"]
  93860740242912["mktable.MkTable"]
  93860740243904["mkhtmltable.MkHtmlTable"]
  93860738696320["mktabs.MkTab"]
  93860738698096["mktabcontainer.MkTabContainer"]
  93860742988944["mktabbedblocks.MkTabbedBlocks"]
  93860742990720["mktabbed.MkTabbed"]
  93860742992496["mkcritic.MkCritic"]
  93860743889648["mkannotations.MkAnnotation"]
  93860743892976["mkannotations.MkAnnotations"]
  93860743894752["mkfootnotes.MkFootNote"]
  93860743895744["mkfootnotes.MkFootNotes"]
  93860742973616["mkdefinitionlist.MkDefinition"]
  93860740301712["mkdefinitionlist.MkDefinitionList"]
  93860738687184["mkpage.MkPage"]
  93860739017392["mktemplatepage.MkTemplatePage"]
  93860739018384["mkclasspage.MkClassPage"]
  93860739885664["mkmodulepage.MkModulePage"]
  93860738689744["mkshowcase.MkShowcase"]
  93860738690736["mkspeechbubble.MkSpeechBubble"]
  93860738691728["mktasklist.MkTask"]
  93860739012720["mktasklist.MkTaskList"]
  93860739014496["mktimeline.MkTimeline"]
  93860738873792["mkshields.MkShields"]
  93860739080688["mkmetadatabadges.MkMetadataBadges"]
  93860744077920 --> 93860744078912
  93860744078912 --> 93860738712912
  93860744078912 --> 93860738889984
  93860744078912 --> 93860738695328
  93860744077920 --> 93860738890976
  93860744077920 --> 93860740371472
  93860744077920 --> 93860742841280
  93860742841280 --> 93860742534992
  93860742534992 --> 93860740162176
  93860742534992 --> 93860739173616
  93860742841280 --> 93860740334656
  93860744077920 --> 93860738888176
  93860738888176 --> 93860742986000
  93860738888176 --> 93860742945248
  93860738888176 --> 93860742946240
  93860738888176 --> 93860743870752
  93860738888176 --> 93860742971840
  93860738888176 --> 93860740316816
  93860738888176 --> 93860743668384
  93860738888176 --> 93860742514848
  93860738888176 --> 93860742511520
  93860738888176 --> 93860742513296
  93860738888176 --> 93860743852160
  93860738888176 --> 93860743856272
  93860738888176 --> 93860743265184
  93860738888176 --> 93860741615712
  93860738888176 --> 93860740594544
  93860738888176 --> 93860743226512
  93860738888176 --> 93860738860160
  93860744077920 --> 93860743872528
  93860744077920 --> 93860740306432
  93860740306432 --> 93860740242912
  93860740306432 --> 93860740243904
  93860744077920 --> 93860738696320
  93860744077920 --> 93860738698096
  93860738698096 --> 93860742988944
  93860738698096 --> 93860742990720
  93860744077920 --> 93860742992496
  93860744077920 --> 93860743889648
  93860744077920 --> 93860743892976
  93860744077920 --> 93860743894752
  93860744077920 --> 93860743895744
  93860744077920 --> 93860742973616
  93860744077920 --> 93860740301712
  93860744077920 --> 93860738687184
  93860738687184 --> 93860739017392
  93860739017392 --> 93860739018384
  93860739017392 --> 93860739885664
  93860744077920 --> 93860738689744
  93860744077920 --> 93860738690736
  93860744077920 --> 93860738691728
  93860744077920 --> 93860739012720
  93860744077920 --> 93860739014496
  93860744077920 --> 93860738873792
  93860744077920 --> 93860739080688
````
<pre class="mermaid"><code>graph LR
  93860744077920["mkcontainer.MkContainer"]
  93860744078912["mkblock.MkBlock"]
  93860738712912["mkhtmlblock.MkHtmlBlock"]
  93860738889984["mkdetailsblock.MkDetailsBlock"]
  93860738695328["mktabs.MkTabBlock"]
  93860738890976["mkadmonition.MkAdmonition"]
  93860740371472["mkblockquote.MkBlockQuote"]
  93860742841280["mkcode.MkCode"]
  93860742534992["mkdiagram.MkDiagram"]
  93860740162176["mkclassdiagram.MkClassDiagram"]
  93860739173616["mkpipdeptree.MkPipDepTree"]
  93860740334656["mktreeview.MkTreeView"]
  93860738888176["mktemplate.MkTemplate"]
  93860742986000["mkclidoc.MkCliDoc"]
  93860742945248["mkmaterialbadge.MkMaterialBadge"]
  93860742946240["mkimagecompare.MkImageCompare"]
  93860743870752["mkimageslideshow.MkImageSlideshow"]
  93860742971840["mkiframe.MkIFrame"]
  93860740316816["mkcard.MkCard"]
  93860743668384["mkinstallguide.MkInstallGuide"]
  93860742514848["mkcodeofconduct.MkCodeOfConduct"]
  93860742511520["mkcommitconventions.MkCommitConventions"]
  93860742513296["mkpullrequestguidelines.MkPullRequestGuidelines"]
  93860743852160["mkdevenvsetup.MkDevEnvSetup"]
  93860743856272["mkdevtools.MkDevTools"]
  93860743265184["mkreprrawrendered.MkReprRawRendered"]
  93860741615712["mkcommandoutput.MkCommandOutput"]
  93860740594544["mkcommentedcode.MkCommentedCode"]
  93860743226512["mkconfigsetting.MkConfigSetting"]
  93860738860160["mkpluginflow.MkPluginFlow"]
  93860743872528["mklist.MkList"]
  93860740306432["mkbasetable.MkBaseTable"]
  93860740242912["mktable.MkTable"]
  93860740243904["mkhtmltable.MkHtmlTable"]
  93860738696320["mktabs.MkTab"]
  93860738698096["mktabcontainer.MkTabContainer"]
  93860742988944["mktabbedblocks.MkTabbedBlocks"]
  93860742990720["mktabbed.MkTabbed"]
  93860742992496["mkcritic.MkCritic"]
  93860743889648["mkannotations.MkAnnotation"]
  93860743892976["mkannotations.MkAnnotations"]
  93860743894752["mkfootnotes.MkFootNote"]
  93860743895744["mkfootnotes.MkFootNotes"]
  93860742973616["mkdefinitionlist.MkDefinition"]
  93860740301712["mkdefinitionlist.MkDefinitionList"]
  93860738687184["mkpage.MkPage"]
  93860739017392["mktemplatepage.MkTemplatePage"]
  93860739018384["mkclasspage.MkClassPage"]
  93860739885664["mkmodulepage.MkModulePage"]
  93860738689744["mkshowcase.MkShowcase"]
  93860738690736["mkspeechbubble.MkSpeechBubble"]
  93860738691728["mktasklist.MkTask"]
  93860739012720["mktasklist.MkTaskList"]
  93860739014496["mktimeline.MkTimeline"]
  93860738873792["mkshields.MkShields"]
  93860739080688["mkmetadatabadges.MkMetadataBadges"]
  93860744077920 --&gt; 93860744078912
  93860744078912 --&gt; 93860738712912
  93860744078912 --&gt; 93860738889984
  93860744078912 --&gt; 93860738695328
  93860744077920 --&gt; 93860738890976
  93860744077920 --&gt; 93860740371472
  93860744077920 --&gt; 93860742841280
  93860742841280 --&gt; 93860742534992
  93860742534992 --&gt; 93860740162176
  93860742534992 --&gt; 93860739173616
  93860742841280 --&gt; 93860740334656
  93860744077920 --&gt; 93860738888176
  93860738888176 --&gt; 93860742986000
  93860738888176 --&gt; 93860742945248
  93860738888176 --&gt; 93860742946240
  93860738888176 --&gt; 93860743870752
  93860738888176 --&gt; 93860742971840
  93860738888176 --&gt; 93860740316816
  93860738888176 --&gt; 93860743668384
  93860738888176 --&gt; 93860742514848
  93860738888176 --&gt; 93860742511520
  93860738888176 --&gt; 93860742513296
  93860738888176 --&gt; 93860743852160
  93860738888176 --&gt; 93860743856272
  93860738888176 --&gt; 93860743265184
  93860738888176 --&gt; 93860741615712
  93860738888176 --&gt; 93860740594544
  93860738888176 --&gt; 93860743226512
  93860738888176 --&gt; 93860738860160
  93860744077920 --&gt; 93860743872528
  93860744077920 --&gt; 93860740306432
  93860740306432 --&gt; 93860740242912
  93860740306432 --&gt; 93860740243904
  93860744077920 --&gt; 93860738696320
  93860744077920 --&gt; 93860738698096
  93860738698096 --&gt; 93860742988944
  93860738698096 --&gt; 93860742990720
  93860744077920 --&gt; 93860742992496
  93860744077920 --&gt; 93860743889648
  93860744077920 --&gt; 93860743892976
  93860744077920 --&gt; 93860743894752
  93860744077920 --&gt; 93860743895744
  93860744077920 --&gt; 93860742973616
  93860744077920 --&gt; 93860740301712
  93860744077920 --&gt; 93860738687184
  93860738687184 --&gt; 93860739017392
  93860739017392 --&gt; 93860739018384
  93860739017392 --&gt; 93860739885664
  93860744077920 --&gt; 93860738689744
  93860744077920 --&gt; 93860738690736
  93860744077920 --&gt; 93860738691728
  93860744077920 --&gt; 93860739012720
  93860744077920 --&gt; 93860739014496
  93860744077920 --&gt; 93860738873792
  93860744077920 --&gt; 93860739080688</code></pre>

Example: MRO diagram

Jinja

{{ _mk.MkTable | MkClassDiagram(mode="mro") }}

Python

MkClassDiagram(klass=MkTable, mode='mro', direction='TD')
graph TD
  93860740242912["mktable.MkTable"]
  93860740306432["mkbasetable.MkBaseTable"]
  93860744077920["mkcontainer.MkContainer"]
  93860744073616["mknode.MkNode"]
  93860744080896["node.Node"]
  140589822947552["builtins.object"]
  93860740242912 --> 93860740306432
  93860740306432 --> 93860744077920
  93860744077920 --> 93860744073616
  93860744073616 --> 93860744080896
  93860744080896 --> 140589822947552
```` mermaid
graph TD
  93860740242912["mktable.MkTable"]
  93860740306432["mkbasetable.MkBaseTable"]
  93860744077920["mkcontainer.MkContainer"]
  93860744073616["mknode.MkNode"]
  93860744080896["node.Node"]
  140589822947552["builtins.object"]
  93860740242912 --> 93860740306432
  93860740306432 --> 93860744077920
  93860744077920 --> 93860744073616
  93860744073616 --> 93860744080896
  93860744080896 --> 140589822947552
````
<pre class="mermaid"><code>graph TD
  93860740242912["mktable.MkTable"]
  93860740306432["mkbasetable.MkBaseTable"]
  93860744077920["mkcontainer.MkContainer"]
  93860744073616["mknode.MkNode"]
  93860744080896["node.Node"]
  140589822947552["builtins.object"]
  93860740242912 --&gt; 93860740306432
  93860740306432 --&gt; 93860744077920
  93860744077920 --&gt; 93860744073616
  93860744073616 --&gt; 93860744080896
  93860744080896 --&gt; 140589822947552</code></pre>

Bases: MkDiagram

__init__

__init__(
    klass: type | str | Class,
    mode: DiagramModeStr = "baseclasses",
    direction: Literal["TD", "DT", "LR", "RL"] = "TD",
    max_depth: int | None = None,
    **kwargs: Any
)

Parameters:

Name Type Description Default
klass type | str | Class

Klass to show a diagram for

required
mode DiagramModeStr

What kind of diagram to display

'baseclasses'
direction Literal['TD', 'DT', 'LR', 'RL']

diagram direction

'TD'
max_depth int | None

Maxium depth to display

None
kwargs Any

Keyword arguments passed to parent

{}
Name Children Inherits
MkDiagram
mknodes.basenodes.mkdiagram
Class representing a mermaid diagram.
graph TD
  93860740162176["mkclassdiagram.MkClassDiagram"]
  93860742534992["mkdiagram.MkDiagram"]
  93860742841280["mkcode.MkCode"]
  93860744077920["mkcontainer.MkContainer"]
  93860744073616["mknode.MkNode"]
  93860744080896["node.Node"]
  140589822947552["builtins.object"]
  93860742534992 --> 93860740162176
  93860742841280 --> 93860742534992
  93860744077920 --> 93860742841280
  93860744073616 --> 93860744077920
  93860744080896 --> 93860744073616
  140589822947552 --> 93860744080896
/home/runner/work/mknodes/mknodes/mknodes/templatenodes/mkclassdiagram/metadata.toml
[metadata]
icon = "mdi:graph-outline"
name = "MkClassDiagram"
group = "diagram"

[[requirements.extension."pymdownx.superfences".custom_fences]]
name = "mermaid"
class = "mermaid"
format = "pymdownx.superfences.fence_code_format"

[examples.baseclass_diagram]
title = "Baseclass diagram"
jinja = """
{{ _mk.MkClassDiagram | MkClassDiagram(mode="baseclasses") }}
"""

[examples.subclass_diagram]
title = "Subclass diagram"
jinja = """
{{ _mk.MkContainer | MkClassDiagram(mode="subclasses", direction="LR") }}
"""

[examples.mro_diagram]
title = "MRO diagram"
jinja = """
{{ _mk.MkTable | MkClassDiagram(mode="mro") }}
"""

[output.markdown]
template = """
{{ node.fence_boundary }} mermaid
graph {{ node.direction }}
{% for identifier, title in node.builder.items | zip(node.builder.titles) %}
  {{ identifier }}["{{ title }}"]
{% endfor %}
{% for a, b in node.builder.connections %}
  {{ a }} --> {{ b }}
{% endfor %}
{{ node.fence_boundary }}
"""
mknodes.templatenodes.mkclassdiagram.MkClassDiagram
class MkClassDiagram(mkdiagram.MkDiagram):
    """Node to display the class hierarchy of a class. Supports multiple modes."""

    def __init__(
        self,
        klass: type | str | griffe.Class,
        mode: DiagramModeStr = "baseclasses",
        direction: Literal["TD", "DT", "LR", "RL"] = "TD",
        max_depth: int | None = None,
        **kwargs: Any,
    ):
        """Constructor.

        Args:
            klass: Klass to show a diagram for
            mode: What kind of diagram to display
            direction: diagram direction
            max_depth: Maxium depth to display
            kwargs: Keyword arguments passed to parent
        """
        self.klass = klass
        self.mode = mode
        self._max_depth = max_depth
        super().__init__(direction=direction, **kwargs)

    def __repr__(self):
        return reprhelpers.get_repr(
            self,
            klass=self.klass,
            mode=self.mode,
            direction=self.direction,
        )

    @property
    def builder(self):
        klass = classhelpers.to_class(self.klass)
        match self.mode:
            case "subclasses":
                return SubclassConnector(klass, max_depth=self._max_depth)
            case "baseclasses":
                return ParentClassConnector(klass, max_depth=self._max_depth)
            case "mro":
                return MroConnector(klass, max_depth=self._max_depth)
            case _:
                raise ValueError(self.mode)

    @property
    def mermaid_code(self) -> str:
        return self.builder.get_graph_connection_text()