Skip to content

fix(md-render): fix markdown rendering in file viewer#4458

Merged
waleedlatif1 merged 4 commits intostagingfrom
fix/md-render
May 6, 2026
Merged

fix(md-render): fix markdown rendering in file viewer#4458
waleedlatif1 merged 4 commits intostagingfrom
fix/md-render

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Fix fenced code blocks rendering as inline code (missing data-block prop injection into Streamdown's pre component)
  • Fix inline code breaking to separate lines in task lists (wrap non-checkbox content in a flex-1 span)
  • Remove block-code fallback path from inlineCode handler (unclosed backticks no longer produce oversized code elements)
  • Add not-italic to all <pre> and inline <code> elements so code inside blockquotes doesn't inherit italic styling
  • Fix <th> font size to match <td> (13px vs 12px)
  • Remove copy button from code block header
  • Skip success toast when silently creating a new markdown file
  • Rename "Upload CSV" → "Import CSV" across tables UI

Type of Change

  • Bug fix

Testing

Tested manually

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)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 6, 2026 0:08am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 5, 2026

PR Summary

Medium Risk
Mostly UI behavior changes, but it adjusts markdown rendering internals and table click/selection handling (including boolean toggles and reserved width calculations), which could cause subtle regressions in editing/selection behavior.

Overview
Markdown file preview rendering is corrected and simplified. The Streamdown pre renderer now injects data-block into children so fenced code blocks render as block code, task-list items wrap non-checkbox content for proper line breaking, and all inline/block code is forced not-italic to avoid inheriting blockquote styling. The inline-code handler is simplified (removing the multiline block fallback), code block headers drop the copy button, and table header font size is aligned with cells.

Tables UI interactions and layout are refined. Boolean cells only toggle when clicking directly on the checkbox area, double-click editing is disabled for boolean cells, row selection hit targets are widened and made more keyboard-accessible, and the column config sidebar width is made responsive via a shared COLUMN_SIDEBAR_WIDTH_CSS constant with matching scroll-area reserved padding.

Minor UX tweaks. New markdown file creation suppresses the upload success toast via skipToast, and all “Upload CSV” labels are renamed to “Import CSV” across the tables UI.

Reviewed by Cursor Bugbot for commit 32d2300. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

Greptile Summary

This PR fixes a collection of markdown rendering bugs in the file viewer and refines the tables UI. All changes are isolated, targeted bug fixes with no new abstractions introduced.

  • Markdown fixes (preview-panel.tsx): Injects data-block prop via Children.map so Streamdown renders fenced code as block elements; wraps task-list non-checkbox content in a flex-1 span to prevent inline-code line breaks; adds not-italic to all <pre> and <code> elements so code inside blockquotes doesn't inherit italic; corrects <th> font size to 13 px; removes the copy button from the code-block header; removes the block-code fallback from inlineCode.
  • Boolean cell toggle (table.tsx, cell-content.tsx): Scopes the toggle to clicks physically on the checkbox element (via [data-boolean-cell-toggle]), preventing accidental toggles when clicking elsewhere in the cell; double-clicking a boolean cell now exits early instead of entering an inapplicable edit mode.
  • Sidebar width & misc (constants.ts, column-sidebar.tsx, table.tsx): Replaces the hard-coded 400 px sidebar width with a responsive min(480px, calc(100vw - 48px)) CSS expression; renames "Upload CSV" → "Import CSV" consistently across all three entry points; suppresses the upload toast when silently creating a new markdown file.

Confidence Score: 5/5

Safe to merge — all changes are isolated UI-layer bug fixes with no shared state, API, or data-model impact.

The markdown fixes are purely presentational (class names, React element cloning). The boolean-cell toggle refactor correctly narrows the click target using DOM traversal and the new data-boolean-cell-toggle anchor is placed only on the checkbox wrapper. The sidebar responsive width uses valid CSS math functions in inline styles. The skipToast flag is additive and opt-in. No regressions or correctness issues were found across any changed path.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx Multiple markdown rendering fixes: pre child injection via Children.map, simplified inlineCode handler, not-italic guards, th font-size correction, copy button removal, task-list flex layout fix.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx Boolean cell toggle now requires click target inside [data-boolean-cell-toggle]; double-click on boolean cells returns early; sidebar reserved width converted from a pixel number to a responsive CSS expression; row-selection onMouseDown lifted to <td>; SelectAllCheckbox made keyboard-accessible.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/constants.ts Adds COLUMN_SIDEBAR_WIDTH_CSS responsive CSS constant (min(480px, calc(100vw - 48px))) replacing the former hard-coded 400 px number.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/cells/cell-content.tsx Wraps the boolean-cell Checkbox in a <span data-boolean-cell-toggle> so the parent click handler can distinguish checkbox clicks from general cell clicks.
apps/sim/hooks/queries/workspace-files.ts Adds optional skipToast parameter to UploadFileParams; guards the toast.success call in onSuccess accordingly.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Table cell click\n(DataRow onClick)"] --> B{"column.type\n=== 'boolean'?"}
    B -- No --> C["Clear editing cell\n(normal path)"]
    B -- Yes --> D{"options.toggleBoolean?\n(clicked [data-boolean-cell-toggle]?)"}
    D -- No --> E["Return — no-op"]
    D -- Yes --> F{"canEditRef.current?"}
    F -- No --> E
    F -- Yes --> G["toggleBooleanCell()"]

    H["Table cell dblclick\n(handleCellDoubleClick)"] --> I{"column.type\n=== 'boolean'?"}
    I -- Yes --> J["Return early — no edit mode"]
    I -- No --> K["Enter cell edit mode\n(select text, set editingCell)"]

    subgraph "cell-content.tsx"
      L["span[data-boolean-cell-toggle]"] --> M["Checkbox\n(pointer-events-none)"]
    end
Loading

Reviews (2): Last reviewed commit: "fix(md-render): fix cloneElement type er..." | Re-trigger Greptile

…ements

- Fix TypeScript build error: type isValidElement<Record<string, unknown>> so cloneElement accepts data-block prop
- Column sidebar: use CSS min() for responsive width instead of fixed 400px
- Table: boolean cell toggle only fires when clicking the checkbox element directly (via data-boolean-cell-toggle), not anywhere on the cell
- Table: double-clicking a boolean cell no longer opens edit mode
- Table: move row-select mousedown to the <td> to widen the hit target
- Table: run/stop button prevents row-select on mousedown
- Table: SelectAllCheckbox made keyboard-accessible; checkbox is pointer-events-none
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

Fixed the CI build failure: cloneElement(child, { 'data-block': 'true' }) caused a TypeScript error because isValidElement(child) infers unknown props, and 'data-block' doesn't exist on Partial<unknown>. Fixed by typing the guard as isValidElement<Record<string, unknown>>(child).

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 32d2300. Configure here.

@waleedlatif1 waleedlatif1 merged commit bdc42a2 into staging May 6, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/md-render branch May 6, 2026 00:25
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.

1 participant