A Firefox browser extension that renders .md files with dark mode (on by default) and full Mermaid diagram support, including the ones only supported in 10+.
- Automatic markdown rendering detects
.mdand.markdownfiles and renders them in-browser with a clean dark theme - Mermaid diagrams renders all diagram types: flowchart, sequenceDiagram, pie, gantt, classDiagram, stateDiagram, erDiagram, gitGraph, timeline, mindmap
- Dark mode by default low-eyestrain viewing for documentation-heavy workflows
- Lightweight no external dependencies beyond the bundled marked and mermaid libraries
- Works on file:// URLs renders local
.mdfiles directly from disk
- Open
about:debugging#/runtime/this-firefox - Click Load Temporary Add-on
- Select
manifest.jsonfrom the extension directory
Package the extension and sign it via addons.mozilla.org.
Once installed, navigate to any .md file in Firefox. The extension automatically:
- Detects the markdown content
- Renders it with syntax highlighting and dark styling
- Processes any Mermaid diagram blocks and converts them to SVGs
Open the popup (click the toolbar icon) for quick settings or status info.
Firefox MV3 content scripts block new Function() via the default CSP. Mermaid v11's langium parsers require it, so a direct content-script approach would fail for all diagram types.
This extension uses an iframe-based workaround:
content/render.jsdetects Mermaid code blocks in the markdown- It creates a hidden iframe pointing to
renderer/mermaid-renderer.html(an extension page that runs outside the content-script CSP) - Diagram sources are sent to the iframe via
postMessage - The iframe renders them with Mermaid and returns SVGs
- The content script inserts the rendered diagrams into the page DOM
If the iframe mechanism fails, it falls back to mermaid.render() directly.
├── manifest.json Extension manifest (Manifest v2, Firefox)
├── background.js Background script (non-persistent)
├── content/
│ ├── render.js Content script markdown detection and rendering
│ └── styles.css Rendered markdown styles (dark theme)
├── renderer/
│ └── mermaid-renderer.html Extension page for CSP-safe Mermaid rendering
├── popup/
│ └── popup.html Toolbar popup
├── lib/
│ ├── marked.min.js Markdown parser (marked)
│ └── mermaid.min.js Diagram engine (Mermaid)
├── icons/ Extension icons (SVG)
├── test-mermaid.html Test page for manual verification
├── test-playwright.js Playwright-based integration tests
├── serve-test.js HTTP server for local testing
├── package.json Playwright dependency (dev only)
├── AGENTS.md Development context (AI agent reference)
├── .omo/ Personal development files not needed for the extension itself
└── node_modules/ Playwright runtime (dev only)
# Install dev dependencies
npm install
# Run the test server
node serve-test.js
# Run Playwright tests
npx playwright test test-playwright.jsThe .omo directory contains personal development workspace files used during creation. It is not needed to build, install, or run the extension.
MIT