[PR #13704] feat(app): add preview and source view options for markdown files in file tabs #14782

Open
opened 2026-02-16 18:19:32 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/13704

State: open
Merged: No


Description

This PR closes #13705 by adding a preview/source toggle for Markdown files in the file viewer, allowing users to switch between rendered markdown preview and raw source code.

What's Changed

UI Enhancement:

  • Added a toggle button group (Preview/Source) that appears at the top of Markdown files
  • Preview mode is enabled by default when opening .md or .markdown files
  • Users can switch between:
    • Preview mode (eye icon): Renders the markdown content
    • Source mode (code icon): Shows the raw markdown code

Implementation Details:

  • Added isMarkdown() memo to detect Markdown files by extension
  • Introduced previewMode signal to track the current view state
  • Integrated IconButton and Markdown components from the UI library
  • Preview uses the existing Markdown component with proper caching

Internationalization:
Added translations for the new UI elements in all supported language

Files Modified

  • packages/app/src/pages/session/file-tabs.tsx - Main implementation
  • packages/app/src/i18n/*.ts - Translation strings for all languages
image
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/13704 **State:** open **Merged:** No --- ## Description This PR closes #13705 by adding a preview/source toggle for Markdown files in the file viewer, allowing users to switch between rendered markdown preview and raw source code. ### What's Changed **UI Enhancement:** - Added a toggle button group (Preview/Source) that appears at the top of Markdown files - Preview mode is enabled by default when opening `.md` or `.markdown` files - Users can switch between: - **Preview mode** (eye icon): Renders the markdown content - **Source mode** (code icon): Shows the raw markdown code **Implementation Details:** - Added `isMarkdown()` memo to detect Markdown files by extension - Introduced `previewMode` signal to track the current view state - Integrated `IconButton` and `Markdown` components from the UI library - Preview uses the existing `Markdown` component with proper caching **Internationalization:** Added translations for the new UI elements in all supported language ### Files Modified - `packages/app/src/pages/session/file-tabs.tsx` - Main implementation - `packages/app/src/i18n/*.ts` - Translation strings for all languages <img width="462" height="153" alt="image" src="https://github.com/user-attachments/assets/6fff2351-5f74-477f-b060-42bdd345cf3f" />
yindo added the pull-request label 2026-02-16 18:19:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14782