feat: render markdown files as rendered markdown in view mode#5371
feat: render markdown files as rendered markdown in view mode#5371AleksandarCole wants to merge 6 commits into
Conversation
Extract the canvas console markdown renderer into a shared MarkdownContent component and use it in the file viewer so markdown files (.md, .mdx, .markdown) render as proper markdown when the editor is read-only, instead of being shown as raw text in Monaco. Monaco is still used for edit mode and for every non-markdown file. Signed-off-by: Aleksandar Mitrovic <alex@superplane.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
👋 Commands for maintainers:
|
Don't export MARKDOWN_CONTENT_CLASSES / MARKDOWN_SANITIZE_SCHEMA from Markdown.tsx so the file only exports a component, satisfying the react-refresh/only-export-components ESLint rule. The constants have no external consumers. Signed-off-by: Aleksandar Mitrovic <alex@superplane.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Don't trim() before passing markdown to react-markdown; otherwise a file that starts with an indented code block (4-space indent) would lose the indentation and render as a paragraph. The empty-content guard still ignores whitespace-only content. Signed-off-by: Aleksandar Mitrovic <alex@superplane.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Docs Impact ReviewThe Files page should be updated to mention that Markdown files are displayed as rendered markdown in view mode. Suggested docs updates:
Why: Maintainers: Reply with Posted automatically by warp-gateway · commit a9cb5ae |
|
/docs-reject |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cc50b31. Configure here.
Restore the historical leading/trailing whitespace trim for console markdown panels by trimming the interpolated body in MarkdownBody before delegating to MarkdownContent. MarkdownContent itself stays byte-faithful so the file viewer keeps rendering files exactly as they are on disk. Signed-off-by: Aleksandar Mitrovic <alex@superplane.com> Co-authored-by: Cursor <cursoragent@cursor.com>

Summary
.md,.mdx,.markdown) are now rendered as proper markdown in the file viewer when the editor is read-only. Monaco is still used when the file is being edited and for every non-markdown file.MarkdownContentcomponent (web_src/src/pages/app/Markdown.tsx) so the file viewer and the canvas console panels share one styling source (tables,<details>/<summary>, sanitization, etc).MarkdownBody(console panels) to only do{{ vars }}interpolation and delegate rendering toMarkdownContent, eliminating the duplicatedMARKDOWN_CLASSES+ sanitize schema.Test plan
.mdfile in the canvas Files overlay without entering edit mode and confirm it renders as styled markdown (headings, lists, links, code blocks, tables,<details>)..go,.yaml) and confirm Monaco continues to be used in both view and edit modes.