Skip to content

fix(markdown): render file previews statically#913

Open
PeppaPigw wants to merge 3 commits into
crynta:mainfrom
PeppaPigw:fix/markdown-static-preview
Open

fix(markdown): render file previews statically#913
PeppaPigw wants to merge 3 commits into
crynta:mainfrom
PeppaPigw:fix/markdown-static-preview

Conversation

@PeppaPigw

@PeppaPigw PeppaPigw commented Jul 1, 2026

Copy link
Copy Markdown

What

Render file-backed Markdown previews in static mode instead of Streamdown's streaming/incomplete-repair path. Add a regression test to lock the preview configuration.

Why

Opening a 7,646-line Markdown note made the entire app sluggish after the preview loaded, not just the preview pane. The preview path was treating a complete file like streaming AI output, doing extra incomplete-markdown repair work and leaving an expensive rendered tab mounted.

Local benchmark on the same Markdown content:

Path Wall time CPU time
Streaming repair path 3,295 ms 4,083 ms
Static file-preview path 476 ms 801 ms

The reduced CPU/main-thread rendering work matches the manual result: after the fix, opening the large Markdown file no longer makes the rest of the app feel stuck.

How

Only the rendered Markdown file preview path changed: MarkdownPreviewPane now passes mode="static" and parseIncompleteMarkdown={false} to Streamdown. AI chat rendering still uses the existing streaming behavior.

Testing

  • pnpm test src/modules/markdown/MarkdownPreviewPane.test.ts
  • pnpm check-types
  • pnpm exec biome lint src/modules/markdown/MarkdownPreviewPane.tsx src/modules/markdown/MarkdownPreviewPane.test.ts
  • Manual smoke-test affected feature in pnpm tauri dev
  • Platforms tested: local dev on Linux workspace

Notes reviewer

This is intentionally narrow: only the rendered Markdown file preview changed. AGENTS.generated.md was left untracked and not committed.

@PeppaPigw PeppaPigw requested a review from crynta as a code owner July 1, 2026 07:16
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Two new props, mode="static" and parseIncompleteMarkdown={false}, were added to the Streamdown component in MarkdownPreviewPane.tsx, altering its markdown parsing/rendering behavior. A new test file was added to verify these configuration values via source extraction.

Changes

Markdown Preview Rendering Configuration

Layer / File(s) Summary
Streamdown static mode props and test
src/modules/markdown/MarkdownPreviewPane.tsx, src/modules/markdown/MarkdownPreviewPane.test.ts
Streamdown now renders with mode="static" and parseIncompleteMarkdown={false}; a new test reads the component source and asserts these two prop values are present.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Related PRs: None identified.

Suggested labels: markdown, tests

Suggested reviewers: None identified.

No secret sauce needed here — flipping Streamdown to static mode and turning off incomplete-markdown repair is a two-line change, and the test cleverly regex-scrapes the source to keep it honest. Bundle size, RAM, and terminal-first ethos: unaffected. My only nudge — the regex-based test is a bit brittle to formatting changes in the JSX, but for a two-prop guardrail, it's fine. Ship it.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits and accurately summarizes the main change to static Markdown file previews.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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