Flowchart 1

## devtools::install_github('rich-iannone/DiagrammeR')
library(DiagrammeR)
grViz("
digraph {

  # graph attributes
  graph [overlap = true]

  # node attributes
  node [shape = box,
        fontname = Helvetica,
        color = blue]

  # edge attributes
  edge [color = gray]

  # node statements
  A; B; C; D; E
  F [color = black]

  # node attributes
  node [shape = circle,
        fixedsize = true,
        width = 0.9]

  # node statements
  1; 2; 3; 4; 5; 6; 7; 8

  # edge statements
  A->1; B->2                   // gray
  B->3 [color = red]           // red
  B->4                         // gray
  C->A [color = green]         // green
  1->D; E->A; 2->4; 1->5; 1->F // gray
  E->6; 4->6; 5->7; 6->7       // gray
  3->8 [color = blue]          // blue
}
")

Flowchart 2

mermaid("
graph TB
  A-->B
  A-->C
  C-->E
  B-->D
  C-->D
  D-->F
  E-->F
")

Flowchart 3

mermaid("
graph TB
    sq[Square shape] --> ci((Circle shape))

    subgraph A subgraph
        od>Odd shape]-- Two line<br>edge comment --> ro
        di{Diamond with <br/> line break} -.-> ro(Rounded<br>square<br>shape)
        di==>ro2(Rounded square shape)
    end

    %% Notice that no text in shape are added here instead that is appended further down
    e --> od3>Really long text with linebreak<br>in an Odd shape]

    %% Comments after double percent signs
    e((Inner / circle<br>and some odd <br>special characters)) --> f(,.?!+-*ز)

    cyr[Cyrillic]-->cyr2((Circle shape Начало));

     classDef green fill:#9f6,stroke:#333,stroke-width:2px;
     classDef orange fill:#f96,stroke:#333,stroke-width:4px;
     class sq,e green
     class di orange
")

Sequence Diagram 1

mermaid("
sequenceDiagram
  customer->>ticket seller: ask ticket
  ticket seller->>database: seats
  alt tickets available
    database->>ticket seller: ok
    ticket seller->>customer: confirm
    customer->>ticket seller: ok
    ticket seller->>database: book a seat
    ticket seller->>printer: print ticket
  else sold out
    database->>ticket seller: none left
    ticket seller->>customer: sorry
  end
")

Sequence Diagram 2

mermaid("
sequenceDiagram
    Alice ->> Bob: Hello Bob, how are you?
    Bob-->>John: How about you John?
    Bob--x Alice: I am good thanks!
    Bob-x John: I am good thanks!
    Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row.

    Bob-->Alice: Checking with John...
    Alice->John: Yes... John, how are you?
")

Sequence Diagram 3

mermaid("
sequenceDiagram
    loop Daily query
        Alice->>Bob: Hello Bob, how are you?
        alt is sick
            Bob->>Alice: Not so good :(
        else is well
            Bob->>Alice: Feeling fresh like a daisy
        end

        opt Extra response
            Bob->>Alice: Thanks for asking
        end
    end
")

Sequence Diagram 4

mermaid("
sequenceDiagram
    participant Problem Statement
    participant Proof of Concept
    participant Tool Development
    participant Technology Transfer
    Problem Statement->>Proof of Concept: Check the effectiveness
    Proof of Concept->>Tool Development: If effective, develop the tool
    Tool Development->>Technology Transfer: Perform technology transfer 
    Technology Transfer->>Commercial Product: Develop the product
    Problem Statement-->Commercial Product: Theory to product
    loop Checksheet
        Proof of Concept->>Proof of Concept: Emphasis on benefit-cost ratio and crash         reduction
    end
    loop Checksheet
        Tool Development->>Tool Development: Emphasis on cost and effectiveness
    end
    loop Checksheet
        Technology Transfer->>Technology Transfer: Emphasis on product licensing 
    end
    Note right of Commercial Product: Product in<br/>market...
    Commercial Product-->>Problem Statement: Need to be specific towards solution
    Commercial Product-->>Proof of Concept: Use social media for research result
    Commercial Product-->>Tool Development: Integrate benefits and advantages
")

Gantt Chart 1

mermaid("
gantt
        dateFormat  YYYY-MM-DD
        title Adding GANTT diagram functionality to mermaid

        section A section
        Completed task            :done,    des1, 2014-01-06,2014-01-08
        Active task               :active,  des2, 2014-01-09, 3d
        Future task               :         des3, after des2, 5d
        Future task2               :         des4, after des3, 5d

        section Critical tasks
        Completed task in the critical line :crit, done, 2014-01-06,24h
        Implement parser and jison          :crit, done, after des1, 2d
        Create tests for parser             :crit, active, 3d
        Future task in critical line        :crit, 5d
        Create tests for renderer           :2d
        Add to mermaid                      :1d

        section Documentation
        Describe gantt syntax               :active, a1, after des1, 3d
        Add gantt diagram to demo page      :after a1  , 20h
        Add another diagram to demo page    :doc1, after a1  , 48h

        section Last section
        Describe gantt syntax               :after doc1, 3d
        Add gantt diagram to demo page      : 20h
        Add another diagram to demo page    : 48h
")