Skip to content

feat(tui): markdown preview panel - #43599

Draft
littledsw wants to merge 1 commit into
anomalyco:devfrom
littledsw:md-preview
Draft

feat(tui): markdown preview panel#43599
littledsw wants to merge 1 commit into
anomalyco:devfrom
littledsw:md-preview

Conversation

@littledsw

Copy link
Copy Markdown

Issue for this PR

Closes #43598

Type of change

  • New feature

What does this PR do?

Adds /preview to the session view. It opens the fuzzy file picker (same fs.find search as @-mentions) and renders the selected file as markdown in a panel to the right of the session: an inline split pane on wide terminals and a right-docked overlay on narrow ones, mirroring the sidebar layout. Running /preview again closes it. New keybind tokens preview_toggle / preview_close default to unbound.

The panel reuses the built-in <markdown> renderable with streaming={false}, so content renders exactly like assistant messages (headings, code blocks, grid tables). Related web/desktop request: #38047 — TUI has no file preview today.

How did you verify your code works?

  • bun test in packages/tui: adds test/cli/tui/markdown-preview.test.tsx (rendered file content + unreadable-file state). Full suite: 194 pass; the 1 failure (runtime.test.tsx expects ~/project but gets ~\project) is a pre-existing Windows path-separator issue that also fails on an unmodified checkout.
  • packages/tui typecheck passes (tsgo --noEmit). oxlint + prettier clean on touched files.
  • Verified manually with a headless testRender mount: frame below.

Screenshots / recordings

Headless testRender capture (side-by-side, dark theme):

``

鈼?session "shipping rules analysis" CHANGELOG.md

user: # Changelog

what shipped to Shanghai last week? ## 1.2.0

assistant: - add /preview panel for rendered markdown
- sidebar-respecting split layout
Found 1,284 orders across 3 hubs. Details in the table on the right 鈥?
SELECT city, count(*) AS cnt
鈻峚sk anything鈥? FROM orders
GROUP BY 1 ORDER BY 2 DESC;

                                                                            鈹屸攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹攢鈹€鈹€鈹€鈹€鈹€鈹€鈹攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹?
                                                                            鈹侳lag          鈹侱efault鈹侲ffect                 鈹?
                                                                            鈹溾攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹尖攢鈹€鈹€鈹€鈹€鈹€鈹€鈹尖攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹?
                                                                            鈹俻review_toggle鈹俷one   鈹倀oggles the preview    鈹?
                                                                            鈹?             鈹?      鈹俻anel                  鈹?
                                                                            鈹溾攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹尖攢鈹€鈹€鈹€鈹€鈹€鈹€鈹尖攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹?
                                                                            鈹俻review_close 鈹俷one   鈹俢loses an open panel   鈹?
                                                                            鈹斺攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹粹攢鈹€鈹€鈹€鈹€鈹€鈹€鈹粹攢鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹€鈹?

                                                                            See **CONTRIBUTING.md** for details.







                                                                            /preview to close

``

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

/preview opens a fuzzy file picker and renders the selected file as
rendered markdown in a side panel next to the session: inline split on
wide terminals, right-docked overlay on narrow ones, matching the
sidebar layout pattern. Token-/command-configurable keybinds
preview_toggle and preview_close default to unbound.
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.

[FEATURE]: markdown preview of project files in the TUI

1 participant