[BUG] Intermittent Markdown Formatting Misalignment

Status Fixed / completed
Reported on v2.1.7
Maintainer reply None cached
Activity 5 comments · opened Jan 25, 2026 · closed Jan 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Markdown formatting (bold, italic, code) renders at incorrect character positions intermittently. Random 2-4 character spans get styled instead of the intended words. The bug is inconsistent - sometimes formatting works correctly, sometimes it doesn't, even within the same response.

Behavior:

  • Short responses tend to render correctly
  • Longer responses with multiple formatting elements intermittently break
  • Within the same response, some formatting is correct, some is wrong
  • Styling appears shifted/misaligned from intended position

Example:
When Claude intends to write:

The Go programming language was designed for simplicity.

What actually renders (sometimes):

The Go programming language was designed for simplicity.

The bold styling is applied to the wrong character range.

Likely Cause:
Appears to be a streaming/chunking issue where ANSI escape codes get misaligned based on chunk boundaries during rendering.

Related:
v2.1.6 changelog mentioned fix for "text styling (bold, colors) getting progressively misaligned" - this bug differs: it's intermittent from the start, not progressive over time.

What Should Happen?

Markdown formatting (bold, italic, code) should render at the correct character positions consistently. The styled text should match exactly what Claude intended to format.

Error Messages/Logs

Steps to Reproduce

  1. Start a new Claude Code session
  2. Ask Claude to write several paragraphs with intentional bold/italic formatting
  3. Observe that formatting sometimes appears at wrong positions
  4. Short responses may work; longer ones more likely to fail
  5. Bug can appear from the very first response (not progressive)
  6. Tested across PowerShell 7, PowerShell 5.1, CMD (Windows Terminal and conhost) - bug appears in ALL terminals

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.7

Claude Code Version

2.1.19

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Tested across multiple terminals (PowerShell 7, PowerShell 5.1, CMD via Windows Terminal and conhost) - bug appears in ALL of them, ruling out terminal-specific causes. The issue is in Claude Code's Ink/React TUI renderer generating misaligned ANSI escape codes.

Screenshots

<img width="1254" height="653" alt="Image" src="https://github.com/user-attachments/assets/57d5c645-e480-4e67-942d-16271a1ed9f0" />
<img width="921" height="597" alt="Image" src="https://github.com/user-attachments/assets/984fed50-266a-4516-8854-ad4ebf0f085c" />

View original on GitHub ↗

5 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14720
  2. https://github.com/anthropics/claude-code/issues/17892
  3. https://github.com/anthropics/claude-code/issues/20126

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

EyeSeeEm · 7 months ago

Update: Even more extreme case observed

This screenshot shows an even more severe manifestation of the bug - entire text blocks rendered with rainbow gradient coloring where individual characters cycle through different colors:

!Extreme formatting bug

Note: The code block at top is syntax highlighting (expected). But the text below shows:

  • "Bottom line" starting in red
  • Characters cycling through red → yellow → green → cyan → blue throughout normal prose
  • Even the comments in code blocks have gradient effects applied incorrectly

This is NOT a duplicate of the other issues - those show minor misalignment. This shows the underlying rendering bug in its most extreme form.

---
Screenshot to be uploaded

EyeSeeEm · 7 months ago

Screenshot: Rainbow gradient text rendering bug

The attached screenshot shows an extreme case where normal prose text renders with rainbow gradient coloring - individual characters cycling through red → yellow → green → cyan → blue.

This is clearly the same underlying bug (ANSI escape code misalignment) in its most severe form.

Image: See attached in next comment (GitHub CLI limitation - uploading via web)

EyeSeeEm · 7 months ago

Closing as duplicate of #17892 - adding new screenshot there instead.

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.