A Forge app (for Confluence cloud) that renders mermaid diagrams from code blocks in Confluence pages.
Resources:
- Add a code block to your Confluence page
- Write your mermaid diagram syntax inside the code block
- Add a macro using "/" key and search for "mermaid"
- The diagram will be rendered automatically on the page
This app supports all Mermaid diagram types, including:
- Flowcharts
- Sequence diagrams
- Class diagrams
- State diagrams
- Entity relationship diagrams
- And more...
This is a Forge app. Install it from the Atlassian Marketplace.
Fork and clone the repository, then install dependencies using the Node.js
version in .nvmrc:
nvm install
nvm use
cd custom-ui
yarn install --frozen-lockfileThe project has two directories:
custom-ui- The React UI for rendering diagrams (all JS tooling lives here)app- The Forge app manifest and build output
The manifest contains the upstream Forge app ID. Before deploying a fork, use
forge register to create a contributor-owned copy:
# From the repository root
cd app
forge login
forge register YOUR_GITHUB_USER-mermaid-viewerforge register rewrites app.id in app/manifest.yml. Never include that
personal ID in a commit. The full testing guide explains how to temporarily use
it for the final deployed test while keeping the upstream ID in Git history.
Build, deploy, and perform the first installation before starting a tunnel:
# From the repository root
cd custom-ui
yarn build
cd ../app
forge lint
forge deploy --environment development
forge install \
--environment development \
--site YOUR_SITE.atlassian.net \
--product confluenceFor the development loop, run Vite and the Forge tunnel in separate terminals:
# Terminal 1
cd custom-ui
yarn dev
# Terminal 2
cd app
forge tunnel --environment developmentBefore marking a pull request ready for review, stop the tunnel, rebuild and deploy, then test the bundle built from the final commit in a real Confluence Cloud site. Follow Testing a fork in Confluence for the complete setup, smoke-test matrix, evidence requirements, installation upgrades, and app ID cleanup.
# Build the custom UI
cd custom-ui
yarn build
# Deploy to your Forge app
cd ../app
forge lint
forge deploy --environment developmentRun forge install --upgrade after the deploy only when Forge modules, scopes,
permissions, or other installation metadata changed.
cd custom-ui
# Run all tests
yarn test
# Run tests with coverage
yarn test --coverage- Linting: Run
yarn lintfrom thecustom-uidirectory to check code style - Node Version: See
.nvmrcor theenginesfield incustom-ui/package.json - Package Manager: Yarn v1
Contributions to Mermaid Diagrams Viewer are welcome! Please see CONTRIBUTING.md for details.
Copyright (c) 2024 Atlassian US., Inc. Apache 2.0 licensed, see LICENSE file.

