Skip to content

feat(react): render ```dot code blocks as Graphviz diagrams - #1126

Open
ovflowd wants to merge 4 commits into
feat/typedocfrom
feat/graphviz-diagrams
Open

ovflowd wants to merge 4 commits into
feat/typedocfrom
feat/graphviz-diagrams

Conversation

@ovflowd

@ovflowd ovflowd commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Description

This PR renders dot code blocks as Graphviz diagrams (inline SVG) when the optional @hpcc-js/wasm-graphviz peer dependency is installed. Without it, they stay code blocks, so nothing changes for sites that don't use diagrams.

Colors written as ${light|dark} (e.g. color="${#3c3c43|#dfdfd6}") render the diagram once per color scheme, and ui/index.css shows the one matching data-theme.

Graphviz loads once per worker at import time, like Shiki, since the Markdown pipeline runs synchronously.

This is part of a proof of concept of migrating rolldown.rs from VitePress to doc-kit. Rolldown's docs have 8 Graphviz diagrams, which currently need a custom pre-build step.

Validation

  • Tests for the plugin: dot blocks become inline SVG, other code blocks are left alone, and themed colors render a light and a dark diagram.
  • Rolldown's diagrams render in both color schemes, links inside them included.

Related Issues

Part of the Rolldown docs migration PoC: rolldown/rolldown#11072. It's the middle of a stack: #1125 (TypeDoc plugin) → #1126 (Graphviz diagrams) → #1127 (llms-full), each targeting the one below. The changes don't depend on each other, the stack just keeps them reviewable one at a time while the Rolldown PoC builds from the top branch.

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run node --run test and all tests passed.
  • I have check code formatting with node --run format:check & node --run lint.
  • I've covered new added functionality with unit tests if necessary.

@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api-docs-tooling Ready Ready Preview Oct 3, 2026 2:23pm UTC

Request Review

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
253bd41 2026-10-03T14:23:53.077Z View logs ↗
  • Build: Failed ❌

View logs ↗
26da706 2026-10-03T14:14:21.888Z View logs ↗
  • Build: Failed ❌

View logs ↗
0c55f75 2026-10-03T13:25:59.249Z View logs ↗
  • Build: Failed ❌

View logs ↗
68db2e6 2026-10-03T13:14:34.979Z View logs ↗
  • Build: Failed ❌

View logs ↗
b3c28ef 2026-10-01T14:26:03.393Z View logs ↗
  • Build: Failed ❌

View logs ↗
c5443ac 2026-10-01T13:26:44.633Z View logs ↗

@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.54098% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.94%. Comparing base (ea26c1e) to head (253bd41).

Files with missing lines Patch % Lines
...kages/react/src/jsx-ast/utils/plugins/diagrams.mjs 96.05% 3 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           feat/typedoc    #1126      +/-   ##
================================================
+ Coverage         92.92%   92.94%   +0.02%     
================================================
  Files               260      262       +2     
  Lines             25219    25341     +122     
  Branches           2573     2589      +16     
================================================
+ Hits              23434    23553     +119     
- Misses             1763     1766       +3     
  Partials             22       22              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

api-links Generator

Performance estimate (single CI run)

  • Generation time: unchanged (1.43 s → 1.43 s)
  • Peak memory: 18.6% higher (369.57 MB → 438.46 MB)

json Generator

Performance estimate (single CI run)

  • Generation time: 20.5% slower (7.71 s → 9.29 s)
  • Peak memory: 4.0% higher (1.49 GB → 1.55 GB)

legacy-html Generator

Performance estimate (single CI run)

  • Generation time: 37.2% faster (45.49 s → 28.55 s)
  • Peak memory: 1.7% lower (2.47 GB → 2.43 GB)

legacy-json Generator

Performance estimate (single CI run)

  • Generation time: 48.3% slower (5.30 s → 7.86 s)
  • Peak memory: 6.9% lower (1.81 GB → 1.68 GB)

llms-txt Generator

Performance estimate (single CI run)

  • Generation time: 2.0% slower (7.66 s → 7.81 s)
  • Peak memory: 0.6% higher (1.44 GB → 1.44 GB)

orama-db Generator

Output size: 1 file changed · net +150.00 B

File size details
File Main PR Change
orama-db.json 9.55 MB 9.55 MB +150.00 B (+0.0%)

Performance estimate (single CI run)

  • Generation time: 7.5% slower (7.86 s → 8.45 s)
  • Peak memory: 3.3% lower (1.80 GB → 1.74 GB)

web Generator

Output size: 2 files changed · net +201.00 B

File size details
File Main PR Change
assets/style-Dpi-h_PZ.css — 137.38 KB +137.38 KB
assets/style-CgRaeUUe.css 137.19 KB — -137.19 KB (-100.0%)

Performance estimate (single CI run)

  • Generation time: 20.9% faster (66.32 s → 52.44 s)
  • Peak memory: 3.6% higher (3.17 GB → 3.29 GB)

@ovflowd
ovflowd marked this pull request as ready for review October 1, 2026 14:14
@ovflowd
ovflowd requested a review from a team as a code owner October 1, 2026 14:14
@ovflowd
ovflowd force-pushed the feat/graphviz-diagrams branch from c5443ac to b3c28ef Compare October 1, 2026 14:24
@ovflowd
ovflowd changed the base branch from main to feat/typedoc October 1, 2026 14:24
@ovflowd
ovflowd added this pull request to stack #1143 October 1, 2026 14:28
@avivkeller

Copy link
Copy Markdown
Member

We support the ability for consumers to define their own plugins, wouldn't this be better as a consumer plugin than in core? wdyt @nodejs/web

@AugustinMauroy

Copy link
Copy Markdown
Member

We support the ability for consumers to define their own plugins, wouldn't this be better as a consumer plugin than in core? wdyt @nodejs/web

IMO this part can be usefull for learn so let's include it in doc-kit

@avivkeller

Copy link
Copy Markdown
Member

i mean, this is just a remark plugin, so i think it makes more sense for consumers to just import a plugin into their configurations

When the optional `@hpcc-js/wasm-graphviz` dependency is installed, ```dot code blocks become inline SVG diagrams. Colors written as `${light|dark}` render a diagram per color scheme.

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
@ovflowd
ovflowd force-pushed the feat/graphviz-diagrams branch from 26da706 to 253bd41 Compare October 3, 2026 14:23

This branch was successfully deployed

1 active deployment
Preview – api-docs-tooling — 253bd416 Deployed Oct 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants