Skip to content

Commit 049b425

Browse files
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>
1 parent 4db6e55 commit 049b425

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { memo, useCallback, useMemo } from 'react'
22
import ReactMarkdown from 'react-markdown'
33
import type { NodeProps } from 'reactflow'
4+
import remarkBreaks from 'remark-breaks'
45
import remarkGfm from 'remark-gfm'
56
import { cn } from '@/lib/core/utils/cn'
67
import { BLOCK_DIMENSIONS } from '@/lib/workflows/blocks/block-dimensions'
@@ -305,7 +306,7 @@ function getEmbedInfo(url: string): EmbedInfo | null {
305306
const NoteMarkdown = memo(function NoteMarkdown({ content }: { content: string }) {
306307
return (
307308
<ReactMarkdown
308-
remarkPlugins={[remarkGfm]}
309+
remarkPlugins={[remarkGfm, remarkBreaks]}
309310
components={{
310311
p: ({ children }: any) => (
311312
<p className='mb-1 break-words text-[var(--text-primary)] text-sm leading-[1.25rem] last:mb-0'>

apps/sim/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
"redis": "5.10.0",
149149
"rehype-autolink-headings": "^7.1.0",
150150
"rehype-slug": "^6.0.0",
151+
"remark-breaks": "4.0.0",
151152
"remark-gfm": "4.0.1",
152153
"resend": "^4.1.2",
153154
"rss-parser": "3.13.0",

bun.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)