Uh oh!
There was an error while loading. Please reload this page.
feat(note-block): note block preview newlines - #3127
Conversation
Add remark-breaks plugin to the note block markdown renderer to convert single newlines into line breaks. This fixes the issue where users had to use double newlines (\n\n) to create visible line breaks in the note block preview. Co-authored-by: Emir Karabeg <emir-karabeg@users.noreply.github.com>
Cursor Agent can help with this pull request. Just |
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This reverts commit 049b425.
Add a preprocessor function that converts single newlines to markdown hard breaks (two trailing spaces + newline) before rendering. This ensures that when users press Enter in the note block editor, the line break shows up in the preview. The function preserves: - Double newlines (paragraph breaks) - Code block formatting (fenced and inline) Co-authored-by: Emir Karabeg <emir-karabeg@users.noreply.github.com>
Co-authored-by: Emir Karabeg <emir-karabeg@users.noreply.github.com>
waleedlatif1
commented
Feb 4, 2026
@cursor review |
Greptile OverviewGreptile SummaryThis PR replaces a custom regex-based newline preprocessing approach with the standard Key Changes:
Benefits of this approach:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant NoteBlock
participant NoteMarkdown
participant ReactMarkdown
participant remarkBreaks
participant remarkGfm
participant DOM
User->>NoteBlock: Views note block
NoteBlock->>NoteBlock: Extract content from storedValues
NoteBlock->>NoteMarkdown: Pass content string
NoteMarkdown->>ReactMarkdown: Initialize with remarkPlugins
ReactMarkdown->>remarkGfm: Process GitHub Flavored Markdown
remarkGfm-->>ReactMarkdown: Return transformed AST
ReactMarkdown->>remarkBreaks: Process single newlines
remarkBreaks->>remarkBreaks: Convert \n to <br> in AST
remarkBreaks-->>ReactMarkdown: Return transformed AST
ReactMarkdown->>ReactMarkdown: Apply custom components
ReactMarkdown->>DOM: Render markdown with line breaks
DOM-->>User: Display formatted content
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Feb 4, 2026
Uh oh!
There was an error while loading. Please reload this page.
* feat(note-block): add single newline support in preview Add remark-breaks plugin to the note block markdown renderer to convert single newlines into line breaks. This fixes the issue where users had to use double newlines (\n\n) to create visible line breaks in the note block preview. Co-authored-by: Emir Karabeg <emir-karabeg@users.noreply.github.com> * Revert "feat(note-block): add single newline support in preview" This reverts commit 049b425. * feat(note-block): add single newline support in preview Add a preprocessor function that converts single newlines to markdown hard breaks (two trailing spaces + newline) before rendering. This ensures that when users press Enter in the note block editor, the line break shows up in the preview. The function preserves: - Double newlines (paragraph breaks) - Code block formatting (fenced and inline) Co-authored-by: Emir Karabeg <emir-karabeg@users.noreply.github.com> * refactor(note-block): simplify comments Co-authored-by: Emir Karabeg <emir-karabeg@users.noreply.github.com> * added remark-breaks to allow single new line --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Emir Karabeg <emir-karabeg@users.noreply.github.com> Co-authored-by: waleed <walif6@gmail.com>
Summary
Adds the
remark-breaksplugin to the note block's markdown renderer, allowing single newlines to render as visible line breaks (<br>) in the preview. This resolves the issue where users previously had to use double newlines (\n\n) to achieve a line break.Fixes # (issue)
Type of Change
Testing
The change was verified by running lint and type checks.
Checklist
Screenshots/Videos