Repository navigation
feat: add markdown editor with live preview, syntax-highlighted code … - #48
Conversation
…blocks, and draft persistence for comment discussions
|
@mk-Denver is attempting to deploy a commit to the Megasley Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks @mk-Denver , this is a really nice upgrade. The toolbar, the draft saving and the copyable code blocks all make the comments feel much better, and the safety choices in MarkdownPreview are solid: no rehype-raw, skipHtml, images turned off, and an allowlist for link protocols. Typecheck and lint both pass on the branch, and I tested it locally. I've left line comments. Three things need fixing before we can merge:
Smaller things, marked as nits in the line comments: an off-by-one in the code-block selection, a line in One question for discussion: switching to Markdown changes how existing plain-text comments look. Single line breaks collapse, and characters like *, _ and # become formatting. The removed Once the three blockers are fixed I'll take another look. Great work overall |
Thanks for the review @Megasley Let me address the raised concerns .
Absolutely we can add remark-breaks for reverse compatibility. |
… parsing, draft reset, and remark-breaks for legacy comments
|
Thanks @mk-Denver, nice turnaround! All three blockers and the nits are fixed, and I checked each one against the diff: Great work on this, it's a big improvement to comments 🚀 |
This pull request introduces a new rich Markdown editing and display experience for comments, including a toolbar-based Markdown editor with preview, improved code block rendering, and persistent edit drafts. The changes modernize the comment editing UI and ensure that Markdown is rendered consistently in both editing and display contexts.
Major features and improvements:
1. Markdown Editing and Preview
MarkdownEditorcomponent with a formatting toolbar (bold, code, lists, links, etc.), live preview, and keyboard shortcuts for common Markdown actions. This replaces the plain textarea for editing comments.2. Code Block Rendering
CodeBlockcomponent for rendering code blocks in comments, supporting language detection, collapsible long blocks, and a "Copy to clipboard" button.3. Comment Editing Experience
CommentActionswith the newMarkdownEditor, providing a richer editing interface.localStoragevia theuseCommentDrafthook, so users don't lose work on refresh. Drafts are cleared on save or cancel. [1] [2] [3]4. Markdown Rendering in Comment Display
MarkdownPreviewcomponent, ensuring all Markdown (including code blocks) is rendered consistently. [1] [2]5. Codebase Clean-up
linkifyTextutility from comment display, as Markdown rendering now handles links and formatting.These changes collectively provide a much improved, modern, and user-friendly experience for writing and reading comments with Markdown formatting.
References:
[1] [2] [3] [4] [5] [6] [7] [8]…blocks, and draft persistence for comment discussions