Skip to content

Commit 39ca479

Browse files
odgrimclaude
andauthored
Fix #177 GFM table rendering and WCAG AA contrast failures in docs (#191)
* fix: restore GFM table rendering in .mdx docs Astro 6.4.x regression (withastro/astro#16971) drops the markdown.gfm default for .mdx files specifically, so every table in the block docs (e.g. GitAuth's Providers table) silently rendered as raw pipe text instead of an HTML table. Set gfm: true explicitly to work around it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: resolve WCAG AA color-contrast failures across docs theme Audited every page in both light and dark themes with axe-core; these were the failures found, all fixed in place with colors already in the palette where possible: - --sl-color-gray-3 (dark) was 3.66:1 against the page background, failing normal-text AA. It backs Starlight's footer/edit-link text plus our TOC and homepage muted text, so this was the widest-reaching fix. Lightened to hit 4.5:1+ against both the page bg and gray-7. - .source-link (dark) used the border-tuned gray-4 for text (2.29:1); switched to gray-3. - The hero "Get Started" button's white text on the dark accent blue was 3.68:1; scoped a darker blue to that button only so the shared accent variable (fine everywhere else) doesn't need to change. - A prior gray-6 (dark) tweak aimed at "better backgrounds" had lightened the Expressive Code editor background enough to drop the built-in syntax theme's comment/keyword/string colors below AA. Reverted to the original value, close to the theme's own reference background. - Links inside colored callout boxes (tip/caution/danger asides) didn't have enough contrast against every variant's tint, in both themes. Added a scoped override. - Inline <code> inside links was 4.38:1 in light mode, just under the 4.5:1 threshold; switched to the darker accent-high tone. - Footer.astro: the decorative "·" separator used a border-tuned color; matched it to the surrounding footer text color instead. Verified with axe-core (WCAG 2 AA) against all 41 docs pages in both themes: 0 remaining color-contrast violations. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 16372cb commit 39ca479

3 files changed

Lines changed: 49 additions & 5 deletions

File tree

docs/astro.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ import starlight from '@astrojs/starlight';
55
// https://astro.build/config
66
export default defineConfig({
77
site: 'https://runbooks.gruntwork.io',
8+
// Astro 6.4.x regression (withastro/astro#16971): markdown.gfm no longer
9+
// defaults to true for .mdx files, so GFM tables silently stop rendering
10+
// (they fall back through as raw pipe text instead of <table>). Must be
11+
// set explicitly at this top level — setting it via a remark/unified
12+
// option does not work around the regression.
13+
markdown: {
14+
gfm: true,
15+
},
816
integrations: [
917
starlight({
1018
title: 'Gruntwork Runbooks',

docs/src/components/Footer.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import Default from '@astrojs/starlight/components/Footer.astro';
5252
}
5353

5454
.gruntwork-footer-separator {
55-
color: var(--sl-color-gray-5);
55+
color: var(--sl-color-gray-3);
5656
}
5757

5858
.gruntwork-footer-link {

docs/src/styles/custom.css

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,15 @@ html {
6464
--sl-color-white: #fafafa;
6565
--sl-color-gray-1: #e4e4e7;
6666
--sl-color-gray-2: #a1a1aa;
67-
--sl-color-gray-3: #71717a;
67+
--sl-color-gray-3: #909099; /* Lightened from #71717a — 3.66:1 on --sl-color-bg failed WCAG AA (4.5:1) for footer/edit-link/TOC text; this hits ~4.7:1+ against both --sl-color-bg and --sl-color-gray-7 */
6868
--sl-color-gray-4: #52525b;
6969
--sl-color-gray-5: #52525b; /* Increased from #3f3f46 for better borders */
70-
--sl-color-gray-6: #3f3f46; /* Increased from #27272a for better backgrounds */
70+
--sl-color-gray-6: #27272a; /* Reverted from #3f3f46: that lighter value became the Expressive Code
71+
editor background, and the built-in Night Owl syntax theme's comment/
72+
keyword/string colors (tuned for a ~#23262f bg) dropped to ~3.8:1 against
73+
it — below WCAG AA. #27272a is close to the theme's own reference bg and
74+
restores ~5.4:1+ for those tokens; all other consumers (borders, hover
75+
backgrounds) still pass comfortably at this value too. */
7176
--sl-color-gray-7: #27272a; /* Adjusted for code blocks */
7277
--sl-color-black: #09090b;
7378

@@ -201,9 +206,12 @@ header.header {
201206
color: #93c5fd;
202207
}
203208

204-
/* Code within links - better contrast */
209+
/* Code within links - better contrast. Inline code's background is
210+
Starlight's --sl-color-bg-inline-code (= gray-6); --sl-color-accent text
211+
on top of that only hits 4.38:1 in light mode, just under WCAG AA, so use
212+
the darker accent-high tone here instead (6.78:1). */
205213
.sl-markdown-content a code {
206-
color: var(--sl-color-accent);
214+
color: var(--sl-color-accent-high);
207215
text-decoration: none;
208216
border-bottom: 1px solid transparent;
209217
transition: border-color 0.15s ease;
@@ -287,6 +295,19 @@ header.header {
287295
border-left-width: 3px;
288296
}
289297

298+
/* Our link accent is tuned against a neutral page background, but note/tip/
299+
caution/danger asides tint the background per-variant. In some variants
300+
(tip, caution in dark mode; note, danger in light mode) that drops link
301+
contrast below 4.5:1. Use colors already in the palette that pass against
302+
all four variant backgrounds in both themes. */
303+
.starlight-aside a {
304+
color: var(--sl-color-accent-high);
305+
}
306+
307+
:root[data-theme='dark'] .starlight-aside a {
308+
color: #93c5fd;
309+
}
310+
290311
/* ============================================
291312
TABLE OF CONTENTS
292313
============================================ */
@@ -418,6 +439,15 @@ html[data-has-hero] {
418439
filter: brightness(1.15);
419440
}
420441

442+
/* Dark-mode accent (#3b82f6) only gives white text 3.68:1 here — fails WCAG
443+
AA (4.5:1). Use a darker blue for this button only; --sl-color-accent
444+
itself stays untouched since it passes contrast everywhere else it's used
445+
as foreground text/link color. */
446+
:root[data-theme='dark'][data-has-hero] .hero .sl-link-button.primary {
447+
background: #2563eb !important;
448+
border-color: #2563eb !important;
449+
}
450+
421451
[data-has-hero] .hero .sl-link-button.minimal {
422452
color: #cbd5e1 !important;
423453
background: transparent !important;
@@ -522,6 +552,12 @@ html[data-has-hero] {
522552
text-decoration: none !important;
523553
}
524554

555+
/* Dark-mode gray-4 (#52525b) is tuned for borders, not text — only 2.29:1 on
556+
--sl-color-bg. Use gray-3 here instead so the link stays readable. */
557+
:root[data-theme='dark'][data-has-hero] .source-link {
558+
color: var(--sl-color-gray-3) !important;
559+
}
560+
525561
/* Block list rows on splash page */
526562
[data-has-hero] .block-list {
527563
text-align: left;

0 commit comments

Comments
 (0)