mirror of
https://github.com/TGITS/fun-with-mkdocs.git
synced 2026-03-28 17:42:47 +01:00
feat(wip_for_article)
Finalisation of the site for the article
This commit is contained in:
@@ -106,17 +106,47 @@ frequencies.entrySet().iterator().forEachRemaining(System.out::println);
|
|||||||
|
|
||||||
## Diagrams with Mermaid examples
|
## Diagrams with Mermaid examples
|
||||||
|
|
||||||
Hereafter an example with a sequence diagram but any diagram supporrted by [mermaid](https://mermaid.js.org/) is possible.
|
Hereafter an example with a class and a sequence diagram (inspired by the [Visitor Pattern](https://refactoring.guru/design-patterns/visitor)) but any diagram supported by [mermaid](https://mermaid.js.org/) is possible.
|
||||||
|
|
||||||
``` mermaid
|
```mermaid
|
||||||
|
classDiagram
|
||||||
|
class Visitor{
|
||||||
|
+visit(ConcreteElementA element)
|
||||||
|
+visit(ConcreteElementB element)
|
||||||
|
}
|
||||||
|
|
||||||
|
<<interface>> Visitor
|
||||||
|
|
||||||
|
class ConcreteVisitorA {
|
||||||
|
+visit(ConcreteElementA element)
|
||||||
|
+visit(ConcreteElementB element)
|
||||||
|
}
|
||||||
|
|
||||||
|
Visitor <|.. ConcreteVisitorA
|
||||||
|
|
||||||
|
class Element{
|
||||||
|
+accept(Visitor visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
<<interface>> Element
|
||||||
|
|
||||||
|
class ConcreteElementA{
|
||||||
|
+accept(Visitor visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConcreteElementB{
|
||||||
|
+accept(Visitor visitor)
|
||||||
|
}
|
||||||
|
|
||||||
|
Element <.. ConcreteElementA
|
||||||
|
Element <.. ConcreteElementB
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
sequenceDiagram
|
sequenceDiagram
|
||||||
autonumber
|
client->>concreteElementA: accept(visitor)
|
||||||
Alice->>John: Hello John, how are you?
|
concreteElementA->>visitor: visit(concreteElementA)
|
||||||
loop Healthcheck
|
client->>concreteElementB: accept(visitor)
|
||||||
John->>John: Fight against hypochondria
|
concreteElementB->>visitor: visit(concreteElementA)
|
||||||
end
|
```
|
||||||
Note right of John: Rational thoughts!
|
|
||||||
John-->>Alice: Great!
|
|
||||||
John->>Bob: How about you?
|
|
||||||
Bob-->>John: Jolly good!
|
|
||||||
```
|
|
||||||
|
|||||||
Reference in New Issue
Block a user