Skip to content

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

Closed

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.

Activity

  1. added
    bugSomething isn't working
    CLIIssues related to the Codex CLI
    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal display
    on Apr 26, 2026
  2. added a commit that references this issue on Apr 27, 2026
    52c06b8
  3. etraut-openai commented on Apr 27, 2026

    @etraut-openai
    Contributor

    Thanks for the bug report @joshka! This will be addressed in the next release.

  4. joshka commented on Apr 28, 2026

    @joshka
    Author

    Thanks Eric.

  5. added a commit that references this issue on May 7, 2026
    4f488ba
  6. added a commit that references this issue on Jun 27, 2026
    0923cc4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions