Repository navigation
🚨 mermaid diagrams - #3
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds Mermaid diagram examples and a cheat sheet to the repository to document common diagram types and provide ready-to-use snippets.
- Introduces individual markdown files for flowchart, sequence, state, Gantt, pie chart, ER, and user journey diagrams.
- Adds a consolidated "Mermaid Diagrams Cheat Sheet" with correct, ready-to-render examples.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| diagrams/userjourney.md | Adds a user journey mermaid diagram example. |
| diagrams/state.md | Adds a state diagram example. |
| diagrams/sequence.md | Adds a sequence diagram example. |
| diagrams/piechart.md | Adds a pie chart example. |
| diagrams/mermaid-examples.md | Adds a consolidated cheat sheet of mermaid examples (correctly formatted). |
| diagrams/gantt.md | Adds a Gantt chart example. |
| diagrams/flowchart.md | Adds a flowchart example. |
| diagrams/erdiagram.md | Adds an ER diagram example. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| A\[Start] --> B{Is it working?} | ||
|
|
||
| B -- Yes --> C\[Keep using it] | ||
|
|
||
| B -- No --> D\[Fix it] | ||
|
|
||
| D --> B |
There was a problem hiding this comment.
The HTML entity and the escaped square brackets (\[ \]) will render literally inside the mermaid code block and break diagram parsing. Use normal spaces for indentation and unescaped brackets: e.g., replace ' A\[Start]' with ' A[Start]'. Apply the same change to lines 7, 9, and 11.
| A\[Start] --> B{Is it working?} | |
| B -- Yes --> C\[Keep using it] | |
| B -- No --> D\[Fix it] | |
| D --> B | |
| A[Start] --> B{Is it working?} | |
| B -- Yes --> C[Keep using it] | |
| B -- No --> D[Fix it] | |
| D --> B |
| \[\*] --> Idle | ||
|
|
||
| Idle --> Running : Start | ||
|
|
||
| Running --> Idle : Stop | ||
|
|
||
| Running --> Error : Crash | ||
|
|
||
| Error --> Idle : Reset |
There was a problem hiding this comment.
Using and escaping the initial state token '\[\]' will cause mermaid parsing errors. Replace ' ' with normal spaces and use the proper mermaid syntax '[]': e.g., '[*] --> Idle', and similarly unescape the rest.
| \[\*] --> Idle | |
| Idle --> Running : Start | |
| Running --> Idle : Stop | |
| Running --> Error : Crash | |
| Error --> Idle : Reset | |
| [*] --> Idle | |
| Idle --> Running : Start | |
| Running --> Idle : Stop | |
| Running --> Error : Crash | |
| Error --> Idle : Reset |
| USER ||--o{ ORDER : places | ||
|
|
||
| ORDER ||--|{ LINE\_ITEM : contains | ||
|
|
||
| USER { | ||
|
|
||
| int id | ||
|
|
||
| string name | ||
|
|
||
| string email | ||
|
|
||
| } | ||
|
|
||
| ORDER { | ||
|
|
||
| int id | ||
|
|
||
| date orderDate | ||
|
|
||
| } | ||
|
|
||
| LINE\_ITEM { | ||
|
|
||
| int id | ||
|
|
||
| int quantity | ||
|
|
||
| } |
There was a problem hiding this comment.
The entity and escaped underscores (LINE\_ITEM) will break mermaid ER parsing. Use normal spaces and unescaped identifiers: 'LINE_ITEM'. Apply this to the relationship line (7) and the entity declaration (27), and remove ' ' across the file.
| USER ||--o{ ORDER : places | |
| ORDER ||--|{ LINE\_ITEM : contains | |
| USER { | |
| int id | |
| string name | |
| string email | |
| } | |
| ORDER { | |
| int id | |
| date orderDate | |
| } | |
| LINE\_ITEM { | |
| int id | |
| int quantity | |
| } | |
| USER ||--o{ ORDER : places | |
| ORDER ||--|{ LINE_ITEM : contains | |
| USER { | |
| int id | |
| string name | |
| string email | |
| } | |
| ORDER { | |
| int id | |
| date orderDate | |
| } | |
| LINE_ITEM { | |
| int id | |
| int quantity | |
| } |
| title Project Timeline | ||
|
|
||
| dateFormat YYYY-MM-DD | ||
|
|
||
| section Planning | ||
|
|
||
| Research :a1, 2025-09-22, 5d | ||
|
|
||
| Design :after a1, 3d | ||
|
|
||
| section Development | ||
|
|
||
| Implementation :2025-09-30, 10d | ||
|
|
||
| Testing :2025-10-10, 5d |
There was a problem hiding this comment.
The literal ' ' entities inside the mermaid code block will prevent the Gantt chart from rendering. Replace them with normal spaces so mermaid sees valid syntax.
| title Project Timeline | |
| dateFormat YYYY-MM-DD | |
| section Planning | |
| Research :a1, 2025-09-22, 5d | |
| Design :after a1, 3d | |
| section Development | |
| Implementation :2025-09-30, 10d | |
| Testing :2025-10-10, 5d | |
| title Project Timeline | |
| dateFormat YYYY-MM-DD | |
| section Planning | |
| Research :a1, 2025-09-22, 5d | |
| Design :after a1, 3d | |
| section Development | |
| Implementation :2025-09-30, 10d | |
| Testing :2025-10-10, 5d |
| "JavaScript" : 40 | ||
|
|
||
| "Python" : 30 | ||
|
|
||
| "Java" : 20 | ||
|
|
||
| "C++" : 10 |
There was a problem hiding this comment.
The ' ' HTML entities will render as text and break the pie chart. Replace with normal spaces so the values parse correctly.
| "JavaScript" : 40 | |
| "Python" : 30 | |
| "Java" : 20 | |
| "C++" : 10 | |
| "JavaScript" : 40 | |
| "Python" : 30 | |
| "Java" : 20 | |
| "C++" : 10 |
| participant User | ||
|
|
||
| participant Server | ||
|
|
||
| User->>Server: Login Request | ||
|
|
||
| Server-->>User: Authentication Token | ||
|
|
||
| User->>Server: Get Data | ||
|
|
||
| Server-->>User: Response Data |
There was a problem hiding this comment.
The ' ' entities will appear as literal text and cause the sequence diagram to fail. Replace with regular spaces; indentation is optional in mermaid but must be plain spaces if used.
| participant User | |
| participant Server | |
| User->>Server: Login Request | |
| Server-->>User: Authentication Token | |
| User->>Server: Get Data | |
| Server-->>User: Response Data | |
| participant User | |
| participant Server | |
| User->>Server: Login Request | |
| Server-->>User: Authentication Token | |
| User->>Server: Get Data | |
| Server-->>User: Response Data |
| title Shopping Experience | ||
|
|
||
| section Browse | ||
|
|
||
| User: Happy : 5 | ||
|
|
||
| Website: Confused : 2 | ||
|
|
||
| section Checkout | ||
|
|
||
| User: Frustrated : 3 | ||
|
|
||
| Website: Neutral : 3 | ||
|
|
||
| section Payment | ||
|
|
||
| User: Satisfied : 4 | ||
|
|
||
| Website: Happy : 5 |
There was a problem hiding this comment.
The use of ' ' inside the mermaid code fence will break the journey diagram. Replace with standard spaces so mermaid recognizes 'title', 'section', and the rating lines correctly; apply throughout the file.
| title Shopping Experience | |
| section Browse | |
| User: Happy : 5 | |
| Website: Confused : 2 | |
| section Checkout | |
| User: Frustrated : 3 | |
| Website: Neutral : 3 | |
| section Payment | |
| User: Satisfied : 4 | |
| Website: Happy : 5 | |
| title Shopping Experience | |
| section Browse | |
| User: Happy : 5 | |
| Website: Confused : 2 | |
| section Checkout | |
| User: Frustrated : 3 | |
| Website: Neutral : 3 | |
| section Payment | |
| User: Satisfied : 4 | |
| Website: Happy : 5 |
|
|
||
| Running --> Error : Crash | ||
|
|
||
| Error --> Idle : Reset |
There was a problem hiding this comment.
Same issue as above: ' ' must be removed so the transition 'Error --> Idle : Reset' is valid mermaid syntax.
A Mermaid diagram is a text-based way to create diagrams and visualizations. Instead of dragging boxes and arrows in a tool, you write simple plain text code, and Mermaid renders it into a nice diagram.
It’s especially popular in GitHub READMEs and documentation because you can keep the diagram version-controlled as text.
🔹 Types of Diagrams Mermaid Supports
Flowcharts (flowchart TD)
Sequence diagrams (showing interactions over time)
Class diagrams (UML-like)
State diagrams
Gantt charts (timelines)
Pie charts
ER diagrams (Entity–Relationship)
User journey diagrams
🔹 Why it’s Useful
Text-based → easy to store in Git repos, review in PRs.
No external design tool needed.
Auto-updates with changes (no need to redraw).
Works in GitHub, GitLab, VS Code, Notion, Obsidian, etc.
mermaid-examples.pdf