Skip to content

Latest commit

 

History

History
114 lines (95 loc) · 3.14 KB

EXAMPLES.md

File metadata and controls

114 lines (95 loc) · 3.14 KB

Examples

Graph/Workflow

Creating a Node

$Node1 = New-MermaidGraphNode -Shape Parallelogram -ID ID1 -Text "Frankfurt am Main"
#   Output: ID1[/Frankfurt am Main/]
graph LR
    ID1[/Frankfurt am Main/]
Loading

Creating another Node

$Node2 = New-MermaidGraphNode -Shape DoubleCircle -ID ID2 -Text "PSConfEU$((Get-Date).Year +1)"
#   Output: ID2(((PSConfEU2024)))
graph LR
    ID2(((PSConfEU2024)))
Loading

Creating a Link

$Link = New-MermaidGraphLink -Text "traveling to:" -Linktype ArrowLink
#   Output: -->|traveling to:|
graph LR
    A-->|traveling to:|B
Loading

Creating a Connection

$Connection = New-MermaidGraphNodeConnection -FirstNode $Node1 -SecondNode $Node2 -Link $Link
#   Output: ID1[/Frankfurt am Main/]-->|traveling to:|ID2(((PSConfEU2024)))
graph LR
    ID1[/Frankfurt am Main/]-->|traveling to:|ID2(((PSConfEU2024)))
Loading

Creating a Graph

$Graph = New-MermaidGraph -Direction LR -NodeConnections $Connection
<#  Outpout:
        \`\`\`mermaid
        graph LR
                ID1[/Frankfurt am Main/]-->|traveling to:|ID2(((PSConfEU2024)))
        \`\`\`
#>
graph LR
        ID1[/Frankfurt am Main/]-->|traveling to:|ID2(((PSConfEU2024)))
Loading

Creating another Graph in one big step

New-MermaidGraph -Direction LR -NodeConnections @(
    $(
        $newMermaidNodeConnectionSplat = @{
            FirstNode = $(New-MermaidGraphNode -Shape RoundEdges -ID ID1 -Text "Frankfurt am Main")
            SecondNode = $(New-MermaidGraphNode -Shape DoubleCircle -ID ID2 -Text "PSConfEU$((Get-Date).Year +1)")
            Link = $(New-MermaidGraphLink -Text "traveling to:" -Linktype ArrowLink)
        }
        New-MermaidGraphNodeConnection @newMermaidNodeConnectionSplat
    ),
    $(
        $newMermaidNodeConnectionSplat = @{
            FirstNode = $(New-MermaidGraphNode -Shape DoubleCircle -ID ID2 -Text "PSConfEU$((Get-Date).Year +1)")
            SecondNode = $(New-MermaidGraphNode -Shape subroutine -ID ID3 -Text "Enjoying for 4 Days")
            Link = $(New-MermaidGraphLink -Linktype DottedLink)
        }
        New-MermaidGraphNodeConnection @newMermaidNodeConnectionSplat
    ),
    $(
        $newMermaidNodeConnectionSplat = @{
            FirstNode = $(New-MermaidGraphNode -Shape DoubleCircle -ID ID2 -Text "PSConfEU$((Get-Date).Year +1)")
            SecondNode = $(New-MermaidGraphNode -Shape RoundEdges -ID ID1 -Text "Frankfurt am Main")
            Link = $(New-MermaidGraphLink -Text "traveling home:" -Linktype ArrowLink)
        }
        New-MermaidGraphNodeConnection @newMermaidNodeConnectionSplat
    )
)
<# Outpout:
\`\`\`mermaid
graph LR
        ID1(Frankfurt am Main)-->|traveling to:|ID2(((PSConfEU2024)))
        ID2(((PSConfEU2024)))-.->ID3[[Enjoying for 4 Days]]
        ID2(((PSConfEU2024)))-->|traveling home:|ID1(Frankfurt am Main)
\`\`\`
#>
graph LR
        ID1(Frankfurt am Main)-->|traveling to:|ID2(((PSConfEU2024)))
        ID2(((PSConfEU2024)))-.->ID3[[Enjoying for 4 Days]]
        ID2(((PSConfEU2024)))-->|traveling home:|ID1(Frankfurt am Main)
Loading