ox]?|(?:==+|--+|-\.*-)[>ox]|===+|---+|-\.+-)(?![<>ox.=-])/,lookbehind:!0,alias:"operator"},{pattern:/(^|[^<>()x-])(?:--?(?:>>|[x>)])(?![<>()x])|(?:<<|[x<(])--?(?!-))/,lookbehind:!0,alias:"operator"},{pattern:/(^|[^<>|*o.-])(?:[*o]--|--[*o]|<\|?(?:--|\.\.)|(?:--|\.\.)\|?>|--|\.\.)(?![<>|*o.-])/,lookbehind:!0,alias:"operator"}],label:{pattern:/(^|[^|<])\|(?:[^\r\n"|]|"[^"\r\n]*")+\|/,lookbehind:!0,greedy:!0,alias:"property"},text:{pattern:/(?:[(\[{]+|\b>)(?:[^\r\n"()\[\]{}]|"[^"\r\n]*")+(?:[)\]}]+|>)/,alias:"string"},string:{pattern:/"[^"\r\n]*"/,greedy:!0},annotation:{pattern:/<<(?:abstract|choice|enumeration|fork|interface|join|service)>>|\[\[(?:choice|fork|join)\]\]/i,alias:"important"},keyword:[{pattern:/(^[ \t]*)(?:action|callback|class|classDef|classDiagram|click|direction|erDiagram|flowchart|gantt|gitGraph|graph|journey|link|linkStyle|pie|requirementDiagram|sequenceDiagram|stateDiagram|stateDiagram-v2|style|subgraph)(?![\w$-])/m,lookbehind:!0,greedy:!0},{pattern:/(^[ \t]*)(?:activate|alt|and|as|autonumber|deactivate|else|end(?:[ \t]+note)?|loop|opt|par|participant|rect|state|note[ \t]+(?:over|(?:left|right)[ \t]+of))(?![\w$-])/im,lookbehind:!0,greedy:!0}],entity:/#[a-z0-9]+;/,operator:{pattern:/(\w[ \t]*)&(?=[ \t]*\w)|:::|:/,lookbehind:!0},punctuation:/[(){};]/};
\ No newline at end of file
diff --git a/examples/prism-mermaid.html b/examples/prism-mermaid.html
new file mode 100644
index 0000000000..c379bf27b5
--- /dev/null
+++ b/examples/prism-mermaid.html
@@ -0,0 +1,25 @@
+Full example
+%% https://github.com/mermaid-js/mermaid/blob/develop/docs/examples.md#larger-flowchart-with-some-styling
+
+graph TB
+ sq[Square shape] --> ci((Circle shape))
+
+ subgraph A
+ 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
+
diff --git a/tests/languages/mermaid/arrow_feature.test b/tests/languages/mermaid/arrow_feature.test
new file mode 100644
index 0000000000..6205a313ff
--- /dev/null
+++ b/tests/languages/mermaid/arrow_feature.test
@@ -0,0 +1,125 @@
+%% flow chart
+
+--- ---- -----
+--> ---> ---->
+<-- <--- <----
+=== ==== =====
+==> ===> ====>
+<== <=== <====
+-.- -..- -...-
+-.-> -..-> -...->
+<-.- <-..- <-...-
+--x ---x ----x
+--x -.-x -..-x
+x-- x--- x----
+x-- x-.- x-..-
+--o ---o ----o
+--o -.-o -..-o
+o-- o--- o----
+o-- o-.- o-..-
+
+<--> <----> <-..-> <====>
+x--x x----x x-..-x x====x
+o--o o----o o-..-o o====o
+
+%% sequence diagram
+
+-> --> ->> -->>
+<- <-- <<- <<--
+-x --x -) --)
+x- x-- (- (--
+
+%% class diagram
+
+<|-- *-- o-- <-- <.. <|..
+--|> --* --o --> ..> ..|>
+-- ..
+
+%% ER diagram
+
+|o--o| |o..o|
+||--|| ||..||
+}o--o{ }o..o{
+}|--|{ }|..|{
+
+|o--o| |o..o|
+||--o{ ||..o{
+}o--|{ }o..|{
+}|--|| }|..||
+
+----------------------------------------------------
+
+[
+ ["comment", "%% flow chart"],
+
+ ["arrow", "---"], ["arrow", "----"], ["arrow", "-----"],
+ ["arrow", "-->"], ["arrow", "--->"], ["arrow", "---->"],
+ ["arrow", "<--"], ["arrow", "<---"], ["arrow", "<----"],
+ ["arrow", "==="], ["arrow", "===="], ["arrow", "====="],
+ ["arrow", "==>"], ["arrow", "===>"], ["arrow", "====>"],
+ ["arrow", "<=="], ["arrow", "<==="], ["arrow", "<===="],
+ ["arrow", "-.-"], ["arrow", "-..-"], ["arrow", "-...-"],
+ ["arrow", "-.->"], ["arrow", "-..->"], ["arrow", "-...->"],
+ ["arrow", "<-.-"], ["arrow", "<-..-"], ["arrow", "<-...-"],
+ ["arrow", "--x"], ["arrow", "---x"], ["arrow", "----x"],
+ ["arrow", "--x"], ["arrow", "-.-x"], ["arrow", "-..-x"],
+ ["arrow", "x--"], ["arrow", "x---"], ["arrow", "x----"],
+ ["arrow", "x--"], ["arrow", "x-.-"], ["arrow", "x-..-"],
+ ["arrow", "--o"], ["arrow", "---o"], ["arrow", "----o"],
+ ["arrow", "--o"], ["arrow", "-.-o"], ["arrow", "-..-o"],
+ ["arrow", "o--"], ["arrow", "o---"], ["arrow", "o----"],
+ ["arrow", "o--"], ["arrow", "o-.-"], ["arrow", "o-..-"],
+
+ ["arrow", "<-->"],
+ ["arrow", "<---->"],
+ ["arrow", "<-..->"],
+ ["arrow", "<====>"],
+
+ ["arrow", "x--x"],
+ ["arrow", "x----x"],
+ ["arrow", "x-..-x"],
+ ["arrow", "x====x"],
+
+ ["arrow", "o--o"],
+ ["arrow", "o----o"],
+ ["arrow", "o-..-o"],
+ ["arrow", "o====o"],
+
+ ["comment", "%% sequence diagram"],
+
+ ["arrow", "->"], ["arrow", "-->"], ["arrow", "->>"], ["arrow", "-->>"],
+ ["arrow", "<-"], ["arrow", "<--"], ["arrow", "<<-"], ["arrow", "<<--"],
+ ["arrow", "-x"], ["arrow", "--x"], ["arrow", "-)"], ["arrow", "--)"],
+ ["arrow", "x-"], ["arrow", "x--"], ["arrow", "(-"], ["arrow", "(--"],
+
+ ["comment", "%% class diagram"],
+
+ ["arrow", "<|--"],
+ ["arrow", "*--"],
+ ["arrow", "o--"],
+ ["arrow", "<--"],
+ ["arrow", "<.."],
+ ["arrow", "<|.."],
+
+ ["arrow", "--|>"],
+ ["arrow", "--*"],
+ ["arrow", "--o"],
+ ["arrow", "-->"],
+ ["arrow", "..>"],
+ ["arrow", "..|>"],
+
+ ["arrow", "--"],
+ ["arrow", ".."],
+
+ ["comment", "%% ER diagram"],
+
+ ["arrow", "|o--o|"], ["arrow", "|o..o|"],
+ ["arrow", "||--||"], ["arrow", "||..||"],
+ ["arrow", "}o--o{"], ["arrow", "}o..o{"],
+ ["arrow", "}|--|{"], ["arrow", "}|..|{"],
+
+ ["arrow", "|o--o|"], ["arrow", "|o..o|"],
+ ["arrow", "||--o{"], ["arrow", "||..o{"],
+ ["arrow", "}o--|{"], ["arrow", "}o..|{"],
+ ["arrow", "}|--||"], ["arrow", "}|..||"]
+]
diff --git a/tests/languages/mermaid/comment_feature.test b/tests/languages/mermaid/comment_feature.test
new file mode 100644
index 0000000000..90b8493fba
--- /dev/null
+++ b/tests/languages/mermaid/comment_feature.test
@@ -0,0 +1,7 @@
+%% comment
+
+----------------------------------------------------
+
+[
+ ["comment", "%% comment"]
+]
diff --git a/tests/languages/mermaid/full_classdiagram.test b/tests/languages/mermaid/full_classdiagram.test
new file mode 100644
index 0000000000..e612373f67
--- /dev/null
+++ b/tests/languages/mermaid/full_classdiagram.test
@@ -0,0 +1,656 @@
+classDiagram
+ Animal <|-- Duck
+ Animal <|-- Fish
+ Animal <|-- Zebra
+ Animal : +int age
+ Animal : +String gender
+ Animal: +isMammal()
+ Animal: +mate()
+ class Duck{
+ +String beakColor
+ +swim()
+ +quack()
+ }
+ class Fish{
+ -int sizeInFeet
+ -canEat()
+ }
+ class Zebra{
+ +bool is_wild
+ +run()
+ }
+
+classDiagram
+ class BankAccount
+ BankAccount : +String owner
+ BankAccount : +Bigdecimal balance
+ BankAccount : +deposit(amount)
+ BankAccount : +withdrawl(amount)
+
+classDiagram
+ class Animal
+ Vehicle <|-- Car
+
+class BankAccount
+ BankAccount : +String owner
+ BankAccount : +BigDecimal balance
+ BankAccount : +deposit(amount)
+ BankAccount : +withdrawal(amount)
+
+class BankAccount{
+ +String owner
+ +BigDecimal balance
+ +deposit(amount)
+ +withdrawl(amount)
+}
+
+class BankAccount{
+ +String owner
+ +BigDecimal balance
+ +deposit(amount) bool
+ +withdrawl(amount) int
+}
+
+classDiagram
+class Square~Shape~{
+ int id
+ List~int~ position
+ setPoints(List~int~ points)
+ getPoints() List~int~
+}
+
+Square : -List~string~ messages
+Square : +setMessages(List~string~ messages)
+Square : +getMessages() List~string~
+
+classDiagram
+classA <|-- classB
+classC *-- classD
+classE o-- classF
+classG <-- classH
+classI -- classJ
+classK <.. classL
+classM <|.. classN
+classO .. classP
+
+classDiagram
+classA --|> classB : Inheritance
+classC --* classD : Composition
+classE --o classF : Aggregation
+classG --> classH : Association
+classI -- classJ : Link(Solid)
+classK ..> classL : Dependency
+classM ..|> classN : Realization
+classO .. classP : Link(Dashed)
+
+classDiagram
+classA <|-- classB : implements
+classC *-- classD : composition
+classE o-- classF : association
+
+classDiagram
+ Customer "1" --> "*" Ticket
+ Student "1" --> "1..*" Course
+ Galaxy --> "many" Star : Contains
+
+classDiagram
+class Shape
+<> Shape
+
+classDiagram
+class Shape{
+ <>
+ noOfVertices
+ draw()
+}
+class Color{
+ <>
+ RED
+ BLUE
+ GREEN
+ WHITE
+ BLACK
+}
+
+classDiagram
+%% This whole line is a comment classDiagram class Shape <>
+class Shape{
+ <>
+ noOfVertices
+ draw()
+}
+
+classDiagram
+ direction RL
+ class Student {
+ -idCard : IdCard
+ }
+ class IdCard{
+ -id : int
+ -name : string
+ }
+ class Bike{
+ -id : int
+ -name : string
+ }
+ Student "1" --o "1" IdCard : carries
+ Student "1" --o "1" Bike : rides
+
+action className "reference" "tooltip"
+click className call callback() "tooltip"
+click className href "url" "tooltip"
+
+classDiagram
+class Shape
+link Shape "http://www.github.com" "This is a tooltip for a link"
+class Shape2
+click Shape2 href "http://www.github.com" "This is a tooltip for a link"
+
+classDiagram
+class Shape
+callback Shape "callbackFunction" "This is a tooltip for a callback"
+class Shape2
+click Shape2 call callbackFunction() "This is a tooltip for a callback"
+
+classDiagram
+Animal <|-- Duck
+Animal <|-- Fish
+Animal <|-- Zebra
+Animal : +int age
+Animal : +String gender
+Animal: +isMammal()
+Animal: +mate()
+class Duck{
+ +String beakColor
+ +swim()
+ +quack()
+ }
+class Fish{
+ -int sizeInFeet
+ -canEat()
+ }
+class Zebra{
+ +bool is_wild
+ +run()
+ }
+
+ callback Duck callback "Tooltip"
+ link Zebra "http://www.github.com" "This is a link"
+
+classDiagram
+ class Animal:::cssClass
+
+classDiagram
+ class Animal:::cssClass {
+ -int sizeInFeet
+ -canEat()
+ }
+
+----------------------------------------------------
+
+[
+ ["keyword", "classDiagram"],
+
+ "\r\n Animal ",
+ ["arrow", "<|--"],
+ " Duck\r\n Animal ",
+ ["arrow", "<|--"],
+ " Fish\r\n Animal ",
+ ["arrow", "<|--"],
+ " Zebra\r\n Animal ",
+ ["operator", ":"],
+ " +int age\r\n Animal ",
+ ["operator", ":"],
+ " +String gender\r\n Animal",
+ ["operator", ":"],
+ " +isMammal",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ "\r\n Animal",
+ ["operator", ":"],
+ " +mate",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["keyword", "class"],
+ " Duck",
+ ["punctuation", "{"],
+
+ "\r\n +String beakColor\r\n +swim",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ "\r\n +quack",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "class"],
+ " Fish",
+ ["punctuation", "{"],
+
+ "\r\n -int sizeInFeet\r\n -canEat",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "class"],
+ " Zebra",
+ ["punctuation", "{"],
+
+ "\r\n +bool is_wild\r\n +run",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "classDiagram"],
+
+ ["keyword", "class"],
+ " BankAccount\r\n BankAccount ",
+ ["operator", ":"],
+ " +String owner\r\n BankAccount ",
+ ["operator", ":"],
+ " +Bigdecimal balance\r\n BankAccount ",
+ ["operator", ":"],
+ " +deposit",
+ ["text", "(amount)"],
+
+ "\r\n BankAccount ",
+ ["operator", ":"],
+ " +withdrawl",
+ ["text", "(amount)"],
+
+ ["keyword", "classDiagram"],
+
+ ["keyword", "class"],
+ " Animal\r\n Vehicle ",
+ ["arrow", "<|--"],
+ " Car\r\n\r\n",
+
+ ["keyword", "class"],
+ " BankAccount\r\n BankAccount ",
+ ["operator", ":"],
+ " +String owner\r\n BankAccount ",
+ ["operator", ":"],
+ " +BigDecimal balance\r\n BankAccount ",
+ ["operator", ":"],
+ " +deposit",
+ ["text", "(amount)"],
+
+ "\r\n BankAccount ",
+ ["operator", ":"],
+ " +withdrawal",
+ ["text", "(amount)"],
+
+ ["keyword", "class"],
+ " BankAccount",
+ ["punctuation", "{"],
+
+ "\r\n +String owner\r\n +BigDecimal balance\r\n +deposit",
+ ["text", "(amount)"],
+
+ "\r\n +withdrawl",
+ ["text", "(amount)"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "class"],
+ " BankAccount",
+ ["punctuation", "{"],
+
+ "\r\n +String owner\r\n +BigDecimal balance\r\n +deposit",
+ ["text", "(amount)"],
+ " bool\r\n +withdrawl",
+ ["text", "(amount)"],
+ " int\r\n",
+
+ ["punctuation", "}"],
+
+ ["keyword", "classDiagram"],
+
+ ["keyword", "class"],
+ " Square~Shape~",
+ ["punctuation", "{"],
+
+ "\r\n int id\r\n List~int~ position\r\n setPoints",
+ ["text", "(List~int~ points)"],
+
+ "\r\n getPoints",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+ " List~int~\r\n",
+
+ ["punctuation", "}"],
+
+ "\r\n\r\nSquare ",
+ ["operator", ":"],
+ " -List~string~ messages\r\nSquare ",
+ ["operator", ":"],
+ " +setMessages",
+ ["text", "(List~string~ messages)"],
+
+ "\r\nSquare ",
+ ["operator", ":"],
+ " +getMessages",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+ " List~string~\r\n\r\n",
+
+ ["keyword", "classDiagram"],
+
+ "\r\nclassA ",
+ ["arrow", "<|--"],
+ " classB\r\nclassC ",
+ ["arrow", "*--"],
+ " classD\r\nclassE ",
+ ["arrow", "o--"],
+ " classF\r\nclassG ",
+ ["arrow", "<--"],
+ " classH\r\nclassI ",
+ ["arrow", "--"],
+ " classJ\r\nclassK ",
+ ["arrow", "<.."],
+ " classL\r\nclassM ",
+ ["arrow", "<|.."],
+ " classN\r\nclassO ",
+ ["arrow", ".."],
+ " classP\r\n\r\n",
+
+ ["keyword", "classDiagram"],
+
+ "\r\nclassA ",
+ ["arrow", "--|>"],
+ " classB ",
+ ["operator", ":"],
+ " Inheritance\r\nclassC ",
+ ["arrow", "--*"],
+ " classD ",
+ ["operator", ":"],
+ " Composition\r\nclassE ",
+ ["arrow", "--o"],
+ " classF ",
+ ["operator", ":"],
+ " Aggregation\r\nclassG ",
+ ["arrow", "-->"],
+ " classH ",
+ ["operator", ":"],
+ " Association\r\nclassI ",
+ ["arrow", "--"],
+ " classJ ",
+ ["operator", ":"],
+ " Link",
+ ["text", "(Solid)"],
+
+ "\r\nclassK ",
+ ["arrow", "..>"],
+ " classL ",
+ ["operator", ":"],
+ " Dependency\r\nclassM ",
+ ["arrow", "..|>"],
+ " classN ",
+ ["operator", ":"],
+ " Realization\r\nclassO ",
+ ["arrow", ".."],
+ " classP ",
+ ["operator", ":"],
+ " Link",
+ ["text", "(Dashed)"],
+
+ ["keyword", "classDiagram"],
+
+ "\r\nclassA ",
+ ["arrow", "<|--"],
+ " classB ",
+ ["operator", ":"],
+ " implements\r\nclassC ",
+ ["arrow", "*--"],
+ " classD ",
+ ["operator", ":"],
+ " composition\r\nclassE ",
+ ["arrow", "o--"],
+ " classF ",
+ ["operator", ":"],
+ " association\r\n\r\n",
+
+ ["keyword", "classDiagram"],
+
+ "\r\n Customer ",
+ ["string", "\"1\""],
+ ["arrow", "-->"],
+ ["string", "\"*\""],
+ " Ticket\r\n Student ",
+ ["string", "\"1\""],
+ ["arrow", "-->"],
+ ["string", "\"1..*\""],
+ " Course\r\n Galaxy ",
+ ["arrow", "-->"],
+ ["string", "\"many\""],
+ " Star ",
+ ["operator", ":"],
+ " Contains\r\n\r\n",
+
+ ["keyword", "classDiagram"],
+ ["keyword", "class"], " Shape\r\n",
+ ["annotation", "<>"], " Shape\r\n\r\n",
+
+ ["keyword", "classDiagram"],
+ ["keyword", "class"],
+ " Shape",
+ ["punctuation", "{"],
+ ["annotation", "<>"],
+ "\r\n noOfVertices\r\n draw",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+ ["punctuation", "}"],
+ ["keyword", "class"],
+ " Color",
+ ["punctuation", "{"],
+ ["annotation", "<>"],
+ "\r\n RED\r\n BLUE\r\n GREEN\r\n WHITE\r\n BLACK\r\n",
+ ["punctuation", "}"],
+
+ ["keyword", "classDiagram"],
+ ["comment", "%% This whole line is a comment classDiagram class Shape <>"],
+ ["keyword", "class"],
+ " Shape",
+ ["punctuation", "{"],
+ ["annotation", "<>"],
+ "\r\n noOfVertices\r\n draw",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+ ["punctuation", "}"],
+
+ ["keyword", "classDiagram"],
+
+ ["keyword", "direction"],
+ " RL\r\n ",
+
+ ["keyword", "class"],
+ " Student ",
+ ["punctuation", "{"],
+
+ "\r\n -idCard ",
+ ["operator", ":"],
+ " IdCard\r\n ",
+
+ ["punctuation", "}"],
+
+ ["keyword", "class"],
+ " IdCard",
+ ["punctuation", "{"],
+
+ "\r\n -id ",
+ ["operator", ":"],
+ " int\r\n -name ",
+ ["operator", ":"],
+ " string\r\n ",
+
+ ["punctuation", "}"],
+
+ ["keyword", "class"],
+ " Bike",
+ ["punctuation", "{"],
+
+ "\r\n -id ",
+ ["operator", ":"],
+ " int\r\n -name ",
+ ["operator", ":"],
+ " string\r\n ",
+
+ ["punctuation", "}"],
+
+ "\r\n Student ",
+ ["string", "\"1\""],
+ ["arrow", "--o"],
+ ["string", "\"1\""],
+ " IdCard ",
+ ["operator", ":"],
+ " carries\r\n Student ",
+ ["string", "\"1\""],
+ ["arrow", "--o"],
+ ["string", "\"1\""],
+ " Bike ",
+ ["operator", ":"],
+ " rides\r\n\r\n",
+
+ ["keyword", "action"],
+ " className ",
+ ["string", "\"reference\""],
+ ["string", "\"tooltip\""],
+
+ ["keyword", "click"],
+ " className call callback",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+ ["string", "\"tooltip\""],
+
+ ["keyword", "click"],
+ " className href ",
+ ["string", "\"url\""],
+ ["string", "\"tooltip\""],
+
+ ["keyword", "classDiagram"],
+
+ ["keyword", "class"],
+ " Shape\r\n",
+
+ ["keyword", "link"],
+ " Shape ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"This is a tooltip for a link\""],
+
+ ["keyword", "class"],
+ " Shape2\r\n",
+
+ ["keyword", "click"],
+ " Shape2 href ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"This is a tooltip for a link\""],
+
+ ["keyword", "classDiagram"],
+
+ ["keyword", "class"],
+ " Shape\r\n",
+
+ ["keyword", "callback"],
+ " Shape ",
+ ["string", "\"callbackFunction\""],
+ ["string", "\"This is a tooltip for a callback\""],
+
+ ["keyword", "class"],
+ " Shape2\r\n",
+
+ ["keyword", "click"],
+ " Shape2 call callbackFunction",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+ ["string", "\"This is a tooltip for a callback\""],
+
+ ["keyword", "classDiagram"],
+
+ "\r\nAnimal ",
+ ["arrow", "<|--"],
+ " Duck\r\nAnimal ",
+ ["arrow", "<|--"],
+ " Fish\r\nAnimal ",
+ ["arrow", "<|--"],
+ " Zebra\r\nAnimal ",
+ ["operator", ":"],
+ " +int age\r\nAnimal ",
+ ["operator", ":"],
+ " +String gender\r\nAnimal",
+ ["operator", ":"],
+ " +isMammal",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ "\r\nAnimal",
+ ["operator", ":"],
+ " +mate",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["keyword", "class"],
+ " Duck",
+ ["punctuation", "{"],
+
+ "\r\n +String beakColor\r\n +swim",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ "\r\n +quack",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "class"],
+ " Fish",
+ ["punctuation", "{"],
+
+ "\r\n -int sizeInFeet\r\n -canEat",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "class"],
+ " Zebra",
+ ["punctuation", "{"],
+
+ "\r\n +bool is_wild\r\n +run",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "callback"],
+ " Duck callback ",
+ ["string", "\"Tooltip\""],
+
+ ["keyword", "link"],
+ " Zebra ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"This is a link\""],
+
+ ["keyword", "classDiagram"],
+ ["keyword", "class"], " Animal", ["operator", ":::"], "cssClass\r\n\r\n",
+
+ ["keyword", "classDiagram"],
+
+ ["keyword", "class"],
+ " Animal",
+ ["operator", ":::"],
+ "cssClass ",
+ ["punctuation", "{"],
+
+ "\r\n -int sizeInFeet\r\n -canEat",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["punctuation", "}"]
+]
diff --git a/tests/languages/mermaid/full_erdiagram.test b/tests/languages/mermaid/full_erdiagram.test
new file mode 100644
index 0000000000..c88f2d46c6
--- /dev/null
+++ b/tests/languages/mermaid/full_erdiagram.test
@@ -0,0 +1,168 @@
+erDiagram
+ CUSTOMER ||--o{ ORDER : places
+ ORDER ||--|{ LINE-ITEM : contains
+ CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
+
+erDiagram
+ CUSTOMER ||--o{ ORDER : places
+ CUSTOMER {
+ string name
+ string custNumber
+ string sector
+ }
+ ORDER ||--|{ LINE-ITEM : contains
+ ORDER {
+ int orderNumber
+ string deliveryAddress
+ }
+ LINE-ITEM {
+ string productCode
+ int quantity
+ float pricePerUnit
+ }
+
+PROPERTY ||--|{ ROOM : contains
+
+CAR ||--o{ NAMED-DRIVER : allows
+ PERSON ||--o{ NAMED-DRIVER : is
+
+erDiagram
+ CAR ||--o{ NAMED-DRIVER : allows
+ CAR {
+ string registrationNumber
+ string make
+ string model
+ }
+ PERSON ||--o{ NAMED-DRIVER : is
+ PERSON {
+ string firstName
+ string lastName
+ int age
+ }
+
+erDiagram
+ CAR ||--o{ NAMED-DRIVER : allows
+ CAR {
+ string registrationNumber
+ string make
+ string model
+ }
+ PERSON ||--o{ NAMED-DRIVER : is
+ PERSON {
+ string firstName
+ string lastName
+ int age
+ }
+
+----------------------------------------------------
+
+[
+ ["keyword", "erDiagram"],
+
+ "\r\n CUSTOMER ",
+ ["arrow", "||--o{"],
+ " ORDER ",
+ ["operator", ":"],
+ " places\r\n ORDER ",
+ ["arrow", "||--|{"],
+ " LINE-ITEM ",
+ ["operator", ":"],
+ " contains\r\n CUSTOMER ",
+ ["arrow", "}|..|{"],
+ " DELIVERY-ADDRESS ",
+ ["operator", ":"],
+ " uses\r\n\r\n",
+
+ ["keyword", "erDiagram"],
+
+ "\r\n CUSTOMER ",
+ ["arrow", "||--o{"],
+ " ORDER ",
+ ["operator", ":"],
+ " places\r\n CUSTOMER ",
+ ["punctuation", "{"],
+
+ "\r\n string name\r\n string custNumber\r\n string sector\r\n ",
+
+ ["punctuation", "}"],
+
+ "\r\n ORDER ",
+ ["arrow", "||--|{"],
+ " LINE-ITEM ",
+ ["operator", ":"],
+ " contains\r\n ORDER ",
+ ["punctuation", "{"],
+
+ "\r\n int orderNumber\r\n string deliveryAddress\r\n ",
+
+ ["punctuation", "}"],
+
+ "\r\n LINE-ITEM ",
+ ["punctuation", "{"],
+
+ "\r\n string productCode\r\n int quantity\r\n float pricePerUnit\r\n ",
+
+ ["punctuation", "}"],
+
+ "\r\n\r\nPROPERTY ",
+ ["arrow", "||--|{"],
+ " ROOM ",
+ ["operator", ":"],
+ " contains\r\n\r\nCAR ",
+ ["arrow", "||--o{"],
+ " NAMED-DRIVER ",
+ ["operator", ":"],
+ " allows\r\n PERSON ",
+ ["arrow", "||--o{"],
+ " NAMED-DRIVER ",
+ ["operator", ":"],
+ " is\r\n\r\n",
+
+ ["keyword", "erDiagram"],
+
+ "\r\n CAR ",
+ ["arrow", "||--o{"],
+ " NAMED-DRIVER ",
+ ["operator", ":"],
+ " allows\r\n CAR ",
+ ["punctuation", "{"],
+
+ "\r\n string registrationNumber\r\n string make\r\n string model\r\n ",
+
+ ["punctuation", "}"],
+
+ "\r\n PERSON ",
+ ["arrow", "||--o{"],
+ " NAMED-DRIVER ",
+ ["operator", ":"],
+ " is\r\n PERSON ",
+ ["punctuation", "{"],
+
+ "\r\n string firstName\r\n string lastName\r\n int age\r\n ",
+
+ ["punctuation", "}"],
+
+ ["keyword", "erDiagram"],
+
+ "\r\n CAR ",
+ ["arrow", "||--o{"],
+ " NAMED-DRIVER ",
+ ["operator", ":"],
+ " allows\r\n CAR ",
+ ["punctuation", "{"],
+
+ "\r\n string registrationNumber\r\n string make\r\n string model\r\n ",
+
+ ["punctuation", "}"],
+
+ "\r\n PERSON ",
+ ["arrow", "||--o{"],
+ " NAMED-DRIVER ",
+ ["operator", ":"],
+ " is\r\n PERSON ",
+ ["punctuation", "{"],
+
+ "\r\n string firstName\r\n string lastName\r\n int age\r\n ",
+
+ ["punctuation", "}"]
+]
diff --git a/tests/languages/mermaid/full_flowchart.test b/tests/languages/mermaid/full_flowchart.test
new file mode 100644
index 0000000000..948af017cb
--- /dev/null
+++ b/tests/languages/mermaid/full_flowchart.test
@@ -0,0 +1,930 @@
+flowchart LR
+ id
+
+flowchart LR
+ id1[This is the text in the box]
+
+flowchart TD
+ Start --> Stop
+
+flowchart LR
+ Start --> Stop
+
+flowchart LR
+ id1(This is the text in the box)
+
+flowchart LR
+ id1([This is the text in the box])
+
+flowchart LR
+ id1[[This is the text in the box]]
+
+flowchart LR
+ id1[(Database)]
+
+flowchart LR
+ id1((This is the text in the circle))
+
+flowchart LR
+ id1>This is the text in the box]
+
+flowchart LR
+ id1{This is the text in the box}
+
+flowchart LR
+ id1{{This is the text in the box}}
+
+flowchart TD
+ id1[/This is the text in the box/]
+
+flowchart TD
+ id1[\This is the text in the box\]
+
+flowchart TD
+ A[/Christmas\]
+
+flowchart TD
+ B[\Go shopping/]
+
+flowchart LR
+ A-->B
+
+flowchart LR
+ A --- B
+
+flowchart LR
+ A-- This is the text! ---B
+
+flowchart LR
+ A---|This is the text|B
+
+flowchart LR
+ A-->|text|B
+
+flowchart LR
+ A-- text -->B
+
+flowchart LR;
+ A-.->B;
+
+flowchart LR
+ A-. text .-> B
+
+flowchart LR
+ A ==> B
+
+flowchart LR
+ A == text ==> B
+
+flowchart LR
+ A -- text --> B -- text2 --> C
+
+flowchart LR
+ a --> b & c--> d
+
+flowchart TB
+ A & B--> C & D
+
+flowchart TB
+ A --> C
+ A --> D
+ B --> C
+ B --> D
+
+flowchart LR
+ A --o B
+ B --x C
+
+flowchart LR
+ A o--o B
+ B <--> C
+ C x--x D
+
+flowchart TD
+ A[Start] --> B{Is it?};
+ B -->|Yes| C[OK];
+ C --> D[Rethink];
+ D --> B;
+ B ---->|No| E[End];
+
+flowchart TD
+ A[Start] --> B{Is it?};
+ B -- Yes --> C[OK];
+ C --> D[Rethink];
+ D --> B;
+ B -- No ----> E[End];
+
+flowchart LR
+ id1["This is the (text) in the box"]
+
+flowchart LR
+ A["A double quote:#quot;"] -->B["A dec char:#9829;"]
+
+subgraph title
+ graph definition
+end
+
+flowchart TB
+ c1-->a2
+ subgraph one
+ a1-->a2
+ end
+ subgraph two
+ b1-->b2
+ end
+ subgraph three
+ c1-->c2
+ end
+
+flowchart TB
+ c1-->a2
+ subgraph ide1 [one]
+ a1-->a2
+ end
+
+flowchart TB
+ c1-->a2
+ subgraph one
+ a1-->a2
+ end
+ subgraph two
+ b1-->b2
+ end
+ subgraph three
+ c1-->c2
+ end
+ one --> two
+ three --> two
+ two --> c2
+
+flowchart LR
+ subgraph TOP
+ direction TB
+ subgraph B1
+ direction RL
+ i1 -->f1
+ end
+ subgraph B2
+ direction BT
+ i2 -->f2
+ end
+ end
+ A --> TOP --> B
+ B1 --> B2
+
+click nodeId callback
+click nodeId call callback()
+
+flowchart LR;
+ A-->B;
+ B-->C;
+ C-->D;
+ click A callback "Tooltip for a callback"
+ click B "http://www.github.com" "This is a tooltip for a link"
+ click A call callback() "Tooltip for a callback"
+ click B href "http://www.github.com" "This is a tooltip for a link"
+
+flowchart LR;
+ A-->B;
+ B-->C;
+ C-->D;
+ D-->E;
+ click A "http://www.github.com" _blank
+ click B "http://www.github.com" "Open this in a new tab" _blank
+ click C href "http://www.github.com" _blank
+ click D href "http://www.github.com" "Open this in a new tab" _blank
+
+flowchart LR
+%% this is a comment A -- text --> B{node}
+ A -- text --> B -- text2 --> C
+
+linkStyle 3 stroke:#ff3,stroke-width:4px,color:red;
+
+flowchart LR
+ id1(Start)-->id2(Stop)
+ style id1 fill:#f9f,stroke:#333,stroke-width:4px
+ style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
+
+classDef className fill:#f9f,stroke:#333,stroke-width:4px;
+
+class nodeId1 className;
+
+class nodeId1,nodeId2 className;
+
+flowchart LR
+ A:::someclass --> B
+ classDef someclass fill:#f96;
+
+flowchart LR;
+ A-->B[AAABBB];
+ B-->D;
+ class A cssClass;
+
+classDef default fill:#f9f,stroke:#333,stroke-width:4px;
+
+flowchart TD
+ B["fa:fa-twitter for peace"]
+ B-->C[fa:fa-ban forbidden]
+ B-->D(fa:fa-spinner);
+ B-->E(A fa:fa-camera-retro perhaps?);
+
+flowchart LR
+ A[Hard edge] -->|Link text| B(Round edge)
+ B --> C{Decision}
+ C -->|One| D[Result one]
+ C -->|Two| E[Result two]
+
+ flowchart LR;
+ A-->B;
+ B-->C;
+ C-->D;
+ click A callback "Tooltip"
+ click B "http://www.github.com" "This is a link"
+ click C call callback() "Tooltip"
+ click D href "http://www.github.com" "This is a link"
+
+----------------------------------------------------
+
+[
+ ["keyword", "flowchart"], " LR\r\n id\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "[This is the text in the box]"],
+
+ ["keyword", "flowchart"],
+ " TD\r\n Start ",
+ ["arrow", "-->"],
+ " Stop\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n Start ",
+ ["arrow", "-->"],
+ " Stop\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "(This is the text in the box)"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "([This is the text in the box])"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "[[This is the text in the box]]"],
+
+ ["keyword", "flowchart"], " LR\r\n id1", ["text", "[(Database)]"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "((This is the text in the circle))"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", ">This is the text in the box]"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "{This is the text in the box}"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "{{This is the text in the box}}"],
+
+ ["keyword", "flowchart"],
+ " TD\r\n id1",
+ ["text", "[/This is the text in the box/]"],
+
+ ["keyword", "flowchart"],
+ " TD\r\n id1",
+ ["text", "[\\This is the text in the box\\]"],
+
+ ["keyword", "flowchart"], " TD\r\n A", ["text", "[/Christmas\\]"],
+
+ ["keyword", "flowchart"], " TD\r\n B", ["text", "[\\Go shopping/]"],
+
+ ["keyword", "flowchart"], " LR\r\n A", ["arrow", "-->"], "B\r\n\r\n",
+
+ ["keyword", "flowchart"], " LR\r\n A ", ["arrow", "---"], " B\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n A",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "This is the text!"],
+ ["arrow", "---"]
+ ]],
+ "B\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n A",
+ ["arrow", "---"],
+ ["label", "|This is the text|"],
+ "B\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n A",
+ ["arrow", "-->"],
+ ["label", "|text|"],
+ "B\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n A",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "text"],
+ ["arrow", "-->"]
+ ]],
+ "B\r\n\r\n",
+
+ ["keyword", "flowchart"], " LR", ["punctuation", ";"],
+ "\r\n A", ["arrow", "-.->"], "B", ["punctuation", ";"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n A",
+ ["inter-arrow-label", [
+ ["arrow-head", "-."],
+ ["label", "text"],
+ ["arrow", ".->"]
+ ]],
+ " B\r\n\r\n",
+
+ ["keyword", "flowchart"], " LR\r\n A ", ["arrow", "==>"], " B\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n A ",
+ ["inter-arrow-label", [
+ ["arrow-head", "=="],
+ ["label", "text"],
+ ["arrow", "==>"]
+ ]],
+ " B\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n A ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "text"],
+ ["arrow", "-->"]
+ ]],
+ " B ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "text2"],
+ ["arrow", "-->"]
+ ]],
+ " C\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n a ",
+ ["arrow", "-->"],
+ " b ",
+ ["operator", "&"],
+ " c",
+ ["arrow", "-->"],
+ " d\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " TB\r\n A ",
+ ["operator", "&"],
+ " B",
+ ["arrow", "-->"],
+ " C ",
+ ["operator", "&"],
+ " D\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " TB\r\n A ",
+ ["arrow", "-->"],
+ " C\r\n A ",
+ ["arrow", "-->"],
+ " D\r\n B ",
+ ["arrow", "-->"],
+ " C\r\n B ",
+ ["arrow", "-->"],
+ " D\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n A ",
+ ["arrow", "--o"],
+ " B\r\n B ",
+ ["arrow", "--x"],
+ " C\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n A ",
+ ["arrow", "o--o"],
+ " B\r\n B ",
+ ["arrow", "<-->"],
+ " C\r\n C ",
+ ["arrow", "x--x"],
+ " D\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " TD\r\n A",
+ ["text", "[Start]"],
+ ["arrow", "-->"],
+ " B",
+ ["text", "{Is it?}"],
+ ["punctuation", ";"],
+
+ "\r\n B ",
+ ["arrow", "-->"],
+ ["label", "|Yes|"],
+ " C",
+ ["text", "[OK]"],
+ ["punctuation", ";"],
+
+ "\r\n C ",
+ ["arrow", "-->"],
+ " D",
+ ["text", "[Rethink]"],
+ ["punctuation", ";"],
+
+ "\r\n D ",
+ ["arrow", "-->"],
+ " B",
+ ["punctuation", ";"],
+
+ "\r\n B ",
+ ["arrow", "---->"],
+ ["label", "|No|"],
+ " E",
+ ["text", "[End]"],
+ ["punctuation", ";"],
+
+ ["keyword", "flowchart"],
+ " TD\r\n A",
+ ["text", "[Start]"],
+ ["arrow", "-->"],
+ " B",
+ ["text", "{Is it?}"],
+ ["punctuation", ";"],
+
+ "\r\n B ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "Yes"],
+ ["arrow", "-->"]
+ ]],
+ " C",
+ ["text", "[OK]"],
+ ["punctuation", ";"],
+
+ "\r\n C ",
+ ["arrow", "-->"],
+ " D",
+ ["text", "[Rethink]"],
+ ["punctuation", ";"],
+
+ "\r\n D ",
+ ["arrow", "-->"],
+ " B",
+ ["punctuation", ";"],
+
+ "\r\n B ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "No"],
+ ["arrow", "---->"]
+ ]],
+ " E",
+ ["text", "[End]"],
+ ["punctuation", ";"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "[\"This is the (text) in the box\"]"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n A",
+ ["text", "[\"A double quote:#quot;\"]"],
+ ["arrow", "-->"],
+ "B",
+ ["text", "[\"A dec char:#9829;\"]"],
+
+ ["keyword", "subgraph"], " title\r\n ",
+ ["keyword", "graph"], " definition\r\n",
+ ["keyword", "end"],
+
+ ["keyword", "flowchart"], " TB\r\n c1", ["arrow", "-->"], "a2\r\n ",
+ ["keyword", "subgraph"], " one\r\n a1", ["arrow", "-->"], "a2\r\n ",
+ ["keyword", "end"],
+ ["keyword", "subgraph"], " two\r\n b1", ["arrow", "-->"], "b2\r\n ",
+ ["keyword", "end"],
+ ["keyword", "subgraph"], " three\r\n c1", ["arrow", "-->"], "c2\r\n ",
+ ["keyword", "end"],
+
+ ["keyword", "flowchart"], " TB\r\n c1", ["arrow", "-->"], "a2\r\n ",
+ ["keyword", "subgraph"], " ide1 ", ["text", "[one]"],
+ "\r\n a1", ["arrow", "-->"], "a2\r\n ",
+ ["keyword", "end"],
+
+ ["keyword", "flowchart"],
+ " TB\r\n c1",
+ ["arrow", "-->"],
+ "a2\r\n ",
+
+ ["keyword", "subgraph"],
+ " one\r\n a1",
+ ["arrow", "-->"],
+ "a2\r\n ",
+
+ ["keyword", "end"],
+
+ ["keyword", "subgraph"],
+ " two\r\n b1",
+ ["arrow", "-->"],
+ "b2\r\n ",
+
+ ["keyword", "end"],
+
+ ["keyword", "subgraph"],
+ " three\r\n c1",
+ ["arrow", "-->"],
+ "c2\r\n ",
+
+ ["keyword", "end"],
+
+ "\r\n one ",
+ ["arrow", "-->"],
+ " two\r\n three ",
+ ["arrow", "-->"],
+ " two\r\n two ",
+ ["arrow", "-->"],
+ " c2\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n ",
+
+ ["keyword", "subgraph"],
+ " TOP\r\n ",
+
+ ["keyword", "direction"],
+ " TB\r\n ",
+
+ ["keyword", "subgraph"],
+ " B1\r\n ",
+
+ ["keyword", "direction"],
+ " RL\r\n i1 ",
+ ["arrow", "-->"],
+ "f1\r\n ",
+
+ ["keyword", "end"],
+
+ ["keyword", "subgraph"],
+ " B2\r\n ",
+
+ ["keyword", "direction"],
+ " BT\r\n i2 ",
+ ["arrow", "-->"],
+ "f2\r\n ",
+
+ ["keyword", "end"],
+
+ ["keyword", "end"],
+
+ "\r\n A ",
+ ["arrow", "-->"],
+ " TOP ",
+ ["arrow", "-->"],
+ " B\r\n B1 ",
+ ["arrow", "-->"],
+ " B2\r\n\r\n",
+
+ ["keyword", "click"],
+ " nodeId callback\r\n",
+
+ ["keyword", "click"],
+ " nodeId call callback",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+
+ ["keyword", "flowchart"],
+ " LR",
+ ["punctuation", ";"],
+
+ "\r\n A",
+ ["arrow", "-->"],
+ "B",
+ ["punctuation", ";"],
+
+ "\r\n B",
+ ["arrow", "-->"],
+ "C",
+ ["punctuation", ";"],
+
+ "\r\n C",
+ ["arrow", "-->"],
+ "D",
+ ["punctuation", ";"],
+
+ ["keyword", "click"],
+ " A callback ",
+ ["string", "\"Tooltip for a callback\""],
+
+ ["keyword", "click"],
+ " B ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"This is a tooltip for a link\""],
+
+ ["keyword", "click"],
+ " A call callback",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+ ["string", "\"Tooltip for a callback\""],
+
+ ["keyword", "click"],
+ " B href ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"This is a tooltip for a link\""],
+
+ ["keyword", "flowchart"],
+ " LR",
+ ["punctuation", ";"],
+
+ "\r\n A",
+ ["arrow", "-->"],
+ "B",
+ ["punctuation", ";"],
+
+ "\r\n B",
+ ["arrow", "-->"],
+ "C",
+ ["punctuation", ";"],
+
+ "\r\n C",
+ ["arrow", "-->"],
+ "D",
+ ["punctuation", ";"],
+
+ "\r\n D",
+ ["arrow", "-->"],
+ "E",
+ ["punctuation", ";"],
+
+ ["keyword", "click"],
+ " A ",
+ ["string", "\"http://www.github.com\""],
+ " _blank\r\n ",
+
+ ["keyword", "click"],
+ " B ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"Open this in a new tab\""],
+ " _blank\r\n ",
+
+ ["keyword", "click"],
+ " C href ",
+ ["string", "\"http://www.github.com\""],
+ " _blank\r\n ",
+
+ ["keyword", "click"],
+ " D href ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"Open this in a new tab\""],
+ " _blank\r\n\r\n",
+
+ ["keyword", "flowchart"],
+ " LR\r\n",
+
+ ["comment", "%% this is a comment A -- text --> B{node}"],
+
+ "\r\n A ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "text"],
+ ["arrow", "-->"]
+ ]],
+ " B ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "text2"],
+ ["arrow", "-->"]
+ ]],
+ " C\r\n\r\n",
+
+ ["keyword", "linkStyle"],
+ " 3 ",
+ ["style", [
+ ["property", "stroke"],
+ ["operator", ":"],
+ "#ff3",
+ ["punctuation", ","],
+ ["property", "stroke-width"],
+ ["operator", ":"],
+ "4px",
+ ["punctuation", ","],
+ ["property", "color"],
+ ["operator", ":"],
+ "red"
+ ]],
+ ["punctuation", ";"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n id1",
+ ["text", "(Start)"],
+ ["arrow", "-->"],
+ "id2",
+ ["text", "(Stop)"],
+
+ ["keyword", "style"],
+ " id1 ",
+ ["style", [
+ ["property", "fill"],
+ ["operator", ":"],
+ "#f9f",
+ ["punctuation", ","],
+ ["property", "stroke"],
+ ["operator", ":"],
+ "#333",
+ ["punctuation", ","],
+ ["property", "stroke-width"],
+ ["operator", ":"],
+ "4px"
+ ]],
+
+ ["keyword", "style"],
+ " id2 ",
+ ["style", [
+ ["property", "fill"],
+ ["operator", ":"],
+ "#bbf",
+ ["punctuation", ","],
+ ["property", "stroke"],
+ ["operator", ":"],
+ "#f66",
+ ["punctuation", ","],
+ ["property", "stroke-width"],
+ ["operator", ":"],
+ "2px",
+ ["punctuation", ","],
+ ["property", "color"],
+ ["operator", ":"],
+ "#fff",
+ ["punctuation", ","],
+ ["property", "stroke-dasharray"],
+ ["operator", ":"],
+ " 5 5"
+ ]],
+
+ ["keyword", "classDef"],
+ " className ",
+ ["style", [
+ ["property", "fill"],
+ ["operator", ":"],
+ "#f9f",
+ ["punctuation", ","],
+ ["property", "stroke"],
+ ["operator", ":"],
+ "#333",
+ ["punctuation", ","],
+ ["property", "stroke-width"],
+ ["operator", ":"],
+ "4px"
+ ]],
+ ["punctuation", ";"],
+
+ ["keyword", "class"], " nodeId1 className", ["punctuation", ";"],
+
+ ["keyword", "class"], " nodeId1,nodeId2 className", ["punctuation", ";"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n A",
+ ["operator", ":::"],
+ "someclass ",
+ ["arrow", "-->"],
+ " B\r\n ",
+
+ ["keyword", "classDef"],
+ " someclass ",
+ ["style", [
+ ["property", "fill"],
+ ["operator", ":"],
+ "#f96"
+ ]],
+ ["punctuation", ";"],
+
+ ["keyword", "flowchart"],
+ " LR",
+ ["punctuation", ";"],
+
+ "\r\n A",
+ ["arrow", "-->"],
+ "B",
+ ["text", "[AAABBB]"],
+ ["punctuation", ";"],
+
+ "\r\n B",
+ ["arrow", "-->"],
+ "D",
+ ["punctuation", ";"],
+
+ ["keyword", "class"],
+ " A cssClass",
+ ["punctuation", ";"],
+
+ ["keyword", "classDef"],
+ " default ",
+ ["style", [
+ ["property", "fill"],
+ ["operator", ":"],
+ "#f9f",
+ ["punctuation", ","],
+ ["property", "stroke"],
+ ["operator", ":"],
+ "#333",
+ ["punctuation", ","],
+ ["property", "stroke-width"],
+ ["operator", ":"],
+ "4px"
+ ]],
+ ["punctuation", ";"],
+
+ ["keyword", "flowchart"],
+ " TD\r\n B",
+ ["text", "[\"fa:fa-twitter for peace\"]"],
+
+ "\r\n B",
+ ["arrow", "-->"],
+ "C",
+ ["text", "[fa:fa-ban forbidden]"],
+
+ "\r\n B",
+ ["arrow", "-->"],
+ "D",
+ ["text", "(fa:fa-spinner)"],
+ ["punctuation", ";"],
+
+ "\r\n B",
+ ["arrow", "-->"],
+ "E",
+ ["text", "(A fa:fa-camera-retro perhaps?)"],
+ ["punctuation", ";"],
+
+ ["keyword", "flowchart"],
+ " LR\r\n A",
+ ["text", "[Hard edge]"],
+ ["arrow", "-->"],
+ ["label", "|Link text|"],
+ " B",
+ ["text", "(Round edge)"],
+
+ "\r\n B ",
+ ["arrow", "-->"],
+ " C",
+ ["text", "{Decision}"],
+
+ "\r\n C ",
+ ["arrow", "-->"],
+ ["label", "|One|"],
+ " D",
+ ["text", "[Result one]"],
+
+ "\r\n C ",
+ ["arrow", "-->"],
+ ["label", "|Two|"],
+ " E",
+ ["text", "[Result two]"],
+
+ ["keyword", "flowchart"],
+ " LR",
+ ["punctuation", ";"],
+
+ "\r\n A",
+ ["arrow", "-->"],
+ "B",
+ ["punctuation", ";"],
+
+ "\r\n B",
+ ["arrow", "-->"],
+ "C",
+ ["punctuation", ";"],
+
+ "\r\n C",
+ ["arrow", "-->"],
+ "D",
+ ["punctuation", ";"],
+
+ ["keyword", "click"],
+ " A callback ",
+ ["string", "\"Tooltip\""],
+
+ ["keyword", "click"],
+ " B ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"This is a link\""],
+
+ ["keyword", "click"],
+ " C call callback",
+ ["punctuation", "("],
+ ["punctuation", ")"],
+ ["string", "\"Tooltip\""],
+
+ ["keyword", "click"],
+ " D href ",
+ ["string", "\"http://www.github.com\""],
+ ["string", "\"This is a link\""]
+]
diff --git a/tests/languages/mermaid/full_sequencediagram.test b/tests/languages/mermaid/full_sequencediagram.test
new file mode 100644
index 0000000000..ec954bc24d
--- /dev/null
+++ b/tests/languages/mermaid/full_sequencediagram.test
@@ -0,0 +1,389 @@
+sequenceDiagram
+ Alice->>John: Hello John, how are you?
+ John-->>Alice: Great!
+ Alice-)John: See you later!
+
+sequenceDiagram
+ participant John
+ participant Alice
+ Alice->>John: Hello John, how are you?
+ John-->>Alice: Great!
+
+sequenceDiagram
+ participant A as Alice
+ participant J as John
+ A->>J: Hello John, how are you?
+ J->>A: Great!
+
+[Actor][Arrow][Actor]:Message text
+
+sequenceDiagram
+ Alice->>John: Hello John, how are you?
+ activate John
+ John-->>Alice: Great!
+ deactivate John
+
+sequenceDiagram
+ Alice->>+John: Hello John, how are you?
+ John-->>-Alice: Great!
+
+sequenceDiagram
+ Alice->>+John: Hello John, how are you?
+ Alice->>+John: John, can you hear me?
+ John-->>-Alice: Hi Alice, I can hear you!
+ John-->>-Alice: I feel great!
+
+sequenceDiagram
+ participant John
+ Note right of John: Text in note
+
+sequenceDiagram
+ Alice->John: Hello John, how are you?
+ Note over Alice,John: A typical interaction
+
+loop Loop text
+... statements ...
+end
+
+sequenceDiagram
+ Alice->John: Hello John, how are you?
+ loop Every minute
+ John-->Alice: Great!
+ end
+
+alt Describing text
+... statements ...
+else
+... statements ...
+end
+
+opt Describing text
+... statements ...
+end
+
+sequenceDiagram
+ 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
+
+par [Action 1]
+... statements ...
+and [Action 2]
+... statements ...
+and [Action N]
+... statements ...
+end
+
+rect rgb(0, 255, 0)
+... content ...
+end
+
+rect rgba(0, 0, 255, .1)
+... content ...
+end
+
+sequenceDiagram
+ Alice->>John: Hello John, how are you?
+ %% this is a comment
+ John-->>Alice: Great!
+
+sequenceDiagram
+ A->>B: I #9829; you!
+ B->>A: I #9829; you #infin; times more!
+
+sequenceDiagram
+ autonumber
+ Alice->>John: Hello John, how are you?
+ loop Healthcheck
+ John->>John: Fight against hypochondria
+ end
+ Note right of John: Rational thoughts!
+ John-->>Alice: Great!
+ John->>Bob: How about you?
+ Bob-->>John: Jolly good!
+
+----------------------------------------------------
+
+[
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n Alice",
+ ["arrow", "->>"],
+ "John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n John",
+ ["arrow", "-->>"],
+ "Alice",
+ ["operator", ":"],
+ " Great!\r\n Alice",
+ ["arrow", "-)"],
+ "John",
+ ["operator", ":"],
+ " See you later!\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ ["keyword", "participant"],
+ " John\r\n ",
+
+ ["keyword", "participant"],
+ " Alice\r\n Alice",
+ ["arrow", "->>"],
+ "John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n John",
+ ["arrow", "-->>"],
+ "Alice",
+ ["operator", ":"],
+ " Great!\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ ["keyword", "participant"],
+ " A as Alice\r\n ",
+
+ ["keyword", "participant"],
+ " J as John\r\n A",
+ ["arrow", "->>"],
+ "J",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n J",
+ ["arrow", "->>"],
+ "A",
+ ["operator", ":"],
+ " Great!\r\n\r\n",
+
+ ["text", "[Actor]"],
+ ["text", "[Arrow]"],
+ ["text", "[Actor]"],
+ ["operator", ":"],
+ "Message text\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n Alice",
+ ["arrow", "->>"],
+ "John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n ",
+
+ ["keyword", "activate"],
+ " John\r\n John",
+ ["arrow", "-->>"],
+ "Alice",
+ ["operator", ":"],
+ " Great!\r\n ",
+
+ ["keyword", "deactivate"],
+ " John\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n Alice",
+ ["arrow", "->>"],
+ "+John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n John",
+ ["arrow", "-->>"],
+ "-Alice",
+ ["operator", ":"],
+ " Great!\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n Alice",
+ ["arrow", "->>"],
+ "+John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n Alice",
+ ["arrow", "->>"],
+ "+John",
+ ["operator", ":"],
+ " John, can you hear me?\r\n John",
+ ["arrow", "-->>"],
+ "-Alice",
+ ["operator", ":"],
+ " Hi Alice, I can hear you!\r\n John",
+ ["arrow", "-->>"],
+ "-Alice",
+ ["operator", ":"],
+ " I feel great!\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ ["keyword", "participant"],
+ " John\r\n ",
+
+ ["keyword", "Note right of"],
+ " John",
+ ["operator", ":"],
+ " Text in note\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n Alice",
+ ["arrow", "->"],
+ "John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n ",
+
+ ["keyword", "Note over"],
+ " Alice,John",
+ ["operator", ":"],
+ " A typical interaction\r\n\r\n",
+
+ ["keyword", "loop"], " Loop text\r\n... statements ...\r\n",
+ ["keyword", "end"],
+
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n Alice",
+ ["arrow", "->"],
+ "John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n ",
+
+ ["keyword", "loop"],
+ " Every minute\r\n John",
+ ["arrow", "-->"],
+ "Alice",
+ ["operator", ":"],
+ " Great!\r\n ",
+
+ ["keyword", "end"],
+
+ ["keyword", "alt"], " Describing text\r\n... statements ...\r\n",
+ ["keyword", "else"],
+ "\r\n... statements ...\r\n",
+ ["keyword", "end"],
+
+ ["keyword", "opt"], " Describing text\r\n... statements ...\r\n",
+ ["keyword", "end"],
+
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n Alice",
+ ["arrow", "->>"],
+ "Bob",
+ ["operator", ":"],
+ " Hello Bob, how are you?\r\n ",
+
+ ["keyword", "alt"],
+ " is sick\r\n Bob",
+ ["arrow", "->>"],
+ "Alice",
+ ["operator", ":"],
+ " Not so good ",
+ ["operator", ":"],
+ ["punctuation", "("],
+
+ ["keyword", "else"],
+ " is well\r\n Bob",
+ ["arrow", "->>"],
+ "Alice",
+ ["operator", ":"],
+ " Feeling fresh like a daisy\r\n ",
+
+ ["keyword", "end"],
+
+ ["keyword", "opt"],
+ " Extra response\r\n Bob",
+ ["arrow", "->>"],
+ "Alice",
+ ["operator", ":"],
+ " Thanks for asking\r\n ",
+
+ ["keyword", "end"],
+
+ ["keyword", "par"], ["text", "[Action 1]"],
+ "\r\n... statements ...\r\n",
+ ["keyword", "and"], ["text", "[Action 2]"],
+ "\r\n... statements ...\r\n",
+ ["keyword", "and"], ["text", "[Action N]"],
+ "\r\n... statements ...\r\n",
+ ["keyword", "end"],
+
+ ["keyword", "rect"], " rgb", ["text", "(0, 255, 0)"],
+ "\r\n... content ...\r\n",
+ ["keyword", "end"],
+
+ ["keyword", "rect"], " rgba", ["text", "(0, 0, 255, .1)"],
+ "\r\n... content ...\r\n",
+ ["keyword", "end"],
+
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n Alice",
+ ["arrow", "->>"],
+ "John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n ",
+
+ ["comment", "%% this is a comment"],
+
+ "\r\n John",
+ ["arrow", "-->>"],
+ "Alice",
+ ["operator", ":"],
+ " Great!\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ "\r\n A",
+ ["arrow", "->>"],
+ "B",
+ ["operator", ":"],
+ " I ",
+ ["entity", "#9829;"],
+ " you!\r\n B",
+ ["arrow", "->>"],
+ "A",
+ ["operator", ":"],
+ " I ",
+ ["entity", "#9829;"],
+ " you ",
+ ["entity", "#infin;"],
+ " times more!\r\n\r\n",
+
+ ["keyword", "sequenceDiagram"],
+
+ ["keyword", "autonumber"],
+
+ "\r\n Alice",
+ ["arrow", "->>"],
+ "John",
+ ["operator", ":"],
+ " Hello John, how are you?\r\n ",
+
+ ["keyword", "loop"],
+ " Healthcheck\r\n John",
+ ["arrow", "->>"],
+ "John",
+ ["operator", ":"],
+ " Fight against hypochondria\r\n ",
+
+ ["keyword", "end"],
+
+ ["keyword", "Note right of"],
+ " John",
+ ["operator", ":"],
+ " Rational thoughts!\r\n John",
+ ["arrow", "-->>"],
+ "Alice",
+ ["operator", ":"],
+ " Great!\r\n John",
+ ["arrow", "->>"],
+ "Bob",
+ ["operator", ":"],
+ " How about you?\r\n Bob",
+ ["arrow", "-->>"],
+ "John",
+ ["operator", ":"],
+ " Jolly good!"
+]
diff --git a/tests/languages/mermaid/full_statediagram.test b/tests/languages/mermaid/full_statediagram.test
new file mode 100644
index 0000000000..a5d1f27bf4
--- /dev/null
+++ b/tests/languages/mermaid/full_statediagram.test
@@ -0,0 +1,430 @@
+stateDiagram-v2
+ [*] --> Still
+ Still --> [*]
+
+ Still --> Moving
+ Moving --> Still
+ Moving --> Crash
+ Crash --> [*]
+
+stateDiagram-v2
+ s1 --> s2
+
+stateDiagram-v2
+ s1 --> s2: A transition
+
+stateDiagram-v2
+ [*] --> s1
+ s1 --> [*]
+
+stateDiagram-v2
+ [*] --> First
+ state First {
+ [*] --> second
+ second --> [*]
+ }
+
+stateDiagram-v2
+ [*] --> First
+
+ state First {
+ [*] --> Second
+
+ state Second {
+ [*] --> second
+ second --> Third
+
+ state Third {
+ [*] --> third
+ third --> [*]
+ }
+ }
+ }
+
+stateDiagram-v2
+ [*] --> First
+ First --> Second
+ First --> Third
+
+ state First {
+ [*] --> fir
+ fir --> [*]
+ }
+ state Second {
+ [*] --> sec
+ sec --> [*]
+ }
+ state Third {
+ [*] --> thi
+ thi --> [*]
+ }
+
+stateDiagram-v2
+ state if_state <>
+ [*] --> IsPositive
+ IsPositive --> if_state
+ if_state --> False: if n < 0
+ if_state --> True : if n >= 0
+
+stateDiagram-v2
+ state fork_state <>
+ [*] --> fork_state
+ fork_state --> State2
+ fork_state --> State3
+
+ state join_state <>
+ State2 --> join_state
+ State3 --> join_state
+ join_state --> State4
+ State4 --> [*]
+
+stateDiagram-v2
+ State1: The state with a note
+ note right of State1
+ Important information! You can write
+ notes.
+ end note
+ State1 --> State2
+ note left of State2 : This is the note to the left.
+
+stateDiagram-v2
+ [*] --> Active
+
+ state Active {
+ [*] --> NumLockOff
+ NumLockOff --> NumLockOn : EvNumLockPressed
+ NumLockOn --> NumLockOff : EvNumLockPressed
+ --
+ [*] --> CapsLockOff
+ CapsLockOff --> CapsLockOn : EvCapsLockPressed
+ CapsLockOn --> CapsLockOff : EvCapsLockPressed
+ --
+ [*] --> ScrollLockOff
+ ScrollLockOff --> ScrollLockOn : EvScrollLockPressed
+ ScrollLockOn --> ScrollLockOff : EvScrollLockPressed
+ }
+
+stateDiagram
+ direction LR
+ [*] --> A
+ A --> B
+ B --> C
+ state B {
+ direction LR
+ a --> b
+ }
+ B --> D
+
+stateDiagram-v2
+ [*] --> Still
+ Still --> [*]
+%% this is a comment
+ Still --> Moving
+ Moving --> Still %% another comment
+ Moving --> Crash
+ Crash --> [*]
+
+----------------------------------------------------
+
+[
+ ["keyword", "stateDiagram-v2"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " Still\r\n Still ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ "\r\n\r\n Still ",
+ ["arrow", "-->"],
+ " Moving\r\n Moving ",
+ ["arrow", "-->"],
+ " Still\r\n Moving ",
+ ["arrow", "-->"],
+ " Crash\r\n Crash ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["keyword", "stateDiagram-v2"],
+ "\r\n s1 ", ["arrow", "-->"], " s2\r\n\r\n",
+
+ ["keyword", "stateDiagram-v2"],
+
+ "\r\n s1 ",
+ ["arrow", "-->"],
+ " s2",
+ ["operator", ":"],
+ " A transition\r\n\r\n",
+
+ ["keyword", "stateDiagram-v2"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " s1\r\n s1 ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["keyword", "stateDiagram-v2"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " First\r\n ",
+
+ ["keyword", "state"],
+ " First ",
+ ["punctuation", "{"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " second\r\n second ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "stateDiagram-v2"],
+ ["text", "[*]"], ["arrow", "-->"], " First\r\n\r\n ",
+
+ ["keyword", "state"], " First ", ["punctuation", "{"],
+ ["text", "[*]"], ["arrow", "-->"], " Second\r\n\r\n ",
+
+ ["keyword", "state"],
+ " Second ",
+ ["punctuation", "{"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " second\r\n second ",
+ ["arrow", "-->"],
+ " Third\r\n\r\n ",
+
+ ["keyword", "state"],
+ " Third ",
+ ["punctuation", "{"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " third\r\n third ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["punctuation", "}"],
+
+ ["punctuation", "}"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "stateDiagram-v2"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " First\r\n First ",
+ ["arrow", "-->"],
+ " Second\r\n First ",
+ ["arrow", "-->"],
+ " Third\r\n\r\n ",
+
+ ["keyword", "state"],
+ " First ",
+ ["punctuation", "{"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " fir\r\n fir ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "state"],
+ " Second ",
+ ["punctuation", "{"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " sec\r\n sec ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "state"],
+ " Third ",
+ ["punctuation", "{"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " thi\r\n thi ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["punctuation", "}"],
+
+ ["keyword", "stateDiagram-v2"],
+
+ ["keyword", "state"],
+ " if_state ",
+ ["annotation", "<>"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " IsPositive\r\n IsPositive ",
+ ["arrow", "-->"],
+ " if_state\r\n if_state ",
+ ["arrow", "-->"],
+ " False",
+ ["operator", ":"],
+ " if n < 0\r\n if_state ",
+ ["arrow", "-->"],
+ " True ",
+ ["operator", ":"],
+ " if n >= 0\r\n\r\n",
+
+ ["keyword", "stateDiagram-v2"],
+
+ ["keyword", "state"],
+ " fork_state ",
+ ["annotation", "<>"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " fork_state\r\n fork_state ",
+ ["arrow", "-->"],
+ " State2\r\n fork_state ",
+ ["arrow", "-->"],
+ " State3\r\n\r\n ",
+
+ ["keyword", "state"],
+ " join_state ",
+ ["annotation", "<>"],
+
+ "\r\n State2 ",
+ ["arrow", "-->"],
+ " join_state\r\n State3 ",
+ ["arrow", "-->"],
+ " join_state\r\n join_state ",
+ ["arrow", "-->"],
+ " State4\r\n State4 ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["keyword", "stateDiagram-v2"],
+
+ "\r\n State1",
+ ["operator", ":"],
+ " The state with a note\r\n ",
+
+ ["keyword", "note right of"],
+ " State1\r\n Important information! You can write\r\n notes.\r\n ",
+
+ ["keyword", "end note"],
+
+ "\r\n State1 ",
+ ["arrow", "-->"],
+ " State2\r\n ",
+
+ ["keyword", "note left of"],
+ " State2 ",
+ ["operator", ":"],
+ " This is the note to the left.\r\n\r\n",
+
+ ["keyword", "stateDiagram-v2"],
+ ["text", "[*]"], ["arrow", "-->"], " Active\r\n\r\n ",
+
+ ["keyword", "state"],
+ " Active ",
+ ["punctuation", "{"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " NumLockOff\r\n NumLockOff ",
+ ["arrow", "-->"],
+ " NumLockOn ",
+ ["operator", ":"],
+ " EvNumLockPressed\r\n NumLockOn ",
+ ["arrow", "-->"],
+ " NumLockOff ",
+ ["operator", ":"],
+ " EvNumLockPressed\r\n ",
+
+ ["arrow", "--"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " CapsLockOff\r\n CapsLockOff ",
+ ["arrow", "-->"],
+ " CapsLockOn ",
+ ["operator", ":"],
+ " EvCapsLockPressed\r\n CapsLockOn ",
+ ["arrow", "-->"],
+ " CapsLockOff ",
+ ["operator", ":"],
+ " EvCapsLockPressed\r\n ",
+
+ ["arrow", "--"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " ScrollLockOff\r\n ScrollLockOff ",
+ ["arrow", "-->"],
+ " ScrollLockOn ",
+ ["operator", ":"],
+ " EvScrollLockPressed\r\n ScrollLockOn ",
+ ["arrow", "-->"],
+ " ScrollLockOff ",
+ ["operator", ":"],
+ " EvScrollLockPressed\r\n ",
+
+ ["punctuation", "}"],
+
+ ["keyword", "stateDiagram"],
+
+ ["keyword", "direction"],
+ " LR\r\n ",
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " A\r\n A ",
+ ["arrow", "-->"],
+ " B\r\n B ",
+ ["arrow", "-->"],
+ " C\r\n ",
+
+ ["keyword", "state"],
+ " B ",
+ ["punctuation", "{"],
+
+ ["keyword", "direction"],
+ " LR\r\n a ",
+ ["arrow", "-->"],
+ " b\r\n ",
+
+ ["punctuation", "}"],
+
+ "\r\n B ",
+ ["arrow", "-->"],
+ " D\r\n\r\n",
+
+ ["keyword", "stateDiagram-v2"],
+
+ ["text", "[*]"],
+ ["arrow", "-->"],
+ " Still\r\n Still ",
+ ["arrow", "-->"],
+ ["text", "[*]"],
+
+ ["comment", "%% this is a comment"],
+
+ "\r\n Still ",
+ ["arrow", "-->"],
+ " Moving\r\n Moving ",
+ ["arrow", "-->"],
+ " Still ",
+ ["comment", "%% another comment"],
+
+ "\r\n Moving ",
+ ["arrow", "-->"],
+ " Crash\r\n Crash ",
+ ["arrow", "-->"],
+ ["text", "[*]"]
+]
diff --git a/tests/languages/mermaid/inter-arrow-label_feature.test b/tests/languages/mermaid/inter-arrow-label_feature.test
new file mode 100644
index 0000000000..8c07daf5a3
--- /dev/null
+++ b/tests/languages/mermaid/inter-arrow-label_feature.test
@@ -0,0 +1,62 @@
+A -.s .- C
+A -. s .- C
+A -. "asdasd" .- C
+A -- "asdasd" --> C
+A -- "asdasd" --> C
+A -- "asdasd" .- C
+A -- "asdasd" === C
+A -- "asdasd" ==> C
+
+----------------------------------------------------
+
+[
+ "A ",
+ ["inter-arrow-label", [
+ ["arrow-head", "-."],
+ ["label", "s"],
+ ["arrow", ".-"]
+ ]],
+ " C\r\nA ",
+ ["inter-arrow-label", [
+ ["arrow-head", "-."],
+ ["label", "s"],
+ ["arrow", ".-"]
+ ]],
+ " C\r\nA ",
+ ["inter-arrow-label", [
+ ["arrow-head", "-."],
+ ["label", "\"asdasd\""],
+ ["arrow", ".-"]
+ ]],
+ " C\r\nA ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "\"asdasd\""],
+ ["arrow", "-->"]
+ ]],
+ " C\r\nA ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "\"asdasd\""],
+ ["arrow", "-->"]
+ ]],
+ " C\r\nA ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "\"asdasd\""],
+ ["arrow", ".-"]
+ ]],
+ " C\r\nA ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "\"asdasd\""],
+ ["arrow", "==="]
+ ]],
+ " C\r\nA ",
+ ["inter-arrow-label", [
+ ["arrow-head", "--"],
+ ["label", "\"asdasd\""],
+ ["arrow", "==>"]
+ ]],
+ " C"
+]
diff --git a/tests/languages/mermaid/operator_feature.test b/tests/languages/mermaid/operator_feature.test
new file mode 100644
index 0000000000..7ee9a5fbe6
--- /dev/null
+++ b/tests/languages/mermaid/operator_feature.test
@@ -0,0 +1,11 @@
+A & B
+
+: :::
+
+----------------------------------------------------
+
+[
+ "A ", ["operator", "&"], " B\r\n\r\n",
+
+ ["operator", ":"], ["operator", ":::"]
+]