Skip to content

feat(note-block): note block preview newlines - #3127

Merged
waleedlatif1 merged 5 commits into
stagingfrom
cursor/note-block-preview-newlines-5edb
Feb 4, 2026
Merged

feat(note-block): note block preview newlines#3127
waleedlatif1 merged 5 commits into
stagingfrom
cursor/note-block-preview-newlines-5edb

Conversation

@emir-karabeg

Copy link
Copy Markdown
Collaborator

Summary

Adds the remark-breaks plugin 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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: Improvement

Testing

The change was verified by running lint and type checks.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos


Open in CursorOpen in Web

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

cursorBot commented Feb 4, 2026

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel

vercelBot commented Feb 4, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
docsReadyReadyPreview, CommentFeb 4, 2026 4:28am

Request Review

cursoragentand others added 3 commits February 4, 2026 03:56
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>
@waleedlatif1waleedlatif1 changed the title Note block preview newlinesfeat(note-block): note block preview newlinesFeb 4, 2026
@waleedlatif1
waleedlatif1 marked this pull request as ready for review February 4, 2026 04:17
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

@greptile-apps

greptile-appsBot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR replaces a custom regex-based newline preprocessing approach with the standard remark-breaks plugin, enabling single newlines to render as line breaks in note block markdown previews.

Key Changes:

  • Imported and added remark-breaks to the remarkPlugins array in NoteMarkdown component
  • Added remark-breaks@^4.0.0 dependency to package.json
  • Removed the previous custom convertNewlinesToBreaks function that used regex preprocessing

Benefits of this approach:

  • AST-based transformation is more reliable than regex string manipulation
  • Handles edge cases correctly (code blocks, lists, tables, blockquotes)
  • Follows standard markdown plugin patterns
  • Eliminates issues raised in previous threads about sentinel collisions and incorrect code block parsing

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation correctly uses the standard remark-breaks plugin instead of custom regex preprocessing, which resolves all the issues from previous implementation attempts. The change is minimal, well-scoped, and follows established markdown plugin patterns.
  • No files require special attention

Important Files Changed

FilenameOverview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsxAdded remark-breaks plugin to enable single newline rendering as line breaks in markdown preview
apps/sim/package.jsonAdded remark-breaks@^4.0.0 dependency for markdown newline handling

Sequence Diagram

sequenceDiagram
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
Loading

@greptile-appsgreptile-appsBot 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.

1 file reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@greptile-appsgreptile-appsBot 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.

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@greptile-appsgreptile-appsBot 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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@greptile-appsgreptile-appsBot 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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
waleedlatif1 merged commit 0bc245b into stagingFeb 4, 2026
11 checks passed
@waleedlatif1
waleedlatif1 deleted the cursor/note-block-preview-newlines-5edb branch February 4, 2026 04:30
royceP2 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Mar 3, 2026
* 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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@emir-karabeg@waleedlatif1@cursoragent