-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(note-block): note block preview newlines #3127
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
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>
|
@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
|
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.
1 file reviewed, 3 comments
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx
Outdated
Show resolved
Hide resolved
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.
1 file reviewed, 2 comments
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx
Outdated
Show resolved
Hide resolved
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.
1 file reviewed, 1 comment
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx
Outdated
Show resolved
Hide resolved
|
@greptile |
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.
2 files reviewed, no comments
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