Skip to content

🐛 fix: markdown preview now matches GitHub rendering (#3974)#3997

Merged
clubanderson merged 1 commit intomainfrom
fix/markdown-preview-rendering
Mar 31, 2026
Merged

🐛 fix: markdown preview now matches GitHub rendering (#3974)#3997
clubanderson merged 1 commit intomainfrom
fix/markdown-preview-rendering

Conversation

@clubanderson
Copy link
Copy Markdown
Collaborator

Summary

  • Adds .ghmd CSS class that replicates GitHub's dark-mode markdown styling (headings, code blocks, tables, blockquotes, links, lists, horizontal rules)
  • Replaces non-functional prose prose-invert classes (@tailwindcss/typography is not installed, so they had no effect)
  • Fixes inline-vs-block code detection that broke for fenced code blocks without a language specifier
  • Simplifies ReactMarkdown usage by removing all custom component overrides — CSS handles everything

Test plan

  • Open Contribute > Bug Report dialog
  • Type markdown with headings, code blocks, tables, lists, blockquotes
  • Switch to Preview tab — verify rendering matches GitHub's dark mode
  • Click expand (fullscreen) — verify same styling applies
  • Compare with same markdown rendered on GitHub

Closes #3974

Replace non-functional prose classes (no @tailwindcss/typography installed)
with a purpose-built .ghmd CSS class that replicates GitHub's dark-mode
markdown styling. Covers headings with bottom borders, inline code with
gray background, fenced code blocks, blockquotes, tables with alternating
row colors, links, lists, and horizontal rules.

Simplify ReactMarkdown usage by removing broken custom component overrides
— the CSS handles all styling correctly, including the inline-vs-block
code distinction that the old JS logic got wrong for language-free code
blocks.

Closes #3974

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Copilot AI review requested due to automatic review settings March 31, 2026 14:32
@kubestellar-prow kubestellar-prow bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Mar 31, 2026
@kubestellar-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 31, 2026

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 21974a9
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/69cbdaf8938ccc0008438e92
😎 Deploy Preview https://deploy-preview-3997.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubestellar-prow kubestellar-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 31, 2026
@clubanderson clubanderson merged commit 654141d into main Mar 31, 2026
18 of 20 checks passed
@kubestellar-prow kubestellar-prow bot deleted the fix/markdown-preview-rendering branch March 31, 2026 14:32
@github-actions
Copy link
Copy Markdown
Contributor

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Contribute → Bug Report markdown preview to render closer to GitHub Flavored Markdown by moving presentation concerns out of ReactMarkdown component overrides and into a dedicated CSS class.

Changes:

  • Added a .ghmd CSS class to style markdown elements (headings, code blocks, tables, blockquotes, etc.) to resemble GitHub’s dark-mode rendering.
  • Updated FeatureRequestModal to apply .ghmd and removed custom ReactMarkdown component overrides, relying on CSS for formatting.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
web/src/index.css Adds .ghmd markdown styling rules intended to mimic GitHub dark-mode markdown presentation.
web/src/components/feedback/FeatureRequestModal.tsx Switches markdown preview containers to use .ghmd and simplifies ReactMarkdown usage by removing custom renderers.

Comment on lines +1731 to +1735
/* GitHub-flavored markdown preview (dark mode) */
.ghmd {
color: #e6edf3;
font-size: 14px;
line-height: 1.6;
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

.ghmd hard-codes GitHub dark-mode colors (e.g., color: #e6edf3) without scoping to .dark or providing a .light variant. Since the app supports a .light theme (CSS variables in this file), this will likely produce very low-contrast text on light backgrounds in the markdown preview. Consider either scoping these rules under .dark .ghmd and adding .light .ghmd styles (GitHub light palette), or rewriting .ghmd to use the app’s theme CSS variables so contrast remains accessible in both themes.

Copilot uses AI. Check for mistakes.
Comment on lines +1388 to 1392
<div className="w-full h-[200px] overflow-y-auto px-3 py-2 bg-secondary/50 border border-border rounded-lg ghmd">
{description.trim() ? (
<ReactMarkdown
remarkPlugins={[remarkGfm, remarkBreaks]}
components={{
code({ className, children, ...props }) {
const match = /language-(\w+)/.exec(className || '')
const isInline = !match && !className
return isInline ? (
<code className="bg-black/20 px-1 rounded text-purple-300" {...props}>{children}</code>
) : (
<pre className="bg-black/30 rounded-lg p-3 overflow-x-auto my-2">
<code className={className} {...props}>{children}</code>
</pre>
)
},
table: ({ children }) => (
<div className="overflow-x-auto w-full my-3 rounded border border-border">
<table className="min-w-full border-collapse text-sm">{children}</table>
</div>
),
thead: ({ children }) => <thead className="bg-secondary/50">{children}</thead>,
th: ({ children }) => <th className="px-3 py-2 text-left text-xs font-semibold border-b border-border">{children}</th>,
td: ({ children }) => <td className="px-3 py-2 text-xs border-b border-border/50">{children}</td>,
blockquote: ({ children }) => <blockquote className="border-l-4 border-purple-500/50 pl-3 my-3 text-muted-foreground italic">{children}</blockquote>,
}}
>
<ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
{description}
</ReactMarkdown>
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

Markdown preview rendering/styling changed substantially (custom renderers removed, new .ghmd class introduced), but the existing unit test only checks that the component exports. Add tests that render the modal preview and assert key GFM elements (e.g., fenced code blocks without a language, tables, blockquotes) produce the expected DOM structure/classes so regressions are caught.

Copilot generated this review using guidance from repository custom instructions.
@clubanderson
Copy link
Copy Markdown
Collaborator Author

🔄 Auto-Applying Copilot Code Review

Copilot code review found 0 code suggestion(s) and 2 general comment(s).

Also address these general comments:

  • web/src/index.css (line 1735): .ghmd hard-codes GitHub dark-mode colors (e.g., color: #e6edf3) without scoping to .dark or providing a .light v
  • web/src/components/feedback/FeatureRequestModal.tsx (line 1392): Markdown preview rendering/styling changed substantially (custom renderers removed, new .ghmd class introduced), but t

Push all fixes in a single commit. Run cd web && npm run build && npm run lint before committing.


Auto-generated by copilot-review-apply workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preview Renderer Does Not Match GitHub Markdown Rendering

3 participants