Follow mid-edit renames in the preview renderer
What does this MR do and why?
Resolves "Preview" tab does not follow mid-edit file ren... (#616115 - closed), focusing on the preview renderer.
Pick the renderer from the file name currently in the editor, rather than the name of the committed blob.
Scope
Making the "Preview" tab's mode selection (the Markdown live preview or the rendered preview pane) follow renames is covered in Follow mid-edit renames to Markdown in the "Pre... (!250889 - merged).
Backward compatibility
When file_path is missing or blank, the renderer falls back to blob.name as before,
so requests from older frontends keep working during a rolling deploy.
Screen recordings
Manually verified in GDK-in-a-box:
| Switches the markup (→ another markup) | Switches to a diff (→ non-markup) |
|---|---|
How to set up and validate locally
- In a repository, create a file named
foo.rstwith some reStructuredText content and commit it - Open
foo.rstin the single file editor and replace the content with some Org-mode content (e.g.* Title) - Rename the file to
foo.org - Click the "Preview" tab
- Verify that the preview renders the content as Org-mode, not as reStructuredText
(e.g.
* Titlebecomes a heading, not a bullet list)
Notes
- Backend engineer, but fairly new to Rails – feedback on Rails conventions welcome.
- I don't work on the frontend regularly — a careful look at this approach would be very helpful.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.