Skip to content

Unified Markdown Renderer #315

@pedramamini

Description

@pedramamini

Problem

16 separate Markdown rendering locations across the app. 12 use ReactMarkdown directly instead of the existing MarkdownRenderer component. 8+ unique component override sets are defined inline. 3 separate image loading implementations. 7+ files independently import vscDarkPlus syntax highlighting theme.

A centralized markdownConfig.ts and MarkdownRenderer.tsx exist but are underused.

Key Offenders

Component Issue
ConversationScreen.tsx + WizardMessageBubble.tsx 95% identical component overrides defined inline
StreamingDocumentPreview.tsx Generates its own prose CSS inline
UpdateCheckModal.tsx Completely independent ReactMarkdown with inline overrides
MobileMarkdownRenderer.tsx Full custom override set, no shared code
DocumentGenerationView.tsx Embedded DocumentEditor copy with duplicate prose generation
AutoRun.tsx, FilePreview.tsx Partially use shared config but define custom image/code components

Plugin Usage Inconsistencies

Component remarkGfm rehypeRaw rehypeSlug remarkFrontmatter remarkFileLinks
MarkdownRenderer Optional
FilePreview
AutoRun
UpdateCheckModal
ConversationScreen
WizardMessageBubble
MobileMarkdownRenderer

Proposed Solution

Extend MarkdownRenderer.tsx to accept variant/preset props:

<MarkdownRenderer
  variant="terminal" | "chat-bubble" | "document-editor" | "mobile" | "release-notes" | "marketplace"
  theme={theme}
  content={markdown}
/>

Each variant selects from pre-configured plugin/override/style sets. All 16 locations use this single component.

Additionally:

  • Consolidate 3 image loading implementations (LocalImage, AttachmentImage, MarkdownImage) into one MarkdownImage component
  • Centralize syntax highlighting config (single vscDarkPlus import)
  • Remove all inline component override definitions

Estimated Impact

  • ~1,500-2,000 lines of duplicate code eliminated
  • 16 files touched
  • Consistent markdown rendering across the entire app
  • Bug fixes and style changes apply everywhere at once

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions