Right-click on a DOT code block in any web page (including ChatGPT) and render it to SVG in a lightweight in-page popup.
- Context menu entry: render selection or the nearest code block
- In-page SVG popup with Close button
- Offline Graphviz via
viz.jswithfull.render.jsworker - Diagnostics check from background to content: scheme support,
viz.jspresent, worker reachable - Modular content router and UI host ready for more renderers
gptrender
├── dist
│ ├── chrome
│ │ ├── icons
│ │ ├── src
│ │ │ ├── renderers
│ │ │ │ └── renderer_graphviz.js
│ │ │ ├── background.chrome.js
│ │ │ ├── background.firefox.js
│ │ │ ├── content_bootstrap.js
│ │ │ └── content_router.js
│ │ ├── ui
│ │ │ ├── popup_host.css
│ │ │ └── popup_host.js
│ │ ├── vendor
│ │ │ └── graphviz
│ │ │ ├── full.render.js
│ │ │ └── viz.js
│ │ ├── background.js
│ │ └── manifest.json
│ ├── firefox
│ │ ├── icons
│ │ ├── src
│ │ │ ├── renderers
│ │ │ │ └── renderer_graphviz.js
│ │ │ ├── background.chrome.js
│ │ │ ├── background.firefox.js
│ │ │ ├── content_bootstrap.js
│ │ │ └── content_router.js
│ │ ├── ui
│ │ │ ├── popup_host.css
│ │ │ └── popup_host.js
│ │ ├── vendor
│ │ │ └── graphviz
│ │ │ ├── full.render.js
│ │ │ └── viz.js
│ │ ├── background.js
│ │ └── manifest.json
│ └── gpt-diagrams-chrome.zip
├── icons
├── manifests
│ ├── manifest.chrome.json
│ └── manifest.firefox.json
├── src
│ ├── renderers
│ │ └── renderer_graphviz.js
│ ├── background.chrome.js
│ ├── background.firefox.js
│ ├── content_bootstrap.js
│ └── content_router.js
├── tools
│ └── build.mjs
├── ui
│ ├── popup_host.css
│ └── popup_host.js
├── vendor
│ └── graphviz
│ ├── full.render.js
│ └── viz.js
├── LICENSE
├── package.json
└── README.md
- Firefox Developer Edition or Firefox Release
- Chrome 116+ (tested on current release)
- No external services required
- npm
- Node 18 or newer
- Open
about:debugging - This Firefox → Load Temporary Add-on → select your
manifest.json - Open a normal
httpspage - Right-click inside a DOT code block → Graph with Graphviz
Notes on restricted pages:
- Scripts do not run on
about:*,addons.mozilla.org, Reader View, built-in PDF viewer, orview-source:. Use a normalhttporhttpspage.file://works if your manifest matches file URLs and you enable file access.
- Create or download the extension zip
- Unzip it to a folder on disk
- Visit
chrome://extensions - Toggle Developer mode on
- Click Load unpacked and choose the unzipped folder
- Optional: toggle Allow access to file URLs if you want to render on
file://pages
To update later, replace files in that folder and click Reload on the card in chrome://extensions.
Two ways to render:
- Highlight any DOT snippet, right click, choose Graph with Graphviz
- Right click inside a code block that contains DOT, choose Graph with Graphviz
A popup appears with the SVG. Close it with the button in the header.
digraph G {
rankdir=TB;
a -> b -> c;
a -> c;
}When using <TABLE> labels, you must escape & as &. The router tries to be forgiving, but it is best practice to write them correctly.
content.jslistens for background probes and render requests- Background creates the context menu and sends a GRAPHVIZ_DIAG ping to verify:
- Page scheme is
http,https, orfile window.Vizis presentvendor/full.render.jsis reachable viabrowser.runtime.getURL
- Page scheme is
- If checks pass, background sends GRAPHVIZ_RENDER with either the selection or a null payload
content.jsfinds DOT text when null is provided, renders viaviz.jsand inserts an SVG popup
contextMenusto add the right-click itemactiveTabandtabsto message content and inject alerts into the page<all_urls>so the content script can detect code blocks where allowed
-
The message says content scripts are not running
You are on a restricted page, or the URL scheme is unsupported. Try a normalhttpspage. For local files, enable file access. -
Viz is not defined
Ensurevendor/viz.jsloads beforecontent.jsinmanifest.json. Reload the extension, then refresh the tab. -
Worker not reachable
Confirmvendor/full.render.jsis present and listed underweb_accessible_resourcesin the manifest. Paths must match exactly. -
No popup appears
Open the page console. Look for[Graphviz]from content or[Graphviz BG]from background. Errors will include the reason. -
documentElement is null
Ensure content init runs after DOM is ready. UseDOMContentLoadedif you start work very early.
- Rendering is fully local
- No network requests aside from loading the worker from the extension bundle
- No data leaves the browser
Optional modules as separate renderers and assets:
- Mermaid (
vendor/mermaid/mermaid.min.js) - Cytoscape.js (
vendor/cytoscape/cytoscape.min.js) - ECharts (
vendor/echarts/echarts.min.js)
Additions will require:
- Vendor files under
vendor/ - Web accessible entries in
manifest.json - Detection plus dispatch in
content.js
viz.jsandfull.render.jsare MIT licensed. Keep their headers.- Repo code is covered by the LICENSE in this project.