feat(app): add markdown preview/source toggle for file tabs#22057
Closed
alankyshum wants to merge 1 commit into
Closed
feat(app): add markdown preview/source toggle for file tabs#22057alankyshum wants to merge 1 commit into
alankyshum wants to merge 1 commit into
Conversation
Add a Preview/Source toggle for Markdown files in the session file viewer. Detects .md/.markdown files and defaults to rendered preview mode. Auto-switches to Source view when navigating to a comment. Excludes binary files from the toggle. Includes i18n translations for all 17 supported locales. Based on work by @kimi-chen in anomalyco#13704. Co-authored-by: kimi-chen <kimi-chen@users.noreply.github.com> Co-Authored-By: Paperclip <noreply@paperclip.ing>
Contributor
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potentially Related PR Found:
Why it's related: This is the original PR by @kimi-chen that the current PR (#22057) reimplements. Per the description, PR #22057 "Continues the work from #13704...reimplemented from scratch against the current |
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.
Summary
Adds a Preview / Source toggle for Markdown files in the file viewer tab. When a
.mdor.markdownfile is opened, a sticky toolbar appears with Preview and Source buttons, defaulting to the rendered preview. Clicking a comment automatically switches to Source view for inline annotation.Continues the work from #13704 by @kimi-chen, reimplemented from scratch against the current
devbranch after significant codebase refactoring.Changes
file-tabs.tsx— AddedisMarkdownmemo,previewsignal, comment-focus effect (auto-switches to Source when a comment is focused), sticky toggle toolbar, and<Markdown>rendered preview using the existing@opencode-ai/ui/markdowncomponentsession.files.viewPreviewandsession.files.viewSourcekeys across all 17 locale files (en, de, es, fr, ja, zh, zht, ar, br, bs, da, ko, no, pl, ru, th, tr)Design Decisions
state()?.content?.type !== "binary")<Markdown>component from@opencode-ai/ui/markdownCredit
This feature was originally proposed and prototyped in #13704 by @kimi-chen. This PR is a clean reimplementation addressing the review feedback from that PR (binary guard, comment focus, i18n coverage).
Co-authored-by: kimi-chen kimi-chen@users.noreply.github.com