You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(files): collapse blank-line runs to markdown standard (no empty-paragraph explosion / reflow)
parseMarkdownToDoc now strips ALL top-level empty paragraphs (leading, interior, trailing),
not just trailing. A run of blank lines between blocks is insignificant in markdown
(CommonMark collapses it), but @tiptap/markdown reconstructs one empty paragraph per blank
line — which made the mounted editor render vertical gaps that exist nowhere else the file
is viewed (GitHub, download, our own static preview), let a pathological blank run explode
into thousands of empty nodes, and caused the visible reflow on open (static preview
collapses empty <p>; the live editor gives each a trailing-break line). Collapsing on parse
keeps normal one-blank-line spacing, matches every standard renderer, and stays idempotent
so the round-trip-safety probe still reaches a fixed point (files stay editable; existing
files normalize on next cold-open + save). Serializer is intentionally NOT changed — a
global blank-run collapse there would corrupt blank lines inside fenced code blocks.
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/markdown-fidelity.ts
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -172,9 +172,14 @@ function stripEmptyListItemLines(markdown: string): string {
172
172
* Cleans up serializer output: drops empty list-item marker lines that would otherwise corrupt on
173
173
* round-trip ({@link stripEmptyListItemLines}), restores callout markers the serializer
174
174
* backslash-escapes (`> \[!NOTE\]` → `> [!NOTE]`), and collapses trailing blank lines to a single
175
-
* newline. The table serializer's spurious surrounding blank lines are trimmed at the source
176
-
* (PipeSafeTable), so no global leading-newline strip is needed here — avoiding clobbering content
177
-
* that legitimately begins with whitespace.
175
+
* newline. Interior blank runs are NOT collapsed here — blank lines inside a fenced code block (or a
176
+
* verbatim raw-markdown-snippet) are significant, and a global collapse would corrupt them. Spurious
177
+
* interior blank runs between top-level blocks are removed upstream instead, by
178
+
* {@link parseMarkdownToDoc} stripping empty paragraphs, so a doc that has been through the editor
179
+
* never serializes with an interior blank run outside code in the first place. The table serializer's
180
+
* spurious surrounding blank lines are trimmed at the source (PipeSafeTable), so no global
181
+
* leading-newline strip is needed here — avoiding clobbering content that legitimately begins with
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/markdown-parse.test.ts
+43-46Lines changed: 43 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,10 @@ import { createMarkdownContentExtensions } from './extensions'
0 commit comments