-
Notifications
You must be signed in to change notification settings - Fork 223
Open
Labels
refactorClean-up needsClean-up needs
Description
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 oneMarkdownImagecomponent - Centralize syntax highlighting config (single
vscDarkPlusimport) - 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
refactorClean-up needsClean-up needs