Improve markdown quotes, nested lists, code inside lists, consistent vertical spacing#597
Improve markdown quotes, nested lists, code inside lists, consistent vertical spacing#597remorses wants to merge 13 commits intoanomalyco:mainfrom
Conversation
The script now: - Links packages in both Bun cache AND node_modules - Removes nested dependencies (solid-js, react, etc.) from opentui packages before linking, so they resolve from the target project - Uses target project's versions of shared deps instead of opentui's
Prevent markdown blocks from shrinking and add complex snapshots to catch layout regressions.
@opentui/core
@opentui/react
@opentui/solid
@opentui/core-darwin-arm64
@opentui/core-darwin-x64
@opentui/core-linux-arm64
@opentui/core-linux-x64
@opentui/core-win32-arm64
@opentui/core-win32-x64
commit: |
Apply prettier changes and keep markdown rendering tests aligned after formatting.
There was a problem hiding this comment.
Pull request overview
This PR improves markdown rendering with a focus on blockquotes, lists, and layout stability. The changes address rendering issues found in OpenCode, particularly around quote/list formatting and spacing.
Changes:
- Refactored blockquote rendering to use a left-border container instead of inline ">" prefixes
- Added flexShrink default of 0 to prevent markdown content from shrinking under large content
- Normalized list and task list rendering with proper indentation support for nested lists
- Added comprehensive test snapshots for complex markdown scenarios including nested lists, blockquotes, and mixed content
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/core/src/renderables/Markdown.ts | Refactored blockquote rendering to use BoxRenderable with left border; enhanced list rendering with indent parameter and task list support; added margin update logic for unchanged tokens |
| packages/core/src/renderables/tests/Markdown.test.ts | Added tests for nested lists, complex markdown documents, streaming blockquotes/tasks, and theme switching; updated snapshots to reflect new blockquote rendering |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Treat newline-terminated tables as complete in streaming mode and add a conceal=false snapshot to cover the behavior.
Avoid dereferencing missing blockquote children during updates.
|
|
||
| if (token.type === "space") { | ||
| return null | ||
| const box = new BoxRenderable(this.ctx, { |
There was a problem hiding this comment.
That's too many boxes in boxes just to render a quote prefix. There must be a better way than stacking more and more renderables that blow up the yoga layout.
There was a problem hiding this comment.
The issue using prefixes is that you can only add it to the first line reliably. if the quote has more than one line or the line wraps it doesn't look good.
You also have to consider quotes can contain other markdown nodes, even tables, not only text, it makes sense to wrap them in boxes. It composes really well
I can add a benchmark to see if this has any bad performance implications
Adding experimental support for markdown in opencode I found various issues with quotes, nested lists, inconsistent spacing between elements, code blocks inside lists. This PR fixes all of them. Also added more tests with snapshots to show how the markdown output looks like in the TUI.