Skip to content

Numbered-list markdown renders a double space after the marker #684

Description

@sean-kim05

In strix/interface/tui/renderers/agent_message_renderer.py, _apply_markdown_styles() renders an ordered-list line by emitting its own "N. " prefix and then re-rendering the remainder of the line:

elif len(line) > 2 and line[0].isdigit() and line[1:3] in (". ", ") "):
    result.append(line[0] + ". ", style="#22c55e")
    result.append_text(_process_inline_formatting(line[2:]))   # <-- line[2:] keeps the marker's trailing space

A numbered marker like "1. " is 3 characters (digit, punctuation, space), but the remainder is sliced at line[2:], which still includes the space at index 2. The self-emitted "N. " prefix already ends in a space, so the output contains two spaces after the marker.

The sibling bullet branch two lines above uses line[2:] correctly because "- " is exactly 2 chars — showing the intended pattern is "skip the whole marker."

Reproduction (verified):

  • _apply_markdown_styles("1. Hello").plain"1. Hello" (two spaces; should be "1. Hello")
  • _apply_markdown_styles("2) World").plain"2. World" (double space)
  • Bullets are correct: _apply_markdown_styles("- Item").plain"• Item" (single space)

Fix: slice the remainder at line[3:] for the 3-char numbered marker. Happy to open a PR with a regression test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions