claude-code - 💡(How to fix) Fix CLI renders excess vertical spacing inside markdown paragraphs / code blocks [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54292Fetched 2026-04-29 06:31:15
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

A user reported that long markdown content rendered in the Claude Code CLI shows excess vertical spacing inside what should be single paragraphs. Specifically, paragraphs and code-fence contents that contain hard line breaks (single \n between text lines) appear visually as double-spaced or with extra blank lines between every line.

Root Cause

A user reported that long markdown content rendered in the Claude Code CLI shows excess vertical spacing inside what should be single paragraphs. Specifically, paragraphs and code-fence contents that contain hard line breaks (single \n between text lines) appear visually as double-spaced or with extra blank lines between every line.

Fix Action

Fix / Workaround

Notes

  • Filing on behalf of an end user who flagged it during a long-form session.
  • I do not have a screenshot in this filing; happy to follow up with one if useful.
  • Workaround for now: avoid hard-wrapping prose inside code fences; let the renderer wrap naturally.
RAW_BUFFERClick to expand / collapse

Summary

A user reported that long markdown content rendered in the Claude Code CLI shows excess vertical spacing inside what should be single paragraphs. Specifically, paragraphs and code-fence contents that contain hard line breaks (single \n between text lines) appear visually as double-spaced or with extra blank lines between every line.

Environment

  • Claude Code CLI (current as of 2026-04-28)
  • macOS Darwin 24.5.0, zsh
  • Terminal renderer: standard

Repro (approximate)

Have the model output a long-form response with code blocks containing soft-wrapped prose, e.g.

``` Spirited launched April 28, 2026 in Food & Drink. It is a cocktail recipe app built around a simple wedge: your bar already holds great drinks, you just don't know what they are. ```

Expected: prose lines render contiguously with normal single line height inside the code fence.

Observed (per user): the rendered output appears with extra vertical space between every line, making the content look double-spaced and harder to read.

Hypothesis

Possibly the CLI's markdown renderer is treating single `\n` inside code fences as paragraph breaks, or inserting extra leading/trailing whitespace per line. Could also be CommonMark hard-break handling (` \n`) being applied where it shouldn't.

Notes

  • Filing on behalf of an end user who flagged it during a long-form session.
  • I do not have a screenshot in this filing; happy to follow up with one if useful.
  • Workaround for now: avoid hard-wrapping prose inside code fences; let the renderer wrap naturally.

Impact

Readability suffers in long-form responses, especially when the user wants to copy-paste prose blocks (e.g. content destined for forms or other systems).

extent analysis

TL;DR

The issue can likely be mitigated by avoiding hard line breaks inside code fences and letting the renderer wrap text naturally.

Guidance

  • Verify if the issue persists when removing hard line breaks (\n) within code fences, to confirm the hypothesis about the markdown renderer's behavior.
  • Test if using a different markdown syntax, such as adding a backslash at the end of each line (\) to indicate a line break, affects the rendering.
  • Consider adjusting the terminal renderer settings to see if it influences the output, although the standard renderer is specified.
  • Check if the issue is specific to the Claude Code CLI or if it also occurs in other markdown rendering environments.

Example

No code snippet is provided as the issue is more related to the rendering of markdown content rather than a specific code implementation.

Notes

The provided hypothesis suggests that the issue might be related to how the CLI's markdown renderer handles hard line breaks or CommonMark hard-break handling, but without further details or a screenshot, it's difficult to provide a definitive solution.

Recommendation

Apply workaround: Avoid hard-wrapping prose inside code fences and let the renderer wrap naturally, as this seems to mitigate the issue according to the provided notes.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix CLI renders excess vertical spacing inside markdown paragraphs / code blocks [1 comments, 2 participants]