Skip to content

Markdown renderer draws the closing code fence inside the block when the message ends exactly at the fence #555

Description

@Adam-Dalloul

codeg v0.28.0, Windows 11, codex agent (but the bug is in the renderer, not the agent).

Symptom

A message that ends with a fenced code block renders the CLOSING fence as a second content line inside the block, with the caret sitting after it:

1  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2  ```_

The raw source is valid

I pulled the exact assistant text from the agent's session file on disk. The message tail is well-formed and ends immediately after the closing fence, with no trailing newline:

SHA-256:\n\n```text\ne3b0c442...52b855\n```

So the parser fails to terminate the block when the closing ``` is the final bytes of the message (no \n after it), and prints the backticks as code content instead. A block with any text following it in the same message renders fine.

Cosmetic only, but it makes copy-buttoned output (hashes, keys, one-liners) look wrong and the copied text can include the stray fence line.

Repro: have any agent reply with a message whose last characters are a closing fence, e.g. exactly:

SHA:

```text
abc123
```

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions