Skip to content

Fix /x/worker/ page broken by generic type params in MDX#1142

Open
taras wants to merge 1 commit intov4from
fix/escape-generic-type-params-in-mdx
Open

Fix /x/worker/ page broken by generic type params in MDX#1142
taras wants to merge 1 commit intov4from
fix/escape-generic-type-params-in-mdx

Conversation

@taras
Copy link
Member

@taras taras commented Mar 22, 2026

Summary

  • The /x/worker/ page was failing with "Failed to load worker due to error" because MDX interpreted generic type references like Result<T> in JSDoc comments as JSX tags
  • Added a regex in useMarkdown to escape uppercase-starting angle bracket patterns (e.g. <T>, <TSend, TRecv>) to HTML entities before MDX processing
  • Only affects TypeScript-style generics (uppercase start), not actual HTML tags (lowercase)

Test plan

  • Verified /x/worker/ renders correctly with README + API reference (155KB vs 13KB error page)
  • Verified /x/fetch/, /x/websocket/, /x/process/ still render correctly
  • No server errors in console

🤖 Generated with Claude Code

JSDoc comments containing generic type references like `Result<T>` were
being interpreted as JSX tags by MDX, causing the worker extension page
to fail with a parse error. Escape uppercase-starting angle bracket
patterns to HTML entities before MDX processing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/effection@1142

commit: 9f37d80

Copy link
Member

@cowboyd cowboyd left a comment

Choose a reason for hiding this comment

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

Looks good to me. One thing though: Can you ask Claude not to market itself by adding itself to commits and PRs?

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