Files
supabase/packages/config/typography.config.js
Danny White d1e7c403ac fix(ui): align Admonition titles and docs link hover with prose (#48428)
## What kind of change does this PR introduce?

UI bug fix.

## What is the current behavior?

After the recent Admonition a11y refactor:

- Titled Admonitions in MDX (blog and docs) could pick up large prose
top margin on the title, or (after follow-ups) end up with a title much
smaller than the body because the title was a `div` at `text-sm` while
body `<p>`s took prose ~15px
- Docs MDX links (including inside Admonitions) had a weak hover: prose
only shifted underline colour

Prior issues:

- A couple of guide callouts bolded link text via `[**…**](…)`
- Some funky Admonition formatting as called out in comments below

## What is the new behavior?

- `AlertTitle` is a `<p>` with `!mt-0 mb-0.5 font-medium` (not an `h5` /
bare `div`), so it does not break heading hierarchy and matches
admonition body font-size under prose
- Admonition uses `AlertTitle` again (though with `<p>` as explained
above) and wraps MDX `children` in `AlertDescription` (same as
`description`)
- `Alert` / `AlertTitle` / `AlertDescription` get `data-slot`
attributes; description keeps string→`<p>` wrapping, Studio density,
plus `text-balance`
- Docs link hover: typography `a:hover` and `MdxAnchor` now move text +
decoration toward foreground (InlineLink-like), without stealing brand
link colour via `text-inherit`
- Content: remove accidental bold on oauth-scopes and
multi-factor-authentication guide links

| Before | After |
| --- | --- |
| <img width="1360" height="378" alt="CleanShot 2026-07-29 at 16 44
48@2x"
src="https://github.com/user-attachments/assets/1aa98cb4-e691-428e-b7e2-a78afcdf518d"
/> | <img width="1350" height="362" alt="CleanShot 2026-07-29 at 16 44
08@2x"
src="https://github.com/user-attachments/assets/63c9c7df-c1c7-49c4-8fdb-0411ae251a71"
/> |
| <img width="1518" height="448" alt="CleanShot 2026-07-29 at 16 46
18@2x"
src="https://github.com/user-attachments/assets/d618e138-fcd7-4a44-b16d-cb0ac5ba6b0e"
/> | <img width="1524" height="424" alt="CleanShot 2026-07-29 at 16 46
30@2x"
src="https://github.com/user-attachments/assets/dbc7710e-42c6-483c-b367-19b2ff3a6475"
/> |
| <img width="1524" height="598" alt="CleanShot 2026-07-29 at 16 47
15@2x"
src="https://github.com/user-attachments/assets/c9c07f37-4e2b-40fa-bc90-c86a17e5ea32"
/> | <img width="1530" height="584" alt="CleanShot 2026-07-29 at 16 47
39@2x"
src="https://github.com/user-attachments/assets/806735f0-fa44-42e6-bd5a-127899d0bfc2"
/> |

## To test

**Docs**

1. [Functions
quickstart](https://docs-git-fix-admonition-alert-title-prose-supabase.vercel.app/docs/guides/functions/quickstart):
titled tip near the top. Title and body should be the same size, no
giant gap above the title
2. [BYO
MCP](https://docs-git-fix-admonition-alert-title-prose-supabase.vercel.app/docs/guides/ai-tools/byo-mcp):
tip with links. Hover a link (text + underline should both go
foreground)
3. [OAuth
scopes](https://docs-git-fix-admonition-alert-title-prose-supabase.vercel.app/docs/guides/integrations/build-a-supabase-oauth-integration/oauth-scopes):
note link is not bold
4. [Multi-factor
authentication](https://docs-git-fix-admonition-alert-title-prose-supabase.vercel.app/docs/guides/platform/multi-factor-authentication):
same, note link not bold

**Blog**

5. [CLI v2 config as
code](https://zone-www-dot-com-git-fix-admonition-alert-title-prose-supabase.vercel.app/blog/cli-v2-config-as-code):
titled Admonitions. Title size matches body, no huge top margin

**Other**

6. [Design system:
Admonition](https://design-system-git-fix-admonition-alert-title-prose-supabase.vercel.app/design-system/docs/fragments/admonition):
component reference
7. Studio (e.g. project Edge Functions secrets): Admonitions should stay
compact `text-sm` outside prose. Preview:
[studio-staging](https://studio-staging-git-fix-admonition-alert-title-prose-supabase.vercel.app)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

* **New Features**
  * None

* **Style**
* Improved link decoration consistency (underline/hover) across internal
and external documentation content, with safer external link handling.

* **Bug Fixes**
* Refined alert/admonition rendering for clearer title/description
semantics and better spacing/text wrapping.
* Updated documentation image rendering to avoid forwarding
whitespace-only children and adjusted chart image layout.

* **Tests**
  * Expanded assertions for alert/admonition structure and styling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-31 12:23:16 +10:00

235 lines
9.2 KiB
JavaScript

/**
* Typography customization for @tailwindcss/typography.
*
* Loaded via `@config './typography.config.js'` in tailwind.config.css.
* Only contains theme.extend.typography — everything else (colors, animations,
* variants, utilities, base) lives in CSS under packages/config/css/.
*
* The typography plugin reads theme.typography to generate .prose, .prose-toc,
* and .prose-docs classes (and to make them @apply-able). See:
* https://github.com/tailwindlabs/tailwindcss-typography#customizing-the-css
*/
module.exports = {
theme: {
extend: {
typography: {
DEFAULT: {
css: {
// Removal of backticks in code blocks.
// https://github.com/tailwindlabs/tailwindcss-typography/issues/135
'code::before': { content: '""' },
'code::after': { content: '""' },
'--tw-prose-body': 'var(--foreground-light)',
'--tw-prose-headings': 'var(--foreground-default)',
'--tw-prose-lead': 'var(--foreground-light)',
'--tw-prose-links': 'var(--foreground-light)',
'--tw-prose-bold': 'var(--foreground-light)',
'--tw-prose-counters': 'var(--foreground-light)',
'--tw-prose-bullets': 'var(--foreground-muted)',
'--tw-prose-hr': 'var(--background-surface-300)',
'--tw-prose-quotes': 'var(--foreground-light)',
'--tw-prose-quote-borders': 'var(--background-surface-300)',
'--tw-prose-captions': 'var(--border-strong)',
'--tw-prose-code': 'var(--foreground-default)',
'--tw-prose-pre-code': 'var(--foreground-muted)',
'--tw-prose-pre-bg': 'var(--background-surface-200)',
'--tw-prose-th-borders': 'var(--background-surface-300)',
'--tw-prose-td-borders': 'var(--background-default)',
'--tw-prose-invert-body': 'var(--background-default)',
'--tw-prose-invert-headings': 'white',
'--tw-prose-invert-lead': 'var(--background-surface-300)',
'--tw-prose-invert-links': 'white',
'--tw-prose-invert-bold': 'white',
'--tw-prose-invert-counters': 'var(--background-surface-200)',
'--tw-prose-invert-bullets': 'var(--background-selection)',
'--tw-prose-invert-hr': 'var(--border-strong)',
'--tw-prose-invert-quotes': 'var(--background-alternative-default)',
'--tw-prose-invert-quote-borders': 'var(--border-strong)',
'--tw-prose-invert-captions': 'var(--background-surface-200)',
h4: { fontSize: '1.15em' },
// h5 isn't included in --tw-prose-headings.
h5: { color: 'var(--color-scale-1200)' },
'h1, h2, h3, h4, h5, h6': { fontWeight: '400' },
'article h2, article h3, article h4, article h5, article h6': {
marginTop: '2em',
marginBottom: '1em',
},
p: { fontWeight: '400' },
strong: { fontWeight: '500' },
pre: {
background: 'none',
padding: 0,
marginBottom: '32px',
},
ul: {
listStyleType: 'none',
paddingLeft: '1rem',
},
'ul li': { position: 'relative' },
'ul li::before': {
position: 'absolute',
top: '0.75rem',
left: '-1rem',
height: '0.125rem',
width: '0.5rem',
borderRadius: '0.25rem',
backgroundColor: 'var(--border-strong)',
content: '""',
},
ol: {
paddingLeft: '1rem',
counterReset: 'item',
listStyleType: 'none',
marginBottom: '3rem',
},
'ol>li': {
display: 'block',
position: 'relative',
paddingLeft: '1rem',
},
'ol>li::before': {
position: 'absolute',
top: '0.25rem',
left: '-1rem',
height: '1.2rem',
width: '1.2rem',
borderRadius: '0.25rem',
backgroundColor: 'var(--background-surface-100)',
border: '1px solid var(--border-default)',
content: 'counter(item) " "',
counterIncrement: 'item',
fontSize: '12px',
color: 'var(--foreground-muted)',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
},
'p img': {
border: '1px solid var(--border-muted)',
borderRadius: '4px',
overflow: 'hidden',
},
iframe: {
border: '1px solid var(--border-default)',
borderRadius: 'var(--radius-lg)',
},
td: {
borderBottom: '1px solid var(--background-surface-200)',
},
code: {
fontWeight: '400',
padding: '0.2rem 0.4rem',
backgroundColor: 'var(--background-surface-200)',
border: '1px solid var(--background-surface-300)',
borderRadius: 'var(--radius-lg)',
},
a: {
position: 'relative',
transition: 'all 0.18s ease',
paddingBottom: '2px',
fontWeight: '400',
opacity: 1,
// Match Studio InlineLink: inherit body color, foreground on hover
color: 'inherit',
textDecorationLine: 'underline',
textDecorationColor: 'inherit',
textDecorationThickness: '1px',
textUnderlineOffset: '2px',
},
'a:hover': {
color: 'var(--foreground-default)',
textDecorationColor: 'var(--foreground-default)',
},
figcaption: {
color: 'var(--foreground-muted)',
fontFamily: 'Office Code Pro, monospace',
},
'figure.quote-figure p:first-child': {
marginTop: '0 !important',
},
'figure.quote-figure p:last-child': {
marginBottom: '0 !important',
},
figure: { margin: '3rem 0' },
'figure img': { margin: '0 !important' },
},
},
toc: {
css: {
ul: {
'list-style-type': 'none',
'padding-left': 0,
margin: 0,
li: { 'padding-left': 0 },
a: {
display: 'block',
marginBottom: '0.4rem',
'text-decoration': 'none',
fontSize: '0.8rem',
fontWeight: '200',
color: 'var(--foreground-light)',
'&:hover': {
color: 'var(--foreground-default)',
},
'font-weight': '400',
},
ul: {
'list-style-type': 'none',
li: {
marginTop: '0.2rem',
marginBottom: '0.2rem',
'padding-left': '0 !important',
'margin-left': '0.5rem',
},
a: {
fontWeight: '200',
color: 'var(--foreground-lighter)',
'&:hover': {
color: 'var(--foreground-default)',
},
},
},
},
},
},
// Used in docs and changelog content.
docs: {
css: {
'--tw-prose-body': 'var(--foreground-light)',
'--tw-prose-headings': 'var(--foreground-default)',
'--tw-prose-lead': 'var(--foreground-light)',
'--tw-prose-links': 'inherit',
'--tw-prose-bold': 'var(--foreground-light)',
'--tw-prose-counters': 'var(--foreground-light)',
'--tw-prose-bullets': 'var(--foreground-muted)',
'--tw-prose-hr': 'var(--background-surface-300)',
'--tw-prose-quotes': 'var(--foreground-light)',
'--tw-prose-quote-borders': 'var(--background-surface-300)',
'--tw-prose-captions': 'var(--border-strong)',
'--tw-prose-code': 'var(--foreground-default)',
'--tw-prose-pre-code': 'var(--foreground-muted)',
'--tw-prose-pre-bg': 'var(--background-surface-200)',
'--tw-prose-th-borders': 'var(--background-surface-300)',
'--tw-prose-td-borders': 'var(--background-default)',
'--tw-prose-invert-body': 'var(--background-default)',
'--tw-prose-invert-headings': 'white',
'--tw-prose-invert-lead': 'var(--background-surface-300)',
'--tw-prose-invert-links': 'white',
'--tw-prose-invert-bold': 'white',
'--tw-prose-invert-counters': 'var(--background-surface-200)',
'--tw-prose-invert-bullets': 'var(--background-selection)',
'--tw-prose-invert-hr': 'var(--border-strong)',
'--tw-prose-invert-quotes': 'var(--background-alternative-default)',
'--tw-prose-invert-quote-borders': 'var(--border-strong)',
'--tw-prose-invert-captions': 'var(--background-surface-200)',
'h1, h2, h3, h4, h5': { fontWeight: '400' },
},
},
},
},
},
}