Skip to content

Add Markdown component with GFM support and XSS protection#19

Merged
hotlong merged 7 commits intomainfrom
copilot/add-markdown-component
Jan 14, 2026
Merged

Add Markdown component with GFM support and XSS protection#19
hotlong merged 7 commits intomainfrom
copilot/add-markdown-component

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 14, 2026

Implementation Plan for Markdown Component

  • Explore repository structure and understand component architecture
  • Add markdown rendering library (react-markdown) as dependency
  • Create markdown UI component in src/ui/
  • Create markdown renderer in src/renderers/data-display/
  • Register markdown component in data-display index
  • Add tests for markdown component
  • Build and verify the implementation
  • Create example/demo to verify visual output
  • Run code review and address security concerns
  • Run security scan with CodeQL - No vulnerabilities found
  • Add JSDoc documentation following "Schema First" principle
  • Merge latest code from main branch

Summary

Successfully implemented a new Markdown component for Object UI with comprehensive JSDoc documentation and merged latest changes from main branch.

Changes in This Update

Added JSDoc Documentation

  • Added comprehensive JSDoc comments to MarkdownProps interface
  • Added detailed JSDoc to the markdown renderer component
  • Documentation follows "Schema First" principle for auto-generated docs
  • Includes usage examples and feature descriptions

Merged Main Branch

  • Successfully merged 133 commits from main branch
  • No conflicts encountered
  • All tests pass after merge
  • Build successful

Component Features

  • Full markdown rendering with GitHub Flavored Markdown support
  • XSS protection via rehype-sanitize
  • Dark mode support
  • Tailwind CSS prose styling
  • Comprehensive JSDoc documentation for API reference generation
Original prompt

新建一个makkdown的组件


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 14, 2026 00:05
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
@huangyiirene huangyiirene requested a review from Copilot January 14, 2026 00:11
Copy link
Copy Markdown
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

This PR introduces a new Markdown component to Object UI, enabling schema-driven rendering of markdown content with GitHub Flavored Markdown support and XSS protection.

Changes:

  • Added markdown UI component with Tailwind prose styling and security hardening
  • Created markdown renderer component and registered it with ComponentRegistry
  • Added comprehensive test coverage and a working demo in the prototype application

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/components/src/ui/markdown.tsx New UI component wrapping react-markdown with Tailwind styling and security
packages/components/src/ui/index.ts Export statement for the new markdown component
packages/components/src/renderers/data-display/markdown.tsx Renderer component registering markdown with ComponentRegistry
packages/components/src/renderers/data-display/index.ts Import statement to include markdown renderer
packages/components/src/new-components.test.ts Test case verifying markdown component registration
packages/components/package.json Added react-markdown, remark-gfm, and rehype-sanitize dependencies
examples/prototype/src/App.tsx Demo implementation showcasing markdown component features
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +7 to +10
export interface MarkdownProps {
content: string
className?: string
}
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The MarkdownProps interface lacks JSDoc comments. According to Rule #3 ('Schema First' Mindset), every property in the Schema MUST have JSDoc to enable auto-generated documentation for the open-source community. Add JSDoc describing the purpose of 'content' and 'className' properties.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added comprehensive JSDoc documentation to the MarkdownProps interface describing the purpose and supported features of each property. Documentation follows the "Schema First" principle to enable auto-generated API docs. (commit c31876c)

import { Markdown } from '@/ui';

ComponentRegistry.register('markdown',
({ schema, className, ...props }) => (
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The renderer component function lacks JSDoc documentation. Add a JSDoc comment explaining that this is a Schema-driven renderer for markdown content, following the 'Schema First' principle outlined in Rule #3.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added detailed JSDoc documentation to the markdown renderer component explaining its schema-driven architecture and usage. Includes example JSON configuration and lists all supported features. (commit c31876c)

Copilot AI changed the title [WIP] Add new markdown component Add Markdown component with GFM support and XSS protection Jan 14, 2026
Copilot AI requested a review from huangyiirene January 14, 2026 00:12
@github-actions
Copy link
Copy Markdown
Contributor

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

@huangyiirene
Copy link
Copy Markdown
Contributor

@copilot 从主分支之更新最新代码并修正代码冲突

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot 从主分支之更新最新代码并修正代码冲突

Successfully merged 133 commits from main branch. No conflicts encountered. All tests pass and build is successful. (commit ee033e8)

@github-actions
Copy link
Copy Markdown
Contributor

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

@hotlong hotlong marked this pull request as ready for review January 14, 2026 01:01
@hotlong hotlong merged commit 57424b3 into main Jan 14, 2026
1 of 5 checks passed
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.

4 participants