Skip to content

feat: render markdown files as rendered markdown in view mode#5371

Open
AleksandarCole wants to merge 6 commits into
mainfrom
cursor/render-markdown-file-view
Open

feat: render markdown files as rendered markdown in view mode#5371
AleksandarCole wants to merge 6 commits into
mainfrom
cursor/render-markdown-file-view

Conversation

@AleksandarCole

Copy link
Copy Markdown
Collaborator

Summary

  • Markdown files (.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.
  • Extracted the canvas console markdown renderer into a new shared MarkdownContent component (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).
  • Refactored MarkdownBody (console panels) to only do {{ vars }} interpolation and delegate rendering to MarkdownContent, eliminating the duplicated MARKDOWN_CLASSES + sanitize schema.

Test plan

  • Open a .md file in the canvas Files overlay without entering edit mode and confirm it renders as styled markdown (headings, lists, links, code blocks, tables, <details>).
  • Enter edit mode and confirm the same file opens in Monaco for editing.
  • Open a non-markdown file (e.g. .go, .yaml) and confirm Monaco continues to be used in both view and edit modes.
  • Open a canvas markdown panel and confirm rendering is visually unchanged.

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>
@superplanehq-integration

Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

@AleksandarCole AleksandarCole marked this pull request as ready for review June 12, 2026 11:37
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>
Comment thread web_src/src/pages/app/Markdown.tsx Outdated
AleksandarCole and others added 2 commits June 12, 2026 06:17
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>
@superplane-gh-integration-9000

Copy link
Copy Markdown

Docs Impact Review

The Files page should be updated to mention that Markdown files are displayed as rendered markdown in view mode.

Suggested docs updates:

  • docs.superplane.com/concepts/files — In the Files tab section, add a note that .md files are rendered as formatted markdown (headings, tables, code blocks, etc.) when viewed, rather than shown as raw text.

Why: FileEditor.tsx now detects when a file has a .md extension and, in view/read-only mode, renders the content through the markdown pipeline instead of the Monaco editor. This is a visible, file-type-specific behavior change in the Files tab — users with markdown files in their app repository will see a fundamentally different output (rendered HTML vs. raw source), which is worth calling out in the docs rather than leaving to discovery.


Maintainers: Reply with /docs-agree to open a tracking issue in superplanehq/docs (and assign it to you), or /docs-reject to dismiss this check.

Posted automatically by warp-gateway · commit a9cb5ae

@AleksandarCole

Copy link
Copy Markdown
Collaborator Author

/docs-reject

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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

Comment thread web_src/src/pages/app/console/MarkdownBody.tsx
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>
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