# stack

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/tui/widgets/final_markdown/_rows/stack)

Stack blocks vertically, collapsing adjacent margins like Textual.

The first block's top margin and the last block's bottom margin stay, as
they do inside an auto-height Textual container.

## Signature

```python
stack(
    blocks: list[Block],
) -> list[Row]
```

## Returns

`list[Row]`

The combined rows.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/6a8d452d70f9bcb978e6bd44831dda093ecbe928/libs/code/deepagents_code/tui/widgets/final_markdown/_rows.py#L109)