Skip to content

Show rendered md by default#3594

Merged
TheodoreSpeaks merged 4 commits intostagingfrom
fix/render-md
Mar 15, 2026
Merged

Show rendered md by default#3594
TheodoreSpeaks merged 4 commits intostagingfrom
fix/render-md

Conversation

@TheodoreSpeaks
Copy link
Collaborator

Summary

Render formatted markdown by default. Switch icon for raw to pencil

Fixes #(issue)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

Validated md, html, raw files show correct icons.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

@vercel
Copy link

vercel bot commented Mar 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 15, 2026 2:01am

Request Review

@cursor
Copy link

cursor bot commented Mar 15, 2026

PR Summary

Low Risk
Low risk UI/UX behavior change that mainly adjusts default preview mode and related icons/labels; minimal logic changes, but could slightly alter expected editing/preview defaults when selecting or creating files.

Overview
Rendered preview is now the default view for rich-previewable text files (e.g., markdown), switching FileViewer’s fallback from split to preview when preview is enabled.

In Files, newly created files now open directly in edit (preview hidden) while other file selections default back to preview, and the preview toggle action is relabeled to Preview/Edit with matching Eye/Pencil icons.

Cleans up preview mode plumbing by removing PREVIEW_ONLY_EXTENSIONS and making MothershipView always start resources in preview mode, with updated ResourceTabs preview-mode icons.

Written by Cursor Bugbot for commit 00d513e. This will update automatically on new commits. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 15, 2026

Greptile Summary

This PR changes the default preview experience for files to render formatted markdown immediately, rather than starting in split view. It also updates the cycle-button icon system so each icon represents the next state in the preview cycle (making the button behave as a forward indicator), and renames the standalone toggle labels from Hide Preview/Preview to Edit/Preview for clarity.

Key changes:

  • mothership-view.tsx: Initial previewMode state changed from 'split' to 'preview'; the useEffect that reset mode on resource switch now unconditionally sets 'preview' (removing the PREVIEW_ONLY_EXTENSIONS extension-based branch)
  • resource-tabs.tsx: PREVIEW_MODE_ICONS remapped so icons indicate the next state — editor→Columns3, split→Eye, preview→Pencil; Rows3 import removed and Pencil added
  • file-viewer.tsx: Default previewMode fallback changed from 'split' to 'preview' when showPreview is true
  • files.tsx: Toggle label updated to Edit/Preview and icon updated to Pencil/Eye to match the new semantic

One minor style note: the icon-lookup fallback previewMode ?? 'split' in resource-tabs.tsx is semantically stale (the new default is 'preview'), though it has no runtime impact since the button is gated behind a truthy previewMode check.

Confidence Score: 5/5

  • Safe to merge — changes are isolated to UI defaults and icon selection with no logic regressions.
  • All four changed files make small, self-contained adjustments to default state and icon mappings. The removed PREVIEW_ONLY_EXTENSIONS branch is superseded by a simpler unconditional reset. Non-previewable files are unaffected (isActivePreviewable gate still applies). The only note is a stale default fallback string that has no runtime impact.
  • No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tabs.tsx PREVIEW_MODE_ICONS remapped so each icon represents the next state in the cycle (editor→Columns3, split→Eye, preview→Pencil); Rows3 replaced by Pencil in imports. Stale default fallback previewMode ?? 'split' on line 93 is harmless because the button is only rendered when previewMode is truthy.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx Default previewMode state changed from 'split' to 'preview'; useEffect now unconditionally resets to 'preview' on active resource change, removing the PREVIEW_ONLY_EXTENSIONS extension check. PREVIEW_ONLY_EXTENSIONS import dropped correctly.
apps/sim/app/workspace/[workspaceId]/files/files.tsx Toggle button label updated from 'Hide Preview'/'Preview' to 'Edit'/'Preview'; icon changes to Pencil when in preview mode (showPreview=true) and Eye when in editor mode. Pencil is already imported via @/components/emcn.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx Default previewMode fallback changed from 'split' to 'preview' when showPreview is true. Single-line, low-risk change aligned with the PR goal.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Resource tab switch] --> B[useEffect resets previewMode to preview]
    B --> C{isActivePreviewable}
    C -- Yes --> D[Pass previewMode to ResourceContent and cycle button]
    C -- No --> E[previewMode=undefined, cycle button hidden]
    D --> F{User clicks cycle button}
    F --> G[PREVIEW_CYCLE: editor to split to preview to editor]
    G --> H[Icon shows next state]
    H --> I[editor shows Columns3]
    H --> J[split shows Eye]
    H --> K[preview shows Pencil]
    L[files.tsx standalone toggle] --> M{showPreview is true}
    M -- Yes --> N[Label Edit, Icon Pencil, fileViewer defaults to preview mode]
    M -- No --> O[Label Preview, Icon Eye, fileViewer defaults to editor mode]
Loading

Comments Outside Diff (1)

  1. apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tabs.tsx, line 93 (link)

    Stale default fallback for icon lookup

    The fallback previewMode ?? 'split' is a leftover from when the default preview mode was 'split'. Now that the initial state (and the reset value) is 'preview', the fallback is semantically stale. In practice this line is never evaluated with undefined because the cycle-button is only rendered when previewMode is truthy (line 385), so there is no runtime impact — but it can be misleading to future readers.

    Consider updating the fallback to match the new default:

Last reviewed commit: 1376bc3

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@TheodoreSpeaks TheodoreSpeaks merged commit 743742d into staging Mar 15, 2026
12 checks passed
@TheodoreSpeaks TheodoreSpeaks deleted the fix/render-md branch March 15, 2026 02:17
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.

2 participants