mermaid-svg-bitbucket

Pre-render Mermaid diagrams to committed SVG files that display correctly in Bitbucket Cloud.

2|Updated Jul 28, 2026
One-click install
npx skills add https://github.com/mbadali25/useful-claude-add-ons --skill mermaid-svg-bitbucket-mbadali25
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mermaid-svg-bitbucket
Source: https://github.com/mbadali25/useful-claude-add-ons/tree/main/skills/mermaid-svg-bitbucket
Command: npx skills add https://github.com/mbadali25/useful-claude-add-ons --skill mermaid-svg-bitbucket-mbadali25

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @mermaid-js/mermaid-cli, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Bitbucket Cloud does not render ```mermaid fenced blocks in Markdown, so diagrams show as raw source code. Worse, naively converting with mmdc produces SVGs whose labels vanish in Bitbucket because Mermaid's default <foreignObject> labels are not painted inside <img> tags. This Skill pre-renders diagrams to Bitbucket-safe SVGs, rewrites Markdown to reference them, and verifies them in CI. ## Core Features & Use Cases - Bitbucket-safe rendering: Renders .mmd/.mermaid files and fenced blocks in Markdown to SVG with htmlLabels: false, an opaque white background, and an Atlassian-tuned palette, then hard-fails if any <foreignObject> survives. - Markdown rewriting with sidecar sources: Extracts fenced blocks to sidecar .mmd files under docs/diagrams/ and replaces them with image links, idempotently. - CI verification: A --check mode compares source and SVG content hashes from a .mermaid-svg.json manifest, distinguishing STALE, DAMAGED, and UNVERIFIED states, with a ready-made Bitbucket Pipelines snippet. - Use Case: Migrating docs from GitHub to Bitbucket and finding every architecture diagram renders as raw code — run the script, commit the SVGs and manifest, and add the verify step to pull-request builds. ## Quick Start Ask the AI to convert all Mermaid diagrams in this repository to Bitbucket-compatible SVGs and set up a Pipelines check that fails when they go stale.

Frequently Asked Questions about mermaid-svg-bitbucket

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I render Mermaid diagrams in Bitbucket Cloud?

Bitbucket Cloud does not render mermaid fenced blocks, so pre-render each diagram to SVG with mermaid-cli and reference it as a Markdown image. Commit both the .mmd source and the SVG so the pipeline can verify they stay in sync.

Why are my Mermaid SVG labels blank in Bitbucket?

Mermaid's default htmlLabels setting puts text in <foreignObject> elements, which browsers do not paint when an SVG is loaded through an <img> tag. Set htmlLabels: false so Mermaid emits real <text> elements, and verify with grep that no foreignObject remains.

Does mermaid-cli work in Bitbucket Pipelines?

Yes, but the slim Node images lack Chromium dependencies and fonts. Install chromium and fonts-liberation, set PUPPETEER_EXECUTABLE_PATH, and pass a puppeteer config with --no-sandbox; without fonts, Mermaid mis-measures text and boxes overlap.

Can I verify diagrams are up to date without rendering in CI?

Yes. The script's --check mode runs on bare Python with no Node or Chromium: it compares source hashes and recorded SVG content hashes from the .mermaid-svg.json manifest, exiting 1 if anything is stale, damaged, or unverified.

Should I use a Bitbucket Mermaid browser extension instead of pre-rendering?

Extensions render Mermaid client-side with no build step, but only for people who install them; everyone else sees raw code. Pre-rendered SVGs work for every reader and every tool that consumes the repo, at the cost of committing build artifacts.

How do I make Mermaid SVGs readable in Bitbucket dark mode?

An SVG loaded via <img> cannot see the page theme, so use an opaque white background with a fixed light palette; it reads as a white card in dark mode. CSS prefers-color-scheme inside the SVG follows the OS setting, not Bitbucket's theme, so it is unreliable.