TUI markdown renderer collapses loose list spacing after code blocks

Resolved 💬 2 comments Opened Apr 26, 2026 by joshka Closed Apr 27, 2026

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:

````markdown

  1. First:

``rust
fn foo() {}
``

  1. 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:

````markdown

  1. First:

``rust
fn foo() {}
``

  1. 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.

View original on GitHub ↗

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