Markdown Diagram Renderer
markdown.render_diagrams
Overview
You send Markdown containing exact ```mermaid fenced blocks. An evidence-backed allowlist of 25 Mermaid families is rendered by an identity-bound isolated worker and sanitized with a closed SVG policy. Unsupported families, caller configuration, HTML labels, scripts, click directives, URLs, CSS, and arbitrary Mermaid options are rejected. Other code fences remain ordinary code. Accepts file input via file_ref — no need to extract file content first.
Mermaid needs an isolated deterministic runtime and a separate closed SVG security boundary; ordinary Markdown rendering cannot safely provide that.
Reliability
STRICT for Mermaid 11.16.0, the pinned light DOM, Noto Sans package, worker identity, parser, theme, and SVG policy. The allowlist is closed and evidence-backed from the full-family spike: 25 SUPPORTED, kanban deferred as SUPPORTED_WITH_LIMITS, and remaining families UNSUPPORTED with proved reasons. Failures include DIAGRAM_SYNTAX_INVALID, DIAGRAM_TYPE_UNSUPPORTED, RENDERER_BUSY, RENDER_TIMEOUT, INTERNAL_RENDERER_UNAVAILABLE, DIAGRAM_SANITIZATION_FAILED, OUTPUT_LIMIT_EXCEEDED, MARKDOWN_INVALID_ENCODING (re-encode the source as UTF-8), and MARKDOWN_COMPLEXITY_LIMIT (split or simplify a document exceeding the fixed node or nesting cap).
Context footprint
At most 50 diagrams, 50000 characters per diagram, 1000000 bytes per SVG, 2000000 aggregate output bytes, and 30000 ms per diagram. A successful call costs 5 execution credits.
When to use it
When a Markdown document contains one of the 25 evidence-backed Mermaid families.
When diagrams need interaction, external resources, caller configuration, or a Mermaid family outside the SUPPORTED allowlist (for example gantt, mindmap, sankey, architecture, kanban, flowchart-elk). Upstream Mermaid support alone does not make a family supported here.
Powered by Mermaid 11.16.0 on pinned jsdom/svgdom and Noto Sans.
Scope
Non-goals
- No arbitrary Mermaid configuration
- No HTML labels
- No click handlers
- No URL loading
- No caller CSS
- No diagrams outside exact mermaid fences
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
File limits
Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.
| Limit | Value | Limited by |
|---|---|---|
| Maximum size per input file | 488.3 KiB | Skill maximum |
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify using a self-contained open-source component
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Self contained open source component
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| markdown | string | No | Inline Markdown up to 200000 characters. Required unless file_ref is present; omit only when file_ref is present. If both are present, file_ref wins and _meta._input_conflict_resolved reports it. |
| file_ref | string | No | Tenant-scoped strict UTF-8 Markdown file up to 500000 bytes. When omitted, the inline markdown field is used. |
| profile | string | No | commonmark, gfm, or squillify-safe; defaults to squillify-safe. |
| theme | string | No | squillify (default) applies the fixed Squillify Design System palette and document chrome; neutral, default, or dark preserve Mermaid's legacy palettes. |
| includeCss | boolean | No | Embed the scoped Squillify Design System stylesheet when theme is squillify; defaults to true. |
| includeSource | boolean | No | Include original Mermaid source in each diagram object; defaults to false. |
| errorPolicy | string | No | preserve_source (default) keeps invalid fences with a warning; fail rejects the call. |
| accessibility | object | No | Optional bounded plain-text title and description applied to accessible SVG; when omitted, no caller accessibility override is applied. |
| maxDiagrams | integer | No | Maximum accepted diagrams, 1..50; defaults to 50. |
| timeoutMs | integer | No | Per-diagram worker timeout, 1..30000 milliseconds; defaults to 5000. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| html | string | Yes | Sanitized rendered Markdown HTML. |
| diagrams | array | Yes | From 0 through 50 closed sanitized diagram result objects in source order. |
| warnings | array | Yes | From 0 through 50 closed skipped-diagram warning objects in source order. |
| _meta | object | Yes | Closed receipt containing parser, renderer, sanitization, and bounded-execution provenance. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"markdown.render_diagrams","input":{"markdown":"```mermaid\nflowchart LR\nA --> B\n```"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("markdown.render_diagrams", {"includeCss":false,"accessibility":{"title":"Flow","description":"A to B"},"markdown":"```mermaid\nflowchart LR\nA --> B\n```"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| DIAGRAM_SYNTAX_INVALID | 400 | No | The request payload failed this skill's input validation. |
| DIAGRAM_TYPE_UNSUPPORTED | 400 | No | The request payload failed this skill's input validation. |
| RENDERER_BUSY | 429 | Yes | A size, quota, rate, or time limit was exceeded. |
| RENDER_TIMEOUT | 503 | Yes | A dependency required by this skill is unavailable. |
| INTERNAL_RENDERER_UNAVAILABLE | 503 | Yes | A dependency required by this skill is unavailable. |
| DIAGRAM_SANITIZATION_FAILED | 500 | No | The skill encountered an unexpected execution failure. |
| MARKDOWN_INVALID_ENCODING | 400 | No | The request payload failed this skill's input validation. |
| MARKDOWN_COMPLEXITY_LIMIT | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- No arbitrary Mermaid configuration
- No HTML labels
- No click handlers
- No URL loading
- No caller CSS
- No diagrams outside exact mermaid fences
- Interactive diagrams
- Custom Mermaid themes
- Untrusted external resources
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "markdown.render_diagrams",
"input": {
"includeCss": false,
"accessibility": {
"title": "Flow",
"description": "A to B"
},
"markdown": "```mermaid\nflowchart LR\nA --> B\n```"
}
}Examples
Render a flowchart
{
"includeCss": false,
"accessibility": {
"title": "Flow",
"description": "A to B"
},
"markdown": "```mermaid\nflowchart LR\nA --> B\n```"
}{
"_meta": {
"themeVersion": "sqfy-markdown-v2",
"_input_conflict_resolved": false,
"inputChars": 23,
"rendererVersion": "11.16.0",
"parserVersion": "0.24.0",
"sanitized": true,
"diagramCount": 1,
"truncated": false,
"parser": "commonmark",
"cssIncluded": false,
"inputBytes": 23,
"renderer": "mermaid",
"profile": "squillify-safe",
"theme": "squillify",
"nodeCount": 2,
"profileVersion": "1"
},
"warnings": [],
"diagrams": [
{
"index": 0,
"type": "flowchart",
"svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" role=\"img\">...</svg>",
"sourceRange": {
"start": {
"line": 1,
"offset": 0,
"column": 1
},
"end": {
"line": 4,
"offset": 35,
"column": 4
}
},
"title": "Flow",
"description": "A to B",
"error": null
}
],
"html": "<article class=\"sqfy-markdown sqfy-markdown-v2 sqfy-theme-squillify sqfy-markdown-diagrams\"><div class=\"sqfy-diagram-slot\"><figure>...</figure></div></article>"
}Preserve source for a rejected diagram
{
"includeCss": false,
"errorPolicy": "preserve_source",
"markdown": "```mermaid\ngantt\ntitle Unsupported\n```"
}{
"_meta": {
"themeVersion": "sqfy-markdown-v2",
"_input_conflict_resolved": false,
"inputChars": 31,
"rendererVersion": "11.16.0",
"parserVersion": "0.24.0",
"sanitized": true,
"diagramCount": 1,
"truncated": false,
"parser": "commonmark",
"cssIncluded": false,
"inputBytes": 31,
"renderer": "mermaid",
"profile": "squillify-safe",
"theme": "squillify",
"nodeCount": 2,
"profileVersion": "1"
},
"warnings": [
{
"index": 0,
"code": "DIAGRAM_RENDER_SKIPPED"
}
],
"diagrams": [
{
"index": 0,
"type": "gantt",
"svg": "",
"sourceRange": {
"start": {
"line": 1,
"offset": 0,
"column": 1
},
"end": {
"line": 4,
"offset": 41,
"column": 4
}
},
"title": null,
"description": null,
"error": {
"message": "The diagram could not be rendered.",
"code": "DIAGRAM_TYPE_UNSUPPORTED"
}
}
],
"html": "<article class=\"sqfy-markdown sqfy-markdown-v2 sqfy-theme-squillify sqfy-markdown-diagrams\"><pre><code class=\"language-mermaid\">gantt\ntitle Unsupported\n</code></pre></article>"
}Recommended use cases
- Architecture and workflow documentation
- Accessible SVG diagrams embedded in Markdown
Avoid for
- Interactive diagrams
- Custom Mermaid themes
- Untrusted external resources
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.