[Bug] Markdown code block formatting not properly disabled for fenced blocks without language hints

Resolved 💬 6 comments Opened Nov 28, 2025 by AgarwalSaurav Closed Feb 11, 2026

Bug Description

Claude Code Markdown Rendering Bug Report

Environment

| Property | Value |
|----------|-------|
| Date | 2025-11-29 |
| OS | Linux 6.12.59-1-lts |
| Claude Code | 2.0.55 |
| Claude Model | claude-opus-4-5-20251101 (Opus 4.5) |

Terminals Tested

GNOME Terminal

| Property | Value |
|----------|-------|
| Terminal Emulator | GNOME Terminal 3.58.0 (VTE 0.82.2) |
| TERM | xterm-256color |

GNOME Console (kgx)

| Property | Value |
|----------|-------|
| Terminal Emulator | KGX 49.1 (VTE 0.82.2 +BIDI +GNUTLS +ICU +SYSTEMD) |
| TERM | xterm-256color |
| COLORTERM | truecolor |
| TERM_PROGRAM | kgx |

Alacritty

| Property | Value |
|----------|-------|
| Terminal Emulator | Alacritty 0.16.1 (42f49eeb) |
| TERM | alacritty |
| COLORTERM | truecolor |

tmux (inside Alacritty)

| Property | Value |
|----------|-------|
| Terminal Multiplexer | tmux 3.6 |
| TERM | screen-256color |
| COLORTERM | truecolor |
| TERM_PROGRAM | tmux |

---

Summary

| Test | Result | Bug? |
|------|--------|------|
| 1. Inline code | Correct | No |
| 2. Backslash escape | Underscores disappeared | Yes |
| 3. Fenced code block | Text between underscores italicized | Yes |
| 4. Fenced code block + language hint | Correct | No |
| 5. Indented code block | Italicized, indentation not shown | Yes |
| 6. Raw underscores | Correct | No |
| 7. Mixed underscores in prose | Correct | No |

Key Findings:

  • Workaround: Use fenced code blocks with a language hint (e.g., `text )
  • Backslash escaping removes underscores instead of displaying them literally
  • Plain fenced code blocks incorrectly apply markdown formatting
  • Raw underscores in prose render correctly without escaping

---

Test Details

Test 1: Inline code (single backticks)

Expected: Monospace text with literal underscores visible
Input: foo_bar_baz.txt and hello_world_test.txt
Rendered: foo_bar_baz.txt and hello_world_test.txt
Verdict: Correct

---

Test 2: Escaped underscores with backslash

Expected: Plain text with visible underscores, no italics
Input: foo\_bar\_baz.txt and hello\_world\_test.txt
Rendered: foobarbaz.txt and helloworldtest.txt
Verdict: Incorrect — underscores are removed instead of displayed

---

Test 3: Fenced code block (triple backticks)

Expected: Monospace block with literal underscores
Input:

foo_bar_baz.txt
hello_world_test.txt

Rendered: foo_bar_baz.txt and hello_world_test.txt
Verdict: Incorrect — underscores visible but _bar_ and _world_ are italicized

---

Test 4: Fenced code block with language hint

Expected: Monospace block with literal underscores
Input:

foo_bar_baz.txt
hello_world_test.txt

Rendered: foo_bar_baz.txt and hello_world_test.txt
Verdict: Correct — no italicization

---

Test 5: Indented code block (4 spaces)

Expected: Monospace block with literal underscores and indentation
Input:

foo_bar_baz.txt
hello_world_test.txt

Rendered: foo_bar_baz.txt and hello_world_test.txt
Verdict: Incorrect — _bar_ and _world_ are italicized, indentation not displayed

---

Test 6: Raw underscores (no escaping)

Expected: Text between underscores italicized
Input: foo_bar_baz.txt and hello_world_test.txt
Rendered: foo_bar_baz.txt and hello_world_test.txt
Verdict: Correct — underscores displayed literally (unexpected but correct)

---

Test 7: Mixed underscores in prose

Expected: Text between underscores italicized
Input: The file_name_here has multiple_underscores_in_it.
Rendered: The file_name_here has multiple_underscores_in_it.
Verdict: Correct — underscores displayed literally (unexpected but correct)

Environment Info

  • Platform: linux
  • Terminal: kgx
  • Version: 2.0.55
  • Feedback ID: 4bdd943f-da2c-431f-b6e1-cb56b727367a

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗