Skip to content

feat(a2ui): support markdown in text#2659

Merged
HuJean merged 2 commits into
mainfrom
p/a2ui-markdown
May 18, 2026
Merged

feat(a2ui): support markdown in text#2659
HuJean merged 2 commits into
mainfrom
p/a2ui-markdown

Conversation

@HuJean
Copy link
Copy Markdown
Collaborator

@HuJean HuJean commented May 18, 2026

Summary by CodeRabbit

  • New Features
    • Added markdown text variant to render formatted content directly
    • Extended text styling options with new heading and caption variants
    • Included usage examples and gallery demonstrations for the new markdown variant

Review Change Stack

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

⚠️ No Changeset found

Latest commit: a329fb0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 403bb61f-81e4-4f06-b33d-abd52f38eae3

📥 Commits

Reviewing files that changed from the base of the PR and between aaf21ee and 3c0ed74.

📒 Files selected for processing (3)
  • packages/genui/a2ui-playground/src/catalog/a2ui.ts
  • packages/genui/a2ui-playground/src/mock/a2ui-gallery/markdown-text.json
  • packages/genui/a2ui/src/catalog/Text/index.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/genui/a2ui-playground/src/catalog/a2ui.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/genui/a2ui-playground/src/mock/a2ui-gallery/markdown-text.json
  • packages/genui/a2ui/src/catalog/Text/index.tsx

📝 Walkthrough

Walkthrough

Text component now supports markdown rendering via a new markdown variant. The variant union expands in TextProps, the component adds early string casting and a conditional render path for markdown content using <x-markdown>, and the feature is documented with playground examples and gallery configuration.

Changes

Text Markdown Feature

Layer / File(s) Summary
Text component markdown variant support
packages/genui/a2ui/src/catalog/Text/index.tsx
TextProps.variant union expands to include 'markdown', text prop is cast to string immediately at component entry, and rendering adds a conditional branch that outputs <x-markdown> for markdown variant while other variants render the traditional <text> element with computed class names.
Usage examples and gallery
packages/genui/a2ui-playground/src/catalog/a2ui.ts, packages/genui/a2ui-playground/src/mock/a2ui-gallery/markdown-text.json
Playground catalog includes a new "Markdown" usage example demonstrating the markdown variant with sample markdown content, and gallery JSON configuration enables markdown rendering for the markdown-content instance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

framework:React

Suggested reviewers

  • Sherry-hue

Poem

🐰 A Text that speaks in markdown tongue,
With <x-markdown> tags freshly strung,
Variants dance from h1 to code,
The gallery shows the render road,
A hop, a skip, the feature's sung! 📝✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(a2ui): support markdown in text' clearly and concisely describes the main feature addition across all modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch p/a2ui-markdown

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@HuJean HuJean force-pushed the p/a2ui-markdown branch from aaf21ee to 3c0ed74 Compare May 18, 2026 09:28
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/genui/a2ui/src/catalog/Text/index.tsx (1)

46-51: ⚡ Quick win

Add JSX intrinsic element declaration for x-markdown instead of suppressing with @ts-expect-error.

The suppression hides type regressions on this render path. Since x-markdown is not currently declared in JSX.IntrinsicElements, you can augment the namespace locally in this file or a types file to enable type checking. For example:

declare namespace JSX {
  interface IntrinsicElements {
    'x-markdown': { content: string; [key: string]: any };
  }
}

This allows TypeScript to verify the element and its props while you develop the markdown feature.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/genui/a2ui/src/catalog/Text/index.tsx` around lines 46 - 51, Replace
the "`@ts-expect-error`" suppression by adding a JSX intrinsic element declaration
for 'x-markdown' (so TypeScript can type-check the render path in the variant
=== 'markdown' branch). Add a local namespace augmentation (in this file or a
nearby types file) that extends JSX.IntrinsicElements with 'x-markdown': {
content: string; [key: string]: any }, then remove the `@ts-expect-error` and
render <x-markdown content={text} /> normally; reference the 'x-markdown'
element and the variant === 'markdown' branch in Text/index.tsx when applying
the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/genui/a2ui/src/catalog/Text/index.tsx`:
- Around line 46-51: Replace the "`@ts-expect-error`" suppression by adding a JSX
intrinsic element declaration for 'x-markdown' (so TypeScript can type-check the
render path in the variant === 'markdown' branch). Add a local namespace
augmentation (in this file or a nearby types file) that extends
JSX.IntrinsicElements with 'x-markdown': { content: string; [key: string]: any
}, then remove the `@ts-expect-error` and render <x-markdown content={text} />
normally; reference the 'x-markdown' element and the variant === 'markdown'
branch in Text/index.tsx when applying the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 87113a1b-3748-4038-ae79-22df38f21429

📥 Commits

Reviewing files that changed from the base of the PR and between 2061597 and aaf21ee.

📒 Files selected for processing (5)
  • packages/genui/a2ui-playground/src/catalog/a2ui.ts
  • packages/genui/a2ui-playground/src/mock/a2ui-gallery/markdown-text.json
  • packages/genui/a2ui/src/catalog/Text/index.tsx
  • packages/genui/server/next-env.d.ts
  • packages/genui/server/tsconfig.json

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@HuJean HuJean enabled auto-merge (squash) May 18, 2026 09:54
@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 18, 2026

Web Explorer

#9996 Bundle Size — 901.94KiB (0%).

a329fb0(current) vs dae1d41 main#9993(baseline)

Bundle metrics  no changes
                 Current
#9996
     Baseline
#9993
No change  Initial JS 45.06KiB 45.06KiB
No change  Initial CSS 2.22KiB 2.22KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 9 9
No change  Assets 11 11
No change  Modules 229 229
No change  Duplicate Modules 11 11
No change  Duplicate Code 27.19% 27.19%
No change  Packages 10 10
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#9996
     Baseline
#9993
No change  JS 497.56KiB 497.56KiB
No change  Other 402.16KiB 402.16KiB
No change  CSS 2.22KiB 2.22KiB

Bundle analysis reportBranch p/a2ui-markdownProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 18, 2026

React Example

#8422 Bundle Size — 237.17KiB (0%).

a329fb0(current) vs dae1d41 main#8419(baseline)

Bundle metrics  no changes
                 Current
#8422
     Baseline
#8419
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 198 198
No change  Duplicate Modules 80 80
No change  Duplicate Code 44.73% 44.73%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#8422
     Baseline
#8419
No change  IMG 145.76KiB 145.76KiB
No change  Other 91.42KiB 91.42KiB

Bundle analysis reportBranch p/a2ui-markdownProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 18, 2026

React External

#1537 Bundle Size — 695.4KiB (0%).

a329fb0(current) vs dae1d41 main#1534(baseline)

Bundle metrics  no changes
                 Current
#1537
     Baseline
#1534
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 17 17
No change  Duplicate Modules 5 5
No change  Duplicate Code 8.59% 8.59%
No change  Packages 0 0
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#1537
     Baseline
#1534
No change  Other 695.4KiB 695.4KiB

Bundle analysis reportBranch p/a2ui-markdownProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 18, 2026

React MTF Example

#1555 Bundle Size — 208.12KiB (0%).

a329fb0(current) vs dae1d41 main#1552(baseline)

Bundle metrics  no changes
                 Current
#1555
     Baseline
#1552
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 3 3
No change  Modules 193 193
No change  Duplicate Modules 77 77
No change  Duplicate Code 44.24% 44.24%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#1555
     Baseline
#1552
No change  IMG 111.23KiB 111.23KiB
No change  Other 96.89KiB 96.89KiB

Bundle analysis reportBranch p/a2ui-markdownProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented May 18, 2026

React Example with Element Template

#691 Bundle Size — 200.08KiB (0%).

a329fb0(current) vs dae1d41 main#688(baseline)

Bundle metrics  Change 2 changes
                 Current
#691
     Baseline
#688
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
Change  Modules 91(+1.11%) 90
No change  Duplicate Modules 27 27
Change  Duplicate Code 39.78%(-0.05%) 39.8%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#691
     Baseline
#688
No change  IMG 145.76KiB 145.76KiB
No change  Other 54.32KiB 54.32KiB

Bundle analysis reportBranch p/a2ui-markdownProject dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 18, 2026

Merging this PR will improve performance by 6.02%

⚡ 1 improved benchmark
✅ 80 untouched benchmarks
⏩ 26 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
002-hello-reactLynx-destroyBackground 917.1 µs 865.1 µs +6.02%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing p/a2ui-markdown (a329fb0) with main (dae1d41)

Open in CodSpeed

Footnotes

  1. 26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@HuJean HuJean merged commit c21d6af into main May 18, 2026
53 checks passed
@HuJean HuJean deleted the p/a2ui-markdown branch May 18, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants