Bug
In the chat view, when a fenced code block immediately follows or is nested in a list, the vertical spacing is asymmetric — there is no padding above the code block, but normal padding below it.
Repro markdown:
- list item
- another list item
```
code
```
- list
Cause
Chat code blocks (.rendered-markdown [data-code]) only carry a bottom margin (margin: 0 0 16px 0) and rely on the previous element's bottom margin for the space above them. Inside a list, list items collapse their inner paragraph margins to stay tight (.rendered-markdown li > p { margin: 0 }), so a code block that follows list content ends up with 0 space above it while keeping 16px below.
Two DOM shapes are affected, depending on whether the fence is indented under a list item or is a sibling between two lists.
Fix
Give code blocks that follow a list (or are nested in a list item) a matching 16px top margin. Margin collapsing keeps the other cases (after a paragraph, first child, tool calls / progress UI) unchanged.
(Written by Copilot)
Bug
In the chat view, when a fenced code block immediately follows or is nested in a list, the vertical spacing is asymmetric — there is no padding above the code block, but normal padding below it.
Repro markdown:
Cause
Chat code blocks (
.rendered-markdown [data-code]) only carry a bottom margin (margin: 0 0 16px 0) and rely on the previous element's bottom margin for the space above them. Inside a list, list items collapse their inner paragraph margins to stay tight (.rendered-markdown li > p { margin: 0 }), so a code block that follows list content ends up with0space above it while keeping16pxbelow.Two DOM shapes are affected, depending on whether the fence is indented under a list item or is a sibling between two lists.
Fix
Give code blocks that follow a list (or are nested in a list item) a matching
16pxtop margin. Margin collapsing keeps the other cases (after a paragraph, first child, tool calls / progress UI) unchanged.(Written by Copilot)