Skip to content

Latest commit

 

History

History
382 lines (315 loc) · 9.62 KB

readme.md

File metadata and controls

382 lines (315 loc) · 9.62 KB

Mermaid syntax references

A rewrite of the Mermaid documentation as a learning aid and cheatsheet.

ExampleCode
graph TD;
  subgraph Input_Types
    Agent_Identification("Agent Identification")
    Agent_Identification-->Agent_Name("Agent Name")
    Agent_Identification-->Operating_System("Operating System")
    Agent_Identification-->Software_Version("Software Version")
    Agent_Identification-->Network_Location("Network Location")
    Agent_Identification-->Description("Description")
    
    Vulnerabilities("Vulnerabilities")
    Vulnerabilities-->Security_Weaknesses("Security Weaknesses")
    Vulnerabilities-->Attack_Techniques("Attack Techniques")
    
    Attack_Techniques-->Exploit_Type("Exploit Type")
    Attack_Techniques-->Payload("Payload")
    Attack_Techniques-->Attack_Vector("Attack Vector")
    Attack_Techniques-->Potential_Impact("Potential Impact")
    Attack_Techniques-->Difficulty_Level("Difficulty Level")
    
    Defense_Strategies("Defense Strategies")
    Defense_Strategies-->Countermeasures("Countermeasures")
    Defense_Strategies-->Agent_Types("Agent Types")
  end

  subgraph Subcategories
    Agent_Types("Agent Types")
    Security_Weaknesses("Security Weaknesses")
    Exploits("Exploits")
    Countermeasures("Countermeasures")
    Attack_Scenarios("Attack Scenarios")
    Audience_Demographics("Audience Demographics")
    Interests("Interests")
    Emotions("Emotions")
    Branding("Branding")
    Generated_Hashtags("Generated Hashtags")
  end
  
  subgraph Pipeline
    Agent_Identification2("Agent Identification")
    Agent_Identification2-->Agent_Name2("Agent Name")
    Agent_Identification2-->Operating_System2("Operating System")
    Agent_Identification2-->Software_Version2("Software Version")
    Agent_Identification2-->Network_Location2("Network Location")
    Agent_Identification2-->Description2("Description")
    
    Vulnerabilities2("Vulnerabilities")
    Vulnerabilities2-->Security_Weaknesses2("Security Weaknesses")
    Vulnerabilities2-->Attack_Techniques2("Attack Techniques")
    
    Attack_Techniques2-->Exploit_Type2("Exploit Type")
    Attack_Techniques2-->Payload2("Payload")
    Attack_Techniques2-->Attack_Vector2("Attack Vector")
    Attack_Techniques2-->Potential_Impact2("Potential Impact")
    Attack_Techniques2-->Difficulty_Level2("Difficulty Level")
    
    Defense_Strategies2("Defense Strategies")
    Defense_Strategies2-->Countermeasures2("Countermeasures")
    Defense_Strategies2-->Agent_Types2("Agent Types")
    
    Attack_Scenarios2("Attack Scenarios")
    Attack_Scenarios2-->Agent_Types2
    Attack_Scenarios2-->Security_Weaknesses2
    Attack_Scenarios2-->Exploits2
    Attack_Scenarios2-->Countermeasures2

    Audience_Demographics2("Audience Demographics")
    Audience_Demographics2-->Age_Range("Age Range")
    Audience_Demographics2-->Gender_Distribution("Gender Distribution")
    Audience_Demographics2-->Interests2("Interests")

    Interests2("Interests")
    Emotions2("Emotions")
    Branding2("Branding")
end
style Attack_Scenarios2 fill:#66b3ff,stroke:#0080ff,stroke-width:2px,color:#fff;
style Agent_Types2 fill:#33ccff,stroke:#0080ff,stroke-width:2px,color:#fff;
style Security_Weaknesses2 fill:#33ccff,stroke:#0080ff,stroke-width:2px,color:#fff;
style Exploits2 fill:#33ccff,stroke:#0080ff,stroke-width:2px,color:#fff;
style Countermeasures2 fill:#33ccff,stroke:#0080ff,stroke-width:2px,color:#fff;
style Generated_Hashtags2 fill:#33ccff,stroke:#0080ff,stroke-width:2px,color:#fff;
style Agent_Identification2 fill:#b3e6ff,stroke:#0080ff,stroke-width:2px,color:#000;
style Agent_Name2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Operating_System2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Software_Version2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Network_Location2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Description2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Vulnerabilities2 fill:#b3e6ff,stroke:#0080ff,stroke-width:2px,color:#000;
style Attack_Techniques2 fill:#b3e6ff,stroke:#0080ff,stroke-width:2px,color:#000;
style Exploit_Type2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Payload2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Attack_Vector2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Potential_Impact2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Difficulty_Level2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Defense_Strategies2 fill:#b3e6ff,stroke:#0080ff,stroke-width:2px,color:#000;
style Audience_Demographics2 fill:#b3e6ff,stroke:#0080ff,stroke-width:2px,color:#000;
style Age_Range fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Gender_Distribution fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Interests2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Emotions2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;
style Branding2 fill:#c2c2d6,stroke:#000,stroke-width:2px,color:#000;

Loading
flowchart LR
    A[Start] --> B{Should you?}
    B -- Yes --> C{{Do it}}
    B -- Maybe --> D[(Save for later)]
    B -- No --> E[Okay]

Flowchart in Mermaid cheatsheet

sequenceDiagram
    Alice ->>+ Bob: Here's a message!
    Bob ->>- Alice: Hmm, ok, thanks.
Loading
sequenceDiagram
    Alice ->>+ Bob: Here's a message!
    Bob ->>- Alice: Hmm, ok, thanks.

Sequence diagram in Mermaid cheatsheet

classDiagram
    class ClassName {
        String stringName
        Long longName
        MyDatatype attributeName

        functionName(parameter) ReturnType
        functionName2(parameter2) ReturnType
    }
    class Interface {
        Int intName
    }
    ClassName --|> Interface
Loading
classDiagram
    class ClassName {
        String stringName
        Long longName
        MyDatatype attributeName

        functionName(parameter) ReturnType
        functionName2(parameter2) ReturnType
    }
    class Interface {
        Int intName
    }
    ClassName --|> Interface

Class diagram in Mermaid cheatsheet

stateDiagram-v2
    Stationary --> Moving : Begin moving
    Moving --> Stationary : Stop moving
Loading
stateDiagram-v2
    Stationary --> Moving : Begin moving
    Moving --> Stationary : Stop moving

State diagram in Mermaid cheatsheet

erDiagram
    User {
        Int id PK
        String username
        Int serverId FK
    }

    Server {
        Int id PK
        String serverName
    }

    Server ||--o{ User : has
Loading
erDiagram
    User {
        Int id PK
        String username
        Int serverId FK
    }

    Server {
        Int id PK
        String serverName
    }

    Server ||--o{ User : has

Entity relationship diagram in Mermaid cheatsheet

journey
    title User Journey
    section Logging in
        Navigate to login: 4: Alice, Bob, Craig
        Entering details: 2: Alice, Bob
        Pressing button: 5: Alice
Loading
journey
    title User Journey
    section Logging in
        Navigate to login: 4: Alice, Bob, Craig
        Entering details: 2: Alice, Bob
        Pressing button: 5: Alice

User journey diagram in Mermaid cheatsheet

gantt
    Dated Milestone: milestone, m1, today, 1d
    Relative Milestone: milestone, m2, after m1, 1d
    Task 1: a1, today, 1d
    Task 2: a2, after a1, 1d
    Task 3: a3, today, 36hr
Loading
gantt
    Dated Milestone: milestone, m1, today, 1d
    Relative Milestone: milestone, m2, after m1, 1d
    Task 1: a1, today, 1d
    Task 2: a2, after a1, 1d
    Task 3: a3, today, 36hr

Gantt chart in Mermaid cheatsheet

pie
    title Fruits
    "Apples" : 50
    "Oranges" : 20
    "Grapes" : 9.99
    "Passionfruits" : 12.5
Loading
pie
    title Fruits
    "Apples" : 50
    "Oranges" : 20
    "Grapes" : 9.99
    "Passionfruits" : 12.5

Pie chart in Mermaid cheatsheet

    requirementDiagram

    requirement UptimeRequirement {
        id: 1
        text: Site Uptime 
        risk: Medium
        verifymethod: Analysis
    }

    element satisfyingElement {
        type: MyElement
        docref: ABC001
    }

    element containingElement {
        type: MyElement
        docref: ABC002
    }

    satisfyingElement - satisfies -> UptimeRequirement
    containingElement - contains -> UptimeRequirement
Loading
    requirementDiagram

    requirement UptimeRequirement {
        id: 1
        text: Site Uptime 
        risk: Medium
        verifymethod: Analysis
    }

    element satisfyingElement {
        type: MyElement
        docref: ABC001
    }

    element containingElement {
        type: MyElement
        docref: ABC002
    }

    satisfyingElement - satisfies -> UptimeRequirement
    containingElement - contains -> UptimeRequirement

Requirement diagram in Mermaid cheatsheet

gitGraph BT:
    commit
    branch branch2
    checkout branch2
    commit
    checkout main
    commit
    merge branch2
Loading
gitGraph BT:
    commit
    branch branch2
    checkout branch2
    commit
    checkout main
    commit
    merge branch2

Git graphs in Mermaid cheatsheet