feat(app): add markdown preview/source toggle for file tabs#22079
feat(app): add markdown preview/source toggle for file tabs#22079alankyshum wants to merge 3 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Related PR FoundPR #13704: feat(app): add preview and source view options for markdown files in file tabs Relationship: This is the original PR that the current PR #22079 reimplements. According to the description, PR #22079 "reimplements the approach from #13704 by @kimi-chen from scratch against the current |
7cd6779 to
ceab56e
Compare
|
This would also address #14187, I think. |
Fix: Rendering issue resolved@KnutZuidema Thanks for the bug report! The rendering issue was caused by invalid Tailwind CSS class names:
Also added defensive guard against binary Fixed in commit 29e8ade. |
66aacde to
e4a4507
Compare
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>
- bg-surface → bg-surface-base (fixes transparent toolbar background) - bg-surface-active → bg-surface-base-active (fixes toggle button state) - text-text → text-text-base (fixes button text color) - border-border → border-border-base (fixes toolbar border) - Add binary content guard on preview Match condition Fixes rendering issue reported by KnutZuidema where file contents showed behind the toolbar due to transparent background. Refs: BLD-1 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e4a4507 to
3cf0eec
Compare
|
Hi @KnutZuidema Please let me know what I need to do to get this PR approved. |
|
@alankyshum I'm not a maintainer, so I can't tell you. I would like to see this feature merged as well though. |
…nt bleed-through The toolbar used bg-surface-base which resolves to rgba(0,0,0,0.031) — nearly transparent. When scrolling, file contents were visible behind the sticky toolbar. Switch to bg-background-base (#f8f8f8/#101010) which is fully opaque, matching the pattern used by other sticky headers in the app.

Issue for this PR
Continues #13704
Type of change
What does this PR do?
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.Changes:
file-tabs.tsx— Added aMarkdownTogglecomponent that renders Preview/Source toggle buttons when the active file is Markdown. UsescreateSignalfor view mode state. The preview renders markdown to HTML using the existing markdown utility. Source view shows the raw file content with syntax highlighting."preview"and"source"translation keys across all 17 locale files for the toggle button labels.This reimplements the approach from #13704 by @kimi-chen from scratch against the current
devbranch after significant codebase refactoring made the original PR unmergeable.How did you verify your code works?
.mdand.markdownfilesbun test)bun typecheck)settings.spec.ts(same as upstreamdevbranch — pre-existing, unrelated to this PR)Screenshots / recordings
Checklist