Skip to content

feat(docs): build-time Mermaid rendering in docs with rehype-mermaid and Playwright#552

Open
Copilot wants to merge 12 commits intomainfrom
copilot/update-client-package-readme
Open

feat(docs): build-time Mermaid rendering in docs with rehype-mermaid and Playwright#552
Copilot wants to merge 12 commits intomainfrom
copilot/update-client-package-readme

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

Restores Mermaid diagrams in the docs app as build-time rendered SVGs using rehype-mermaid, with playwright installed as the supported renderer dependency.

Changes Made

  • Re-enabled rehype-mermaid in apps/docs/source.config.ts for build-time Mermaid rendering.
  • Added rehype-mermaid and playwright back to apps/docs and the workspace docs catalog.
  • Replaced the checked-in client-flow.svg fallback with a Mermaid fenced code block in apps/docs/content/api-reference/client/index.mdx.
  • Removed the runtime-free SVG asset that was only needed for the previous workaround.
  • Updated apps/docs/README.md to document the Playwright Chromium requirement for local docs builds.

Testing

  • ✅ Docs lint passes
  • ✅ Docs typecheck passes
  • ✅ Docs production build passes
  • ✅ Manual verification confirmed the Mermaid diagram renders on the docs page after installing Playwright Chromium

Screenshot: https://github.com/user-attachments/assets/a0188fc4-f85e-4a06-8d54-8536a19231b0


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI and others added 2 commits March 15, 2026 06:56
Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Copilot AI changed the title [WIP] Update README and document config vs wellknown differences Clarify client discovery/config docs and render the client flow diagram Mar 15, 2026
Copilot AI requested a review from luxass March 15, 2026 07:09
Refactored the `Mermaid` component to enhance readability and maintainability. Removed unnecessary state management and introduced a caching mechanism for Mermaid imports. Updated the initialization settings for Mermaid to improve rendering performance.
@github-actions
Copy link
Contributor

🌏 Preview Deployments

Application Status Preview URL
API ⏳ In Progress N/A
Store ⏳ In Progress N/A
Website ⏳ In Progress N/A
Documentation ⏳ In Progress N/A

Built from commit: 5f51feb0b7e13fab0a13c93d7dd3bbace64eaf76


🤖 This comment will be updated automatically when you push new commits to this PR.

@luxass
Copy link
Member

luxass commented Mar 15, 2026

I will hold keep this PR as a draft for now. I would like to make the mermaid chart rendering, happening at build time..

The current approach increases the final bundle with 3MB.

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@luxass
Copy link
Member

luxass commented Mar 16, 2026

@copilot can you investigate if we could make use of rehype plugins to handle the mermaid chart at build time?

https://github.com/remcohaszing/rehype-mermaid

I would prefer not to have mermaid at runtime, since it adds around 2-3MB.

Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 16, 2026

I will hold keep this PR as a draft for now. I would like to make the mermaid chart rendering, happening at build time..

The current approach increases the final bundle with 3MB.

Handled in 58bbfdf. The Mermaid diagram is now rendered at build time through the MDX pipeline, and the runtime Mermaid component/import was removed from the docs app. Screenshot: https://github.com/user-attachments/assets/dc68d0d7-2c13-44a6-aa97-391fa710efa7

@copilot can you investigate if we could make use of rehype plugins to handle the mermaid chart at build time?

https://github.com/remcohaszing/rehype-mermaid...

Investigated and switched it over in 58bbfdf. apps/docs/source.config.ts now uses rehype-mermaid at build time, the docs page uses a normal mermaid fenced block again, and the runtime Mermaid component was removed so the client bundle no longer imports Mermaid directly. Screenshot: https://github.com/user-attachments/assets/dc68d0d7-2c13-44a6-aa97-391fa710efa7

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/ucd/ucd/apps/docs/node_modules/.bin/../vite/bin/vite.js dev --port 3001 --host 0.0.0.0 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@luxass
Copy link
Member

luxass commented Mar 16, 2026

@copilot can you rebase the PR onto main? So we have the latest changes.

Also I dont think we need playwright. Let's remove it!

Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 16, 2026

@copilot can you rebase the PR onto main? So we have the latest changes.

Also I dont think we need playwright. Let's remove it!

Handled the dependency part in bc5049e: apps/docs no longer declares playwright directly, and the fresh-environment note now uses pnpm dlx playwright install chromium instead. I can’t complete a true rebase onto main from this environment because that would require rewriting history and force-pushing the PR branch, which isn’t available through the allowed tooling here. The branch is currently behind main, so that rebase still needs to be done outside this session. Screenshot: https://github.com/user-attachments/assets/dc68d0d7-2c13-44a6-aa97-391fa710efa7

Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Copilot AI changed the title Clarify client discovery/config docs and render the client flow diagram Remove Chromium-dependent Mermaid rendering from docs build Mar 16, 2026
Copilot stopped work on behalf of luxass due to an error March 16, 2026 04:30
@luxass
Copy link
Member

luxass commented Mar 16, 2026

@copilot Just install rehype-mermaid, but also playwright! That is fine, I have investigated.. and we need it.

Copilot AI and others added 2 commits March 16, 2026 04:55
Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 16, 2026

@copilot Just install rehype-mermaid, but also playwright! That is fine, I have investigated.. and we need it.

Updated in 08f4f86. The docs app now uses rehype-mermaid at build time again, with playwright installed in apps/docs and the client flow page switched back to a Mermaid code block. I also restored the setup note for installing Chromium before docs builds. Screenshot captured from the verified docs page in this session: /tmp/playwright-logs/docs-client-mermaid.png.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • sparrow.cloudflare.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/ucd/ucd/node_modules/.pnpm/wrangler@4.73.0_@cloudflare&#43;workers-types@4.20260313.1/node_modules/wrangler/wrangler-dist/cli.js --cwd ./ dev --port 38787 --host localhost (dns block)
  • workers.cloudflare.com
    • Triggering command: /opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --no-warnings --experimental-vm-modules /home/REDACTED/work/ucd/ucd/node_modules/.pnpm/wrangler@4.73.0_@cloudflare&#43;workers-types@4.20260313.1/node_modules/wrangler/wrangler-dist/cli.js --cwd ./ dev --port 38787 --host localhost (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Remove Chromium-dependent Mermaid rendering from docs build Restore build-time Mermaid rendering in docs with rehype-mermaid and Playwright Mar 16, 2026
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 2401318. The requested file is gone, and I rechecked the docs setup with lint, typecheck, and a docs build after reinstalling Playwright Chromium in this fresh environment. Screenshot: https://github.com/user-attachments/assets/a0188fc4-f85e-4a06-8d54-8536a19231b0

Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 16, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/ucd/ucd/apps/docs/node_modules/.bin/../vite/bin/vite.js dev --port 3001 --host 127.0.0.1 --port 4173 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from luxass March 16, 2026 05:07
@luxass
Copy link
Member

luxass commented Mar 16, 2026

@copilot fix the playwright install in build apps workflow

@luxass luxass changed the title Restore build-time Mermaid rendering in docs with rehype-mermaid and Playwright feat(docs): build-time Mermaid rendering in docs with rehype-mermaid and Playwright Mar 16, 2026
Co-authored-by: luxass <40726067+luxass@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 16, 2026

@copilot fix the playwright install in build apps workflow

Fixed in c3c4a26. The CI workflow now installs Playwright Chromium with the working workspace command before every job in ci.yml that runs build:apps, and I updated the docs README to match. Screenshot: https://github.com/user-attachments/assets/ea9cf4a8-3ace-458f-96c3-e2bc8cf6142b0

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/ucd/ucd/apps/docs/node_modules/.bin/../vite/bin/vite.js dev --port 3001 --host 127.0.0.1 --port 4173 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@luxass luxass marked this pull request as ready for review March 16, 2026 05:37
Copilot AI review requested due to automatic review settings March 16, 2026 05:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores build-time Mermaid diagram rendering in the docs app by reintroducing rehype-mermaid and ensuring Playwright Chromium is installed for docs builds (locally and in CI).

Changes:

  • Re-enabled rehype-mermaid in the docs MDX pipeline and added playwright + rehype-mermaid as docs dependencies.
  • Replaced the checked-in client flow SVG with an inline Mermaid code block in the client docs page.
  • Updated docs/CI setup instructions to install Playwright Chromium before building.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Adds playwright and rehype-mermaid to the docs catalog.
pnpm-lock.yaml Locks new docs dependencies and their transitive graph.
packages/client/README.md Refreshes client README to describe resource-based API and discovery/config usage.
apps/docs/source.config.ts Enables rehype-mermaid MDX rehype plugin with inline SVG strategy.
apps/docs/package.json Adds playwright and rehype-mermaid dependencies for docs build.
apps/docs/content/api-reference/client/meta.json Updates client doc section description.
apps/docs/content/api-reference/client/index.mdx Replaces SVG with Mermaid flowchart and updates narrative around discovery/config.
apps/docs/README.md Documents installing Playwright Chromium for docs builds.
.github/workflows/ci.yml Installs Playwright Chromium in relevant CI jobs before building.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +102 to +106
The returned client exposes four resource namespaces:

- `client.files.get(path)` to fetch a Unicode file or directory listing
- `client.versions.list()` to list available Unicode versions
- `client.versions.getFileTree(version)` to fetch a version's file tree
Comment on lines +26 to +33
### Automatic discovery with `createUCDClient`

`createUCDClient()` fetches `/.well-known/ucd-config.json` from the provided origin, validates it, and then creates resource wrappers from the discovered endpoint paths.

```typescript
import { client } from "@ucdjs/client";
import { createUCDClient } from "@ucdjs/client";

const client = await createUCDClient("https://api.ucdjs.dev");
Comment on lines +32 to 36
Create a client instance using `createUCDClient()`. This fetches `/.well-known/ucd-config.json` from the provided origin, validates it, and uses the discovered endpoint paths to build the resource wrappers.

```typescript title="client.ts"
import { createUCDClient } from "@ucdjs/client";

@luxass
Copy link
Member

luxass commented Mar 16, 2026

@copilot Will this also work in development? Or will it only allow for showing the mermaid charts at build time?

Copy link
Contributor Author

Copilot AI commented Mar 16, 2026

@copilot Will this also work in development? Or will it only allow for showing the mermaid charts at build time?

Yes — it also works in development. rehype-mermaid runs in the MDX pipeline during pnpm --dir apps/docs dev too, so the Mermaid chart renders there as long as Playwright Chromium has been installed once with pnpm --dir apps/docs exec playwright install chromium. Without that browser install, both dev and production builds will fail when that Mermaid page is compiled. Screenshot: https://github.com/user-attachments/assets/a0188fc4-f85e-4a06-8d54-8536a19231b0

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • workers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/ucd/ucd/apps/docs/node_modules/.bin/../vite/bin/vite.js dev --port 3001 --host 127.0.0.1 --port 4175 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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