Skip to content

fix(client): render each line of comment code blocks on its own line - #462

Merged
yoshiko-pg merged 1 commit into
mainfrom
fix/460-comment-code-block-lines
Aug 28, 2026
Merged

yoshiko-pg merged 1 commit into
mainfrom
fix/460-comment-code-block-lines

Conversation

@yoshiko-pg

@yoshiko-pg yoshiko-pg commented Aug 28, 2026 •

Copy link
Copy Markdown
Owner

Description: A multi-line fenced code block in a comment body rendered as a single line, with every newline dropped. prism-react-renderer strips the trailing newline from each tokenized line, and PrismSyntaxHighlighter rendered the lines as inline spans, so nothing supplied the line breaks.

Fix: Re-insert a newline text node between lines in the shared PrismSyntaxHighlighter. Single-line call sites (diff rows) are unaffected, and every multi-line call site renders inside <pre>, so the newlines now display correctly.

This also removes two per-call-site workarounds for the same defect that are no longer needed:

  • [&_.token-line]:block [&_.token-line]:whitespace-pre in NotebookDiffViewer (2 places)
  • .markdown-preview-code .token-line { display: block } in global.css

Tests: Added a regression test that fails against the previous implementation. All 857 tests pass.

Before (5.0.11) After
image� image

Fixes #460

🤖 Generated with Claude Code

prism-react-renderer strips the trailing newline from each tokenized
line, and PrismSyntaxHighlighter rendered lines as inline spans, so
multi-line code blocks in comment bodies collapsed into a single line
(#460). Re-insert the newline between lines in the shared component
and drop the per-call-site workarounds in NotebookDiffViewer and
global.css that papered over the same defect.

Fixes #460

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yoshiko-pg
yoshiko-pg merged commit 7f406a6 into main Aug 28, 2026
6 checks passed
@yoshiko-pg
yoshiko-pg deleted the fix/460-comment-code-block-lines branch August 28, 2026 15:11
WarLikeLaux pushed a commit to WarLikeLaux/difit that referenced this pull request Sep 25, 2026
…oshiko-pg#462)

prism-react-renderer strips the trailing newline from each tokenized
line, and PrismSyntaxHighlighter rendered lines as inline spans, so
multi-line code blocks in comment bodies collapsed into a single line
(yoshiko-pg#460). Re-insert the newline between lines in the shared component
and drop the per-call-site workarounds in NotebookDiffViewer and
global.css that papered over the same defect.

Fixes yoshiko-pg#460

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to 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.

Fenced code blocks in comment bodies render on a single line, with newlines dropped

1 participant