Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 14, 2025

Problem

Markdown formatting was broken in the comments section due to CSS class conflicts. The fontSize="small" prop on MarkdownRenderer was applying text-sm directly to <p> and <span> elements, which interfered with the prose typography system, causing markdown elements like bold, italic, code, links, and lists to lose their formatting.

Solution

This fix addresses the root cause by:

  1. Removing conflicting CSS overrides: Eliminated individual text-sm classes applied directly to <p> and <span> elements within the MarkdownRenderer
  2. Creating proper prose variant: Added a prose-sm CSS class that works harmoniously with the existing prose system
  3. Using container-level styling: Applied the prose-sm class to the wrapper container instead of individual elements

Technical Changes

app/components/ui/markdown-renderer/index.tsx:

  • Removed text-sm class from paragraph (p) element overrides
  • Removed text-sm class from span element overrides
  • Updated wrapper to use prose-sm class for small font size variant
  • Cleaned up unused fontSize parameter from generateClassOverrides function

app/typography.css:

  • Added prose-sm CSS class with proper font-size and line-height for comments

Test Results

The fix ensures all markdown elements render correctly in comment sections:

Markdown Fix Demo - Light Mode

Markdown Fix Demo - Dark Mode

Bold text renders correctly
Italic text renders correctly
Inline code renders correctly
✅ Lists render correctly
✅ Links render correctly
✅ Blockquotes render correctly
✅ Code blocks render correctly
✅ Proper font sizing (smaller for comments)
✅ Dark mode compatibility

Impact

Comments now display properly formatted markdown while maintaining the smaller text size appropriate for comment sections. This resolves the formatting issues where markdown syntax was visible instead of being rendered.

Before: Markdown formatting broken due to CSS conflicts
After: All markdown elements render correctly with proper small text sizing

Fixes #285.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

- Remove conflicting text-sm overrides on p and span elements
- Add prose-sm variant for proper small text sizing
- Use prose-sm container class instead of element-level overrides
- Remove unused fontSize parameter from generateClassOverrides
Copilot AI changed the title [WIP] Bug - Formatação markdown dos comentários. Fix markdown formatting in comment sections Jul 14, 2025
Copilot AI requested a review from robertotcestari July 14, 2025 11:50
Copilot finished work on behalf of robertotcestari July 14, 2025 11:51
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.

Bug - Formatação markdown dos comentários.

2 participants