Skip to content

TUI markdown renderer collapses loose list spacing after code blocks #19702

@joshka

Description

@joshka

What version of Codex CLI is running?

codex-cli 0.125.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.5

What platform is your computer?

Darwin 24.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Ghostty

What issue are you seeing?

Markdown list items that contain block content, especially fenced code blocks, can render without a visual blank separator before the next list item.

The model output includes the blank line in the stored session JSONL, so this appears to be a TUI markdown rendering issue rather than the model omitting the newline.

Given source markdown like:

1. First:

   ```rust
   fn foo() {}
   ```

2. Second:

Actual TUI rendering is visually closer to:

1. First:

   fn foo() {}
2. Second:

Expected TUI rendering:

1. First:

   fn foo() {}

2. Second:

What steps can reproduce the bug?

Render a markdown response in the Codex TUI with an ordered list where one item contains a fenced code block and the next item follows after a blank line:

1. First:

   ```rust
   fn foo() {}
   ```

2. Second:

The source markdown has a blank line between the first item content and the next marker, but the rendered transcript can omit the visual separator.

What is the expected behavior?

The TUI should preserve a readable blank separator before the next list marker when the previous list item contains block content such as a fenced code block.

Simple or tight lists should remain compact:

1. First

2. Second

can still render as:

1. First
2. Second

The goal is not to add extra vertical space to every list item, only to avoid visually attaching the next marker to block-heavy list content.

Additional information

A local fix has been drafted on fork branch:

https://github.com/joshka/codex/tree/joshka/markdown-list-spacing

The draft change tracks when a list item contains block content and preserves a separator before the next marker only in that case. It includes regression coverage for both paths: code-block list items keep the separator, and simple list items stay compact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displaybugSomething isn't working

    Type

    No type
    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