feat(tui): markdown preview panel - #43599
Draft
littledsw wants to merge 1 commit into
Draft
Conversation
/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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #43598
Type of change
What does this PR do?
Adds
/previewto the session view. It opens the fuzzy file picker (samefs.findsearch 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/previewagain closes it. New keybind tokenspreview_toggle/preview_closedefault to unbound.The panel reuses the built-in
<markdown>renderable withstreaming={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 testinpackages/tui: addstest/cli/tui/markdown-preview.test.tsx(rendered file content + unreadable-file state). Full suite: 194 pass; the 1 failure (runtime.test.tsxexpects~/projectbut gets~\project) is a pre-existing Windows path-separator issue that also fails on an unmodified checkout.packages/tuitypecheck passes (tsgo --noEmit). oxlint + prettier clean on touched files.testRendermount: 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
/previewpanel 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;
``
Checklist