Transform your Knowledge articles with beautiful, interactive diagrams
Features β’ Installation β’ Usage β’ Diagram Types β’ Technical β’ License
Mermaid Diagrams brings the power of Mermaid.js directly into Odoo's HTML editor. Create flowcharts, sequence diagrams, Gantt charts, and moreβall rendered live inside your Knowledge articles, website pages, and any HTML field.
No external tools. No image exports. Just type your diagram code and watch it come to life.
A business process flowchart rendered directly in Odoo Knowledge β dark mode adaptive!
| Feature | Description |
|---|---|
| π¨ Live Rendering | Diagrams render instantly as you type |
| π Theme Adaptive | Automatically matches Odoo's light/dark mode |
| π Native Integration | Works seamlessly in code blocksβno plugins needed |
| π Secure | Strict security mode prevents XSS attacks |
| πΎ Persistent | Diagrams save correctly with your content |
| βΏ Accessible | Full keyboard navigation and ARIA support |
cd /path/to/odoo/addons
git clone https://github.com/K11E3R/mermaid_diagram.git- Download from GitHub Releases
- Extract to your Odoo addons directory
- Restart Odoo server
- Go to Apps β Update Apps List
- Search for "Mermaid Diagrams"
- Click Install
Dependencies: This module requires the
html_editormodule (included in Odoo 19 core).
Creating diagrams is simple and intuitive. Follow these 3 easy steps:
Type /code in any Knowledge article or HTML field to open the command menu, then select Code:
Click the language dropdown (shows "Plain Text" by default) and select Mermaid from the list:
Enter your Mermaid syntax and watch it render automatically:
π Your diagram is ready! Click on it anytime to edit.
Mermaid supports a wide variety of diagram types:
flowchart TD
A[Start] --> B{Is it working?}
B -->|Yes| C[Great!]
B -->|No| D[Debug]
D --> B
C --> E[Deploy]
sequenceDiagram
participant U as User
participant O as Odoo
participant D as Database
U->>O: Create Sales Order
O->>D: Save Record
D-->>O: Confirmation
O-->>U: Order Created
gantt
title Project Timeline
dateFormat YYYY-MM-DD
section Phase 1
Analysis :a1, 2024-01-01, 7d
Design :a2, after a1, 5d
section Phase 2
Development :a3, after a2, 14d
Testing :a4, after a3, 7d
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
PRODUCT ||--o{ LINE_ITEM : "ordered in"
pie title Sales by Region
"North" : 45
"South" : 25
"East" : 20
"West" : 10
stateDiagram-v2
[*] --> Draft
Draft --> Confirmed: Confirm
Confirmed --> Done: Complete
Confirmed --> Cancelled: Cancel
Done --> [*]
Cancelled --> [*]
classDiagram
class SaleOrder {
+String name
+Date date_order
+Float amount_total
+action_confirm()
+action_cancel()
}
class SaleOrderLine {
+Product product_id
+Float quantity
+Float price_unit
}
SaleOrder "1" --> "*" SaleOrderLine
π Full documentation: Mermaid.js Docs
mermaid_diagram/
βββ __manifest__.py # Module metadata
βββ __init__.py # Python package init
βββ static/
β βββ description/
β β βββ icon.png # Module icon
β β βββ banner.jpeg # App store banner
β β βββ index.html # App store description
β βββ src/
β βββ syntax_highlighting_patch.js # Core rendering logic
β βββ mermaid_rendering/
β βββ mermaid_styles.scss # Styling
- Patches Odoo's HTML Editor - Extends
EmbeddedSyntaxHighlightingComponentto recognize Mermaid as a language option - Lazy Loads Mermaid.js - Fetches Mermaid 11.x from CDN only when needed
- Theme Detection - Reads Odoo's
data-color-schemeattribute and adapts colors - Source Preservation - Stores original source as base64 in HTML comments for reliable persistence
| Browser | Version |
|---|---|
| Chrome | 90+ |
| Firefox | 88+ |
| Safari | 14+ |
| Edge | 90+ |
- CDN-based loading: Mermaid library loads only when first diagram is rendered
- Render caching: Diagrams only re-render when source changes
- Lazy initialization: Zero impact on pages without Mermaid blocks
The module automatically adapts to Odoo's theme:
| Element | Light Mode | Dark Mode |
|---|---|---|
| Primary Color | #714B67 (Odoo Purple) |
#4a90a4 (Soft Blue) |
| Background | Transparent | Transparent |
| Text | #374151 |
#e5e7eb |
| Borders | #e5e7eb |
#4b5563 |
Custom CSS variables from your Odoo theme are respected:
--o-brand-primary--o-main-text-color--o-view-background-color
- Check syntax - Switch to "Plain Text" to edit raw code
- Verify Mermaid syntax - Use Mermaid Live Editor to validate
- Check browser console - Look for JavaScript errors
This is fixed in v19.0.1.0.0. The module now embeds source code as base64 comments for reliable persistence.
Clear browser cache and reload. The module reads CSS variables on initialization.
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m '[ADD] feature: description') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Clone repo
git clone https://github.com/K11E3R/mermaid_diagram.git
# Add to Odoo addons path
# Update your odoo.conf or use --addons-path
# Install in developer mode
./odoo-bin -d your_db -u mermaid_diagram --dev=allBuilt with β€οΈ for the Odoo community
β Star this repo β’ π Report Bug β’ π‘ Request Feature



