Skip to content

Conversation

@remorses
Copy link
Contributor

@remorses remorses commented Jan 27, 2026

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.

  • Fix blockquote rendering by using a left-border container and keep markdown blocks from shrinking under large content.
  • Normalize list/task rendering and expand snapshots after seeing OpenCode quote/list rendering issues and spacing glitches.
  • Add a theme-switch preview snapshot to catch visual drift.

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.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 27, 2026

@opentui/core

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core@597

@opentui/react

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/react@597

@opentui/solid

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/solid@597

@opentui/core-darwin-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-arm64@597

@opentui/core-darwin-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-x64@597

@opentui/core-linux-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-arm64@597

@opentui/core-linux-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-x64@597

@opentui/core-win32-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-arm64@597

@opentui/core-win32-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-x64@597

commit: ac80235

Apply prettier changes and keep markdown rendering tests aligned after formatting.
@remorses remorses marked this pull request as ready for review January 27, 2026 22:26
Copilot AI review requested due to automatic review settings January 27, 2026 22:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@remorses remorses marked this pull request as draft January 28, 2026 12:17
@remorses remorses marked this pull request as ready for review January 28, 2026 14:10
@remorses remorses changed the title Improve markdown layout and snapshots Improve markdown quotes, nested lists, code inside lists, consistent vertical spacing Jan 31, 2026

if (token.type === "space") {
return null
const box = new BoxRenderable(this.ctx, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

@remorses remorses Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants