Add rendered markdown preview toggle to the file diff panel#166
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In the session file-changes panel (right side panel), markdown files now get an eye toggle in the detail header that switches between the raw diff and a rendered markdown preview of the file.
How
Backend —
compute_file_diffnow attaches two fields to the diff response for.md/.markdownfiles (case-insensitive):markdown_content: the post-change file content; falls back to the original content for deleted files so the preview can still show what was removed.nullfor non-markdown files.markdown_truncated:truewhen the content was cut atMAX_DIFF_LINES(mirrors the patch truncation to keep payloads bounded).Frontend —
FileDetailViewshows anEyetoggle (same pattern as the line-wrap toggle) only whenmarkdown_contentis present. Preview mode renders through the existingMarkdownContentcomponent (GFM tables, syntax-highlighted code blocks). The toggle resets to diff view when switching files, and a truncation notice is shown when the preview was cut.Old-backend / new-frontend degrades gracefully: no field → no toggle, diff panel unchanged.
Testing
tests/test_diff.py(md content present, case-insensitive suffix, deleted-file fallback, non-md null, truncation) — full suite 1370 passednpm run buildclean