DangQuangSE/team-development-skills / .codex/skills/mermaidjs-v11
mermaidjs-v11
VerifiedCreate diagrams and visualizations using Mermaid.js v11 syntax. Use when generating flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, user journeys, timelines, architecture diagrams, or any of 24+ diagram types. Supports JavaScript API integration, CLI rendering to SVG/PNG/PDF, theming, configuration, and accessibility features. Essential for documentation, technical diagrams, project planning, system architecture, and visual communication.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.3 KB |
| agents/openai.yaml | config | 365 B |
| references/cli-usage.md | markdown | 4.1 KB |
| references/configuration.md | markdown | 4.6 KB |
| references/diagram-types.md | markdown | 4.9 KB |
| references/examples.md | markdown | 7.0 KB |
| references/integration.md | markdown | 5.7 KB |
references/configuration.md
View on GitHub# Mermaid.js Configuration & Theming
Configuration options, theming, and customization for Mermaid.js v11.
## Configuration Methods
**1. Site-wide Initialization:**
```javascript
mermaid.initialize({
theme: 'dark',
startOnLoad: true,
securityLevel: 'strict',
fontFamily: 'Arial'
});
```
**2. Diagram-level Frontmatter:**
````markdown
```mermaid
---
theme: forest
look: handDrawn
---
flowchart TD
A --> B
```
````
**3. Configuration Hierarchy:**
Default config → Site config → Diagram config (highest priority)
## Core Options
**Rendering:**
- `startOnLoad`: Auto-render on page load (default: true)
- `securityLevel`: "strict" (default), "loose", "antiscript", "sandbox"
- `deterministicIds`: Reproducible SVG IDs (default: false)
- `maxTextSize`: Max diagram text (default: 50000)
- `maxEdges`: Max drawable edges (default: 500)
**Visual Style:**
- `look`: "classic" (default), "handDrawn"
- `handDrawnSeed`: Numeric seed for hand-drawn consistency
- `darkMode`: Boolean toggle
**Typography:**
- `fontFamily`: "trebuchet ms, verdana, arial, sans-serif" (default)
- `fontSize`: Base text size (default: 16)
**Layout:**
- `layout`: "dagre" (default), "elk", "tidy-tree", "cose-bilkent"
**Debug:**
- `logLevel`: 0-5 from trace to fatal
- `htmlLabels`: Enable HTML in labels (default: false)
## Theming
**Built-in Themes:**
- `default` - Standard colors
- `dark` - Dark background
- `forest` - Green tones
- `neutral` - Grayscale
- `base` - Fully customizable
**Theme Variables (base theme only):**
```javascript
mermaid.initialize({
theme: 'base',
themeVariables: {
primaryColor: '#ff0000',
primaryTextColor: '#fff',
primaryBorderColor: '#7C0000',
secondaryColor: '#006100',
tertiaryColor: '#fff'
}
});
```
**Customizable Variables:**
- Color families: primary, secondary, tertiary
- Node backgrounds and text colors
- Border and line colors
- Note background/text
- Diagram-specific (flowchart nodes, sequence actors, pie sections)
**Custom CSS:**
```javascript
mermaid.initialize({
themeCSS: `
.node rect { fill: #f9f; }
.edgeLabel { background-color: white; }
`
});
```
## Accessibility
**ARIA Support:**
```
accTitle: Diagram Title
accDescr: Brief description
accDescr {
Multi-line detailed
description
}
```
**Auto-generated:**
- `aria-roledescription` attributes
- `<title>` and `<desc>` SVG elements
- `aria-labelledby` and `aria-describedby`
**WCAG Compliance:**
Available for all diagram types (flowchart, sequence, class, Gantt, etc.)
## Icon Configuration
**Register Icon Packs:**
```javascript
import { registerIconPacks } from 'mermaid';
registerIconPacks([
{
name: 'logos',
loader: () => import('https://esm.run/@iconify-json/logos')
}
]);
```
**Usage:**
```
architecture-beta
service api(logos:nodejs)[API]
```
**Loading Methods:**
1. CDN-based (lazy loading)
2. npm with dynamic import
3. Direct import
## Math Rendering
**KaTeX Support:**
```
graph LR
A["$$f(x) = x^2$$"] --> B
```
**Configuration:**
- `legacyMathML`: Use old MathML rendering
- `forceLegacyMathML`: Force legacy even if browser supports native
## Security
**Security Levels:**
- `strict` - HTML encoding (default, recommended)
- `loose` - Some HTML allowed
- `antiscript` - Filter scripts
- `sandbox` - Sandboxed mode
**DOMPurify:**
Enabled by default for XSS protection. Customize via `dompurifyConfig` (use caution).
## Layout Algorithms
**dagre (default):**
Standard hierarchical layout for most diagrams.
**elk:**
Advanced layout with better handling of complex graphs.
**tidy-tree:**
Clean tree structures for hierarchies.
**cose-bilkent:**
Compound graph layout for nested structures.
**Per-diagram Configuration:**
````markdown
```mermaid
---
layout: elk
---
flowchart TD
A --> B
```
````
## Common Patterns
**Consistent Hand-drawn Style:**
```javascript
mermaid.initialize({
look: 'handDrawn',
handDrawnSeed: 42 // Same seed = consistent appearance
});
```
**Dark Mode Toggle:**
```javascript
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
mermaid.initialize({
theme: isDark ? 'dark' : 'default'
});
```
**Performance Optimization:**
```javascript
mermaid.initialize({
startOnLoad: false, // Manual rendering
maxEdges: 1000, // Increase for complex graphs
deterministicIds: true // Caching-friendly
});
```
## Validation
**Parse without Rendering:**
```javascript
try {
await mermaid.parse('graph TD\nA-->B');
console.log('Valid syntax');
} catch(e) {
console.error('Invalid:', e);
}
```
**Programmatic Rendering:**
```javascript
const { svg } = await mermaid.render('graphId', 'graph TD\nA-->B');
document.getElementById('output').innerHTML = svg;
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |