feat!: create data dictionary table cell for displaying markdown (#453)#480
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
A pull request that introduces Markdown rendering support for table cells by adding new components and updating related styling, stories, and dependencies.
- Introduced a new MarkdownRenderer component with sanitization using unified and rehype plugins.
- Added a MarkdownCell component to integrate Markdown rendering in table cells with associated Storybook stories.
- Updated dependencies and created custom components (Anchor and Table) for rendering Markdown elements.
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/styles/common/mui/typography.ts | Added a new "ERROR" color mapping to support error styling. |
| src/components/Table/components/MarkdownCell/types.ts | Defined the MarkdownCellProps type for table cells. |
| src/components/Table/components/MarkdownCell/stories/types.ts | Provided a type for story arguments to enhance Storybook integration. |
| src/components/Table/components/MarkdownCell/stories/markdownCell.stories.tsx | Configured Storybook stories for the MarkdownCell component. |
| src/components/Table/components/MarkdownCell/stories/args.ts | Supplied default and HTML example arguments for testing Markdown rendering. |
| src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.tsx | Integrated MarkdownRenderer into a table cell with custom components. |
| src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.ts | Defined cell-specific styling for properly rendering Markdown content. |
| src/components/MarkdownRenderer/types.ts | Created type definitions for the MarkdownRenderer component. |
| src/components/MarkdownRenderer/markdownRenderer.tsx | Implemented Markdown processing with proper sanitization and React component mapping. |
| src/components/MarkdownRenderer/markdownRenderer.styles.ts | Provided stylistic adjustments for the MarkdownRenderer container. |
| src/components/MarkdownRenderer/contants.ts | Defined default component mappings for anchor and table elements used by MarkdownRenderer. |
| src/components/MarkdownRenderer/components/Table/table.tsx | Created a Table component tailored for Markdown table rendering. |
| src/components/MarkdownRenderer/components/Table/table.styles.ts | Applied styles to ensure proper table layout and appearance. |
| src/components/MarkdownRenderer/components/Anchor/anchor.tsx | Developed an Anchor component that wraps a Link component with limited attributes. |
| package.json | Updated dependencies to include new libraries for Markdown processing. |
Comments suppressed due to low confidence (1)
src/components/MarkdownRenderer/contants.ts:1
- The file name 'contants.ts' appears to contain a typo. Consider renaming it to 'constants.ts' to align with standard naming conventions and improve clarity.
import { Components } from "rehype-react";
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #453.
This pull request introduces a Markdown rendering feature and integrates it into table cells while ensuring proper styling and sanitization. Key changes include adding a
MarkdownRenderercomponent, creating reusable components for anchors and tables, and updating table cells to render Markdown content. Below is a categorized summary of the most important changes:Markdown Rendering Implementation:
MarkdownRenderercomponent (src/components/MarkdownRenderer/markdownRenderer.tsx) that processes Markdown content usingunified,remark, andrehypeplugins, including sanitization and React component mapping.MarkdownRendererPropsinterface to support customizable components and Markdown input (src/components/MarkdownRenderer/types.ts).AnchorandTable) in theCOMPONENTSconstant (src/components/MarkdownRenderer/contants.ts).Custom Components for Markdown Elements:
Anchorcomponent to handle sanitized anchor tags with limited attributes (src/components/MarkdownRenderer/components/Anchor/anchor.tsx).Tablecomponent with styled table elements for Markdown tables (src/components/MarkdownRenderer/components/Table/table.tsx,src/components/MarkdownRenderer/components/Table/table.styles.ts). [1] [2]Integration with Table Cells:
MarkdownRenderercomponent (src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.tsx).src/components/Table/components/TableCell/components/MarkdownCell/markdownCell.styles.ts).Storybook and Testing:
MarkdownCellcomponent with default and HTML content examples (src/components/Table/components/TableCell/components/MarkdownCell/stories/markdownCell.stories.tsx,src/components/Table/components/TableCell/components/MarkdownCell/stories/args.ts). [1] [2]Dependency Updates:
package.jsonto include new dependencies for Markdown processing:rehype-raw,rehype-react,rehype-sanitize,remark-gfm, andremark-rehype.