# Mermaid class diagrams as ASCII text

Use `classDiagram` with `renderGlyphDiagram`. Class names, members, and relationship captions become text; the renderer does not execute methods.

## Classes and inheritance



```mermaid
classDiagram
 class Account {
 +String email
 +signIn() bool
 }
 class Buyer {
 +checkout() Order
 }
 class Staff {
 +refund() bool
 }
 class Order {
 +String status
 +submit()
 }
 class Line {
 +int quantity
 }
 Account <|-- Buyer
 Account <|-- Staff
 Buyer --> Order : places
 Order "1" *-- "*" Line : contains
```

```text
                             ┌────────────────┐                               
                             │     Account    │                               
                             ├────────────────┤                               
                             │ +String email  │                               
                             ├────────────────┤                               
                             │ +signIn() bool │                               
                             └──────△─△───────┘                               
                                    │ │                                       
                         ┌──────────┘ └──────────┐                            
                         │                       │                            
                 ┌────────────────┐    ┌───────────────────┐                  
                 │      Staff     │    │       Buyer       │                  
                 ├────────────────┤    ├───────────────────┤                  
                 │ +refund() bool │    │ +checkout() Order │                  
                 └────────────────┘    └───────────────────┘                  
                                                 │                            
                                          places │                            
                                                 │                            
                                         ┌───────▼────────┐                   
                                         │      Order     │                   
                                         ├────────────────┤                   
                                         │ +String status │                   
                                         ├────────────────┤                   
                                         │ +submit()      │                   
                                         └───────◆────────┘                   
                                                 │                            
                                [1] contains [*] │                            
                                                 │                            
                                         ┌───────────────┐                    
                                         │     Line      │                    
                                         ├───────────────┤                    
                                         │ +int quantity │                    
                                         └───────────────┘                    
```



## Composition and multiplicity



```mermaid
classDiagram
 class Order {
 +submit()
 }
 class Line {
 +int quantity
 }
 Order "1" *-- "*" Line : contains
```

```text
                              ┌───────────┐                     
                              │   Order   │                     
                              ├───────────┤                     
                              │ +submit() │                     
                              └─────◆─────┘                     
                                    │                           
                   [1] contains [*] │                           
                                    │                           
                            ┌───────────────┐                   
                            │     Line      │                   
                            ├───────────────┤                   
                            │ +int quantity │                   
                            └───────────────┘                   
```



## Syntax and limits

- Braced member rows form compartments below the class header. Visibility markers and generic type text remain literal.
- Inheritance and realization use triangle heads; aggregation and composition use open and filled diamonds.
- Associations, dependencies, relationship labels, quoted multiplicities, namespaces, and notes are adapted into graph nodes, groups, and captions.
- Class identifiers may contain hyphens. Spaced generic types are accepted.
- Configuration, styles, and URLs are inert and reported. Cell budgets can wrap or omit captions: inspect the fidelity report and [increase the budget](/diagrams/options/).
