Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you specify Mermaid configuration within Gitlab Markdown?

In Gitlab, I've been able to render an Entity Relationship Diagram with Mermaid in a Markdown file as specified here.

This is the Markdown I used:

```mermaid
erDiagram
        CUSTOMER }|..|{ DELIVERY-ADDRESS : has
        CUSTOMER ||--o{ ORDER : places
        CUSTOMER ||--o{ INVOICE : "liable for"
        DELIVERY-ADDRESS ||--o{ ORDER : receives
        INVOICE ||--|{ ORDER : covers
        ORDER ||--|{ ORDER-ITEM : includes
        PRODUCT-CATEGORY ||--|{ PRODUCT : contains
        PRODUCT ||--o{ ORDER-ITEM : "ordered in"
                    
```

The mermaid interactive editor provides an example of configuration:

{
  "theme": "default"
}

But I don't know where to locate that configuration information. I've tried putting it in the same directory, in a file called config.json or mermaid-config.json, but neither of those have worked. I also tried including it in the Markdown which defined the diagram, which only caused it to render incorrectly. Is there a way to specify the theme or other CSS elements for Gitlab?

like image 353
John D Avatar asked Dec 21 '25 12:12

John D


1 Answers

Just tried it out and it worked

 ```mermaid 
 %%{init: { 'theme':'dark', 'sequence': {'useMaxWidth':false} } }%%
 sequenceDiagram 
   alice ->> mark: Sent a flower
 ```
like image 115
D S Avatar answered Dec 24 '25 11:12

D S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!