claude-code - 💡(How to fix) Fix CLI markdown renderer creates phantom ordered-list item when content contains a sentence-ending digit (e.g. "Phase 5.") [1 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#52010Fetched 2026-04-23 07:38:58
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4closed ×1

When an assistant-authored ordered list contains a list item whose text includes a sentence ending with a digit + period (e.g. Phase 5.), the rendered output in the CLI appears to treat the wrapped 5. as a new ordered-list item. The effect is a visible phantom entry and renumbering of subsequent items.

The source markdown is a single line — no literal newline is present between Phase and 5. — so a spec-compliant CommonMark parser operating on source newlines should not create a new item. This suggests the renderer is either wrapping before parsing, or reparsing wrapped lines.

Root Cause

When an assistant-authored ordered list contains a list item whose text includes a sentence ending with a digit + period (e.g. Phase 5.), the rendered output in the CLI appears to treat the wrapped 5. as a new ordered-list item. The effect is a visible phantom entry and renumbering of subsequent items.

The source markdown is a single line — no literal newline is present between Phase and 5. — so a spec-compliant CommonMark parser operating on source newlines should not create a new item. This suggests the renderer is either wrapping before parsing, or reparsing wrapped lines.

Fix Action

Workaround

Assistants can defensively avoid sentence-final numeric references inside ordered lists — but the renderer correctness is the right fix.

RAW_BUFFERClick to expand / collapse

Summary

When an assistant-authored ordered list contains a list item whose text includes a sentence ending with a digit + period (e.g. Phase 5.), the rendered output in the CLI appears to treat the wrapped 5. as a new ordered-list item. The effect is a visible phantom entry and renumbering of subsequent items.

The source markdown is a single line — no literal newline is present between Phase and 5. — so a spec-compliant CommonMark parser operating on source newlines should not create a new item. This suggests the renderer is either wrapping before parsing, or reparsing wrapped lines.

Reproduction

Have the model emit an ordered list where one item contains a sentence ending in digit., with enough preceding text that terminal wrapping pushes <digit>. to the start of a visually rendered line.

Example source (single paragraph inside item 2):

```

  1. ✅ Embedding backfill — done (5,197/5,197 embedded, daily launchd job scheduled)
  2. ⏸️ Timeline entries — reframed as Phase 5 pipeline work, not a gap. Only tackle if you want to continue GBrain-integration Phase 5.
  3. 🟡 pai cache-secrets bug — still open ```

Actual rendered output (as seen by the user)

```

  1. ✅ Embedding backfill — done (5,197/5,197 embedded, daily launchd job scheduled)
  2. ⏸️ Timeline entries — reframed as Phase 5 pipeline work, not a gap. Only tackle if you want to continue GBrain-integration Phase
  3. 🟡 pai cache-secrets bug — still open ```

(The `5.` line renders as an empty list item, fragmenting the intended 3-item list into visual confusion.)

Expected

A sentence-final `digit + period` that appears mid-paragraph in source markdown should remain part of that paragraph after rendering, regardless of terminal width or word-wrap behavior. Wrapping should be a display-only transform applied after markdown parsing.

Workaround

Assistants can defensively avoid sentence-final numeric references inside ordered lists — but the renderer correctness is the right fix.

Environment

  • darwin 25.4.0, zsh
  • Claude Code CLI (terminal output)
  • Model: Opus 4.7 (1M context)
  • Observed 2026-04-22

extent analysis

TL;DR

The issue can be mitigated by ensuring that the markdown parser handles sentence-final digits and periods correctly, potentially by adjusting the parsing order or handling of wrapped lines.

Guidance

  • Verify that the markdown parser is spec-compliant and handles sentence-final digits and periods as part of the paragraph, rather than as a new list item.
  • Check if the renderer is wrapping text before parsing, and if so, consider adjusting the rendering process to wrap text after parsing.
  • Test the renderer with different terminal widths and word-wrap behaviors to ensure that the issue is not specific to a particular environment.
  • Consider adding a workaround to the assistant's output to avoid sentence-final numeric references inside ordered lists, as mentioned in the issue.

Example

No code snippet is provided as the issue is related to the markdown parser and renderer, and not a specific code snippet.

Notes

The issue seems to be related to the interaction between the markdown parser and the renderer, and may require adjustments to the parsing or rendering process to fix. The provided workaround may help mitigate the issue, but a proper fix would require changes to the renderer or parser.

Recommendation

Apply workaround: Avoid sentence-final numeric references inside ordered lists until the renderer correctness is fixed, as this can help mitigate the issue and prevent visual confusion.

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