-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add markdown editor for description #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| import MDEditor, { commands } from '@uiw/react-md-editor'; | ||||||||||||||||||||||||||||||||||||||||||||||
| import type React from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||
| import rehypeSanitize from 'rehype-sanitize'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| interface MarkdownEditorProps { | ||||||||||||||||||||||||||||||||||||||||||||||
| value?: string; | ||||||||||||||||||||||||||||||||||||||||||||||
| onChange?: (value: string | undefined) => void; | ||||||||||||||||||||||||||||||||||||||||||||||
| id?: string; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| /** | |
| * A markdown editor component with sanitization support. | |
| * | |
| * Supports the following markdown features: | |
| * - Bold text | |
| * - Italic text | |
| * - Strikethrough | |
| * - Links | |
| * | |
| * Content is sanitized using rehype-sanitize to prevent XSS attacks. | |
| * | |
| * Usage example: | |
| * ```tsx | |
| * <MarkdownEditor value={markdown} onChange={setMarkdown} /> | |
| * ``` | |
| * | |
| * Limitations: | |
| * - Only the listed markdown features are supported. | |
| * - Other markdown features (e.g., tables, code blocks) may not be available. | |
| */ |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,26 @@ | ||||||||||||||||||||||||
| import type React from 'react'; | ||||||||||||||||||||||||
| import ReactMarkdown from 'react-markdown'; | ||||||||||||||||||||||||
| import rehypeSanitize from 'rehype-sanitize'; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| interface MarkdownRenderProps { | ||||||||||||||||||||||||
| content?: string; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
||||||||||||||||||||||||
| /** | |
| * Renders markdown content as HTML. | |
| * | |
| * @param content - The markdown string to render. Can be undefined. | |
| * | |
| * @remarks | |
| * This component uses react-markdown to safely parse and render markdown content. | |
| * It's companion to the MarkdownEditor component. | |
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explicit dependency on
react-markdown@^10.1.0may conflict with@uiw/react-md-editorwhich internally usesreact-markdown@~9.0.1(as seen in yarn.lock line 6787). This could lead to multiple versions ofreact-markdownbeing installed.Consider removing the explicit
react-markdowndependency from package.json and rely on the version that comes with@uiw/react-md-editor, or ensure version compatibility. If you needreact-markdown@^10.1.0for theMarkdownRendercomponent separately, document why both versions are needed.