Skip to content

Markdown support with live preview for notes#36

Open
MohanPrasathSece wants to merge 1 commit into
DhanushNehru:mainfrom
MohanPrasathSece:x
Open

Markdown support with live preview for notes#36
MohanPrasathSece wants to merge 1 commit into
DhanushNehru:mainfrom
MohanPrasathSece:x

Conversation

@MohanPrasathSece

Copy link
Copy Markdown

This adds Markdown formatting to the note editor (headings, bold/italic, strikethrough, lists, blockquotes, inline/code blocks, links, images) and an Edit/Preview toggle. Notes are still saved as raw Markdown. Includes react-markdown + remark-gfm and typography styling.

@vercel

vercel Bot commented Oct 3, 2025

Copy link
Copy Markdown

@MohanPrasathSece is attempting to deploy a commit to the Dhanush Nehru's projects Team on Vercel.

A member of the Team first needs to authorize it.

@MohanPrasathSece

Copy link
Copy Markdown
Author

Hi @DhanushNehru, I implemented Markdown with a live preview while keeping plain text storage. It works on desktop and mobile and preserves the existing autosave/delete flows. Could you assign this to me and add the Hacktoberfest label? I’m happy to tweak styling or add a small rendered preview in the sidebar if you’d like.

@vercel

vercel Bot commented Oct 3, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
scratchpad-scribe Ready Ready Preview Comment Oct 3, 2025 6:50am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Adds Markdown formatting support to the note editor with a live preview feature. Users can now toggle between Edit and Preview modes to write in Markdown and see the formatted output in real-time.

  • Integrates react-markdown with GitHub Flavored Markdown (GFM) support
  • Adds Edit/Preview toggle tabs to the note editor interface
  • Implements typography styling with Tailwind CSS typography plugin

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

File Description
tailwind.config.ts Adds @tailwindcss/typography plugin for prose styling
src/components/NoteEditor.tsx Implements tabbed interface with Edit/Preview modes
src/components/MarkdownRenderer.tsx Creates markdown rendering component with custom styling
package.json Adds react-markdown and remark-gfm dependencies

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

className="flex-1 resize-none border-none shadow-none focus-visible:ring-0 text-base leading-relaxed"
placeholder="Start writing..."
/>
<Tabs value={mode} onValueChange={(v) => setMode(v as 'edit' | 'preview')} className="flex-1 flex flex-col">

Copilot AI Oct 3, 2025

Copy link

Choose a reason for hiding this comment

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

Duplicate Tabs component - the mode state and onValueChange logic is duplicated on lines 57 and 86. Consider consolidating into a single Tabs wrapper or extracting the mode switching logic.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +18
a: ({ node, ...props }) => (
// Open links in new tab and add rel for security
<a {...props} target="_blank" rel="noopener noreferrer" />
),

Copilot AI Oct 3, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Opening all links in new tabs without user consent may not be the best UX. Consider allowing users to control this behavior or only applying it to external links.

Suggested change
a: ({ node, ...props }) => (
// Open links in new tab and add rel for security
<a {...props} target="_blank" rel="noopener noreferrer" />
),
a: ({ node, ...props }) => {
// Only open external links in a new tab
const href = props.href || '';
let isExternal = false;
try {
// If href is absolute, check origin; if relative, it's internal
const url = new URL(href, typeof window !== 'undefined' ? window.location.origin : 'http://localhost');
isExternal = url.origin !== (typeof window !== 'undefined' ? window.location.origin : 'http://localhost');
} catch (e) {
// If URL parsing fails, treat as internal
isExternal = false;
}
return isExternal ? (
<a {...props} target="_blank" rel="noopener noreferrer" />
) : (
<a {...props} />
);
},

Copilot uses AI. Check for mistakes.
// eslint-disable-next-line @next/next/no-img-element
<img {...props} className="max-w-full h-auto rounded" />
),
code({ inline, className, children, ...props }) {

Copilot AI Oct 3, 2025

Copy link

Choose a reason for hiding this comment

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

Missing TypeScript types for the code component props. Consider adding proper typing for better type safety and IDE support.

Copilot uses AI. Check for mistakes.
@DhanushNehru

Copy link
Copy Markdown
Owner

Merge conflicts to be resolved and fixes to me made @MohanPrasathSece

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.

3 participants