ASCII to Mermaid Diagram Conversion¶
This document demonstrates the conversion of ASCII diagrams to Mermaid diagrams for better visualization in the documentation.
Example 1: Basic Workflow¶
Original ASCII Diagram¶
Converted Mermaid Diagram¶
flowchart LR
A[Start] --> B[Create RBAC]
B --> C[Generate Token]
C --> D[Execute Scan]
D --> E[Run Results]
E --> F[End]
style A fill:#f9f,stroke:#333,stroke-width:2px
style D fill:#bbf,stroke:#333,stroke-width:2px
style F fill:#f9f,stroke:#333,stroke-width:2px
Example 2: Container Relationships¶
Original ASCII Diagram¶
Converted Mermaid Diagram¶
flowchart TD
subgraph Pod
A[Application Container] <--> B[Sidecar Scanner]
A --> C[Shared Process Namespace]
B --> C
end
style A fill:#bbf,stroke:#333,stroke-width:2px
style B fill:#bfb,stroke:#333,stroke-width:2px
style C fill:#fbb,stroke:#333,stroke-width:2px
Example 3: Approach Decision Tree¶
Original ASCII Diagram¶
Converted Mermaid Diagram¶
flowchart TD
A{Container Type?} -->|Standard| B[Kubernetes API Approach]
A -->|Distroless| C{Debug Available?}
C -->|Yes| D[Debug Container Approach]
C -->|No| E[Sidecar Approach]
style A fill:#fbb,stroke:#333,stroke-width:2px
style B fill:#bfb,stroke:#333,stroke-width:2px
style C fill:#fbb,stroke:#333,stroke-width:2px
style D fill:#bbf,stroke:#333,stroke-width:2px
style E fill:#bbf,stroke:#333,stroke-width:2px
Conversion Benefits¶
Converting ASCII diagrams to Mermaid offers several advantages:
- Improved readability - Mermaid diagrams are more visually appealing and easier to read
- Theme compatibility - Mermaid diagrams adapt to light/dark themes automatically
- Maintainability - Mermaid syntax is more structured and easier to modify
- Interactive features - Diagrams can be made interactive with clickable elements
- Consistency - Unified diagram style across the documentation
Conversion Process¶
When converting ASCII to Mermaid:
- Identify the core elements and relationships in the ASCII diagram
- Choose the appropriate Mermaid diagram type (flowchart, sequence, etc.)
- Map each ASCII element to its Mermaid counterpart
- Add styling to improve visual clarity
- Test the diagram in both light and dark modes
Example Syntax Comparison¶
ASCII Syntax (difficult to maintain)¶
Mermaid Syntax (structured and maintainable)¶
Which renders as:
flowchart TD
A[Start] --> B[Middle Step]
B --> C[End Step]
style A fill:#f9f,stroke:#333,stroke-width:2px
style C fill:#f9f,stroke:#333,stroke-width:2px