Files
supabase/apps/www/components/Contribute/markdownComponents.tsx
Danny White 7e44d321b3 feat(www): adopt shared inline code defaults (#51983)
## Problem

WWW has duplicate inline-code styles. Changelog code stays at a fixed
size even when the surrounding text is larger.

## Solution

Import the shared styles from #51980 and remove duplicate Markdown
styling. Code uses the default foreground colour and follows the
surrounding weight, and scales from 12.5px beside 14px text to 14px
beside 16px text, with a `0.75rem` minimum (normally 12px). Region
labels keep their own styles.

## Review instructions

1. Open the [branch configuration blog
post](https://zone-www-dot-com-git-dnywh-depr-707-code-www-supabase.vercel.app/blog/how-a-new-branch-gets-its-config-migrations-and-functions).
The filename “`config.toml`” should be 14px beside 16px prose.
2. Open the
[changelog](https://zone-www-dot-com-git-dnywh-depr-707-code-www-supabase.vercel.app/changelog).
Check code in headings, paragraphs and tables at narrow and desktop
widths, in both themes.
3. Check that code blocks and region labels keep their existing
appearance.

| Before | After |
| --- | --- |
| <img width="1306" height="494" alt="CleanShot 2026-10-19 at 14 34
58@2x"
src="https://github.com/user-attachments/assets/349f5eb5-7a4a-44ae-ba3a-ae75f083dea2"
/> | <img width="1244" height="448" alt="CleanShot 2026-10-19 at 14 35
33@2x"
src="https://github.com/user-attachments/assets/61753f8a-f6e3-4482-b19a-ac9d39609545"
/> |
| <img width="1308" height="246" alt="CleanShot 2026-10-20 at 15 59
46@2x"
src="https://github.com/user-attachments/assets/db7cca69-7009-44d1-bae3-a5424e367e36"
/> | <img width="1312" height="266" alt="CleanShot 2026-10-20 at 15 58
58@2x"
src="https://github.com/user-attachments/assets/720c6370-5ce2-4be3-8346-0852f7803c26"
/> |
2026-10-22 00:48:57 +00:00

28 lines
924 B
TypeScript

import type { Components } from 'react-markdown'
export const markdownComponents: Components = {
code: ({ className, ...props }) =>
className ? (
<code {...props} className="font-mono text-sm whitespace-pre block min-w-0" />
) : (
<code {...props} />
),
pre: ({ node, ...props }) => (
<pre
{...props}
className="bg-surface-200 text-foreground p-4 rounded-lg mb-3 w-full min-w-0 overflow-x-auto font-mono text-sm whitespace-pre"
/>
),
a: ({ node, ...props }) => (
<a
{...props}
className="text-primary hover:underline break-all"
target="_blank"
rel="noopener noreferrer"
/>
),
p: ({ node, ...props }) => <p {...props} className="mb-3 last:mb-0" />,
ul: ({ node, ...props }) => <ul {...props} className="list-disc pl-5 space-y-1 mb-3" />,
ol: ({ node, ...props }) => <ol {...props} className="list-decimal pl-5 space-y-1 mb-3" />,
}