From 38b888cf64407087e0a534892054022ebf787be7 Mon Sep 17 00:00:00 2001 From: Luciano Mammino Date: Sat, 7 Nov 2026 21:42:25 +0000 Subject: [PATCH 01/28] feat: typography refinements and PRODUCT.md - Load real 700 weights for Hanuman, Atkinson Hyperlegible and Cascadia Mono (headings were faux-bolded), with metric-matched fallbacks - Preload only body 400 and heading 700 - Use Cascadia Mono in Expressive Code blocks - Article prose: Hanuman headings with clearer scale, tighter leading, balanced/pretty wrapping, themed selection, underline offsets - Admonitions: hairline border instead of thick left stripe - Add PRODUCT.md with confirmed product context --- PRODUCT.md | 74 +++++++++++++++++++++++++ astro.config.ts | 11 ++++ ec.config.mjs | 8 +++ src/Layout.astro | 13 ++++- src/components/blog/BlogLayout.astro | 4 +- src/styles/global.css | 83 ++++++++++++++++++++++++++-- 6 files changed, 183 insertions(+), 10 deletions(-) create mode 100644 PRODUCT.md diff --git a/PRODUCT.md b/PRODUCT.md new file mode 100644 index 0000000..d98f96c --- /dev/null +++ b/PRODUCT.md @@ -0,0 +1,74 @@ +# Product + + + +## Platform + +web + +## Users + +- **Prospective readers:** intermediate Node.js developers who can ship code but want to understand why production-grade Node.js is designed the way it is (async flows, streams, scalability, architecture). They land on the homepage deciding whether the book is worth buying. +- **Search visitors:** developers arriving on a blog article from a search for a specific Node.js task (HTTP requests, env vars, file I/O, new releases). They want a correct, modern answer quickly, and some become prospective readers. + +## Product Purpose + +The official website for the book _Node.js Design Patterns_ by Mario Casciaro and Luciano Mammino. It exists to sell the book. + +Success, in priority order when goals conflict: + +1. **Book sales:** clicks to buy the print edition (`BUY_LINK_PRINT`) or the e-book (`BUY_LINK_EBOOK`). +2. **Free chapter signups:** an 80-page free chapter delivered by email through a Kit form. It feeds sales. +3. **Blog authority:** search traffic and trust from original articles (target cadence: 2 per month). It feeds both of the above. + +## Positioning + +All four are confirmed and can be claimed: + +- **Patterns, not recipes:** teaches the reasoning behind production-grade Node.js design, so it outlasts API churn. +- **Hands-on depth:** runnable examples and exercises in every chapter, for learning by building. +- **Practitioner authors:** written by working engineers active in the Node.js community, with forewords by Node.js core contributors. +- **Longevity and trust:** four editions, widely read and well reviewed. + +## Operating Context + +- Homepage visitors compare the book against free docs, courses, and other books. Proof (reviews, reader count, rating, chapter contents, free chapter) carries the decision. +- Blog visitors read long technical articles with code blocks, often from search, on desktop and mobile, in light and dark themes. Articles promote the book in a sidebar and closing block. +- The book is sold through Amazon (via `nodejsdp.link` redirects) and Packt; the site itself has no checkout. + +## Capabilities and Constraints + +- Static site (Astro), deployed to GitHub Pages at https://nodejsdesignpatterns.com. Everything that can be prebuilt is prebuilt; client-side JavaScript is minimal (see `.claude/constitution.md`). +- Content is data-driven through typed collections in `src/content/`: authors, blog, chapters, FAQ, quotes, reviews. +- Blog articles follow `.claude/article-brief-template.md`, use modern ESM and async/await, and include an FAQ section for schema markup. +- **Canonical book facts** live in `src/lib/const.ts`: Fourth Edition, Packt Publishing, published 2025-10-09, ISBN 9781803238944, 13 chapters, 732 pages, 170 examples, 54 exercises, 30,000+ readers, 4.6/5 from 780 reviews. + - Known stale copy: `SITE_DESCRIPTION` still says "660+ pages, 150+ examples". Do not reuse those figures. + +## Brand Commitments + +- Name: _Node.js Design Patterns_, Fourth Edition. Authors: Mario Casciaro and Luciano Mammino. Publisher: Packt. +- Forewords by Colin J. Ihrig and Matteo Collina (as printed on the cover). +- Social handles: `@nodejspatterns` (site), `@loige` (Luciano). +- Writing voice (blog and site copy): friendly, almost colloquial, like explaining to a colleague; technically accurate. Context and "why" before "how". Never use em dashes. + +## Evidence on Hand + +- Reader reviews with rating, platform, and source URL: `src/content/reviews/`. +- Testimonials: `src/content/quotes/`. +- Chapter descriptions: `src/content/chapters/` (13 chapters). +- FAQ entries: `src/content/faq/`. +- Author profiles and photos: `src/content/authors/` (Luciano Mammino, Mario Casciaro, plus guest blog author Giuseppe Morelli). +- Book cover and promo imagery: `src/images/`, `public/images/`. +- 13 published blog articles: `src/content/blog/`. +- Do not fabricate reviews, quotes, reader counts, ratings, or endorsements beyond these sources. + +## Product Principles + +1. **Every surface earns the sale honestly.** Persuasion comes from real proof and real content, never invented numbers or urgency. +2. **Teach first on the blog.** An article must be the best answer to its query; the book promotion follows the value and never interrupts it. +3. **Lean and fast.** Static, prebuilt, optimized assets, minimal JavaScript. Speed is part of the credibility with a developer audience. +4. **Truthful, current Node.js.** Code and claims reflect modern Node.js (ESM, async/await, current releases). + +## Accessibility & Inclusion + +WCAG AA is required: semantic HTML, correct heading hierarchy, meaningful alt text, 4.5:1 text contrast (3:1 large), keyboard access with visible focus, labeled forms, skip links. Light and dark themes must both meet it. Source: `.claude/constitution.md`. diff --git a/astro.config.ts b/astro.config.ts index cedc7c6..cd00279 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -31,16 +31,27 @@ export default defineConfig({ provider: fontProviders.google(), name: 'Hanuman', cssVariable: '--font-base-serif', + /* Headings are bold; 400 is used by the FAQ toggles and quote marks. + Without 700 the browser fakes bold by smearing the 400 outlines */ + weights: [400, 700], + styles: ['normal'], + fallbacks: ['serif'], }, { provider: fontProviders.google(), name: 'Atkinson Hyperlegible', cssVariable: '--font-base-sans', + weights: [400, 700], + styles: ['normal', 'italic'], + fallbacks: ['sans-serif'], }, { provider: fontProviders.google(), name: 'Cascadia Mono', cssVariable: '--font-base-mono', + weights: [400, 700], + styles: ['normal', 'italic'], + fallbacks: ['monospace'], }, ], }) diff --git a/ec.config.mjs b/ec.config.mjs index 2f5af80..bb6a9c8 100644 --- a/ec.config.mjs +++ b/ec.config.mjs @@ -7,6 +7,14 @@ const config = { }, plugins: [pluginCollapsibleSections({})], useDarkModeMediaQuery: false, + styleOverrides: { + /* Use the self-hosted Cascadia Mono instead of the generic system stack */ + codeFontFamily: + "var(--font-base-mono), ui-monospace, Menlo, Consolas, 'Liberation Mono', monospace", + codeFontSize: '0.875rem', + codeLineHeight: '1.65', + uiFontFamily: 'var(--font-base-sans), system-ui, sans-serif', + }, } export default config diff --git a/src/Layout.astro b/src/Layout.astro index 5432168..40ffaa5 100644 --- a/src/Layout.astro +++ b/src/Layout.astro @@ -245,9 +245,16 @@ const { initLinkClickTracking() } - - - + + + + {import.meta.env.PROD && } diff --git a/src/components/blog/BlogLayout.astro b/src/components/blog/BlogLayout.astro index 4cfe58f..9c6f122 100644 --- a/src/components/blog/BlogLayout.astro +++ b/src/components/blog/BlogLayout.astro @@ -151,8 +151,8 @@ if (post.rendered?.metadata?.headings) { class="flex-1 min-w-0" data-reading-time={readingTime} > - -
+ +
{ nestedToc.length > 0 && (
diff --git a/src/styles/global.css b/src/styles/global.css index 4aa0c10..a79d07e 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -120,6 +120,79 @@ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: green' viewBox='0 0 304 304' width='304' height='304'%3E%3Cpath fill='currentColor' fill-opacity='0.05' d='M44.1 224a5 5 0 1 1 0 2H0v-2h44.1zm160 48a5 5 0 1 1 0 2H82v-2h122.1zm57.8-46a5 5 0 1 1 0-2H304v2h-42.1zm0 16a5 5 0 1 1 0-2H304v2h-42.1zm6.2-114a5 5 0 1 1 0 2h-86.2a5 5 0 1 1 0-2h86.2zm-256-48a5 5 0 1 1 0 2H0v-2h12.1zm185.8 34a5 5 0 1 1 0-2h86.2a5 5 0 1 1 0 2h-86.2zM258 12.1a5 5 0 1 1-2 0V0h2v12.1zm-64 208a5 5 0 1 1-2 0v-54.2a5 5 0 1 1 2 0v54.2zm48-198.2V80h62v2h-64V21.9a5 5 0 1 1 2 0zm16 16V64h46v2h-48V37.9a5 5 0 1 1 2 0zm-128 96V208h16v12.1a5 5 0 1 1-2 0V210h-16v-76.1a5 5 0 1 1 2 0zm-5.9-21.9a5 5 0 1 1 0 2H114v48H85.9a5 5 0 1 1 0-2H112v-48h12.1zm-6.2 130a5 5 0 1 1 0-2H176v-74.1a5 5 0 1 1 2 0V242h-60.1zm-16-64a5 5 0 1 1 0-2H114v48h10.1a5 5 0 1 1 0 2H112v-48h-10.1zM66 284.1a5 5 0 1 1-2 0V274H50v30h-2v-32h18v12.1zM236.1 176a5 5 0 1 1 0 2H226v94h48v32h-2v-30h-48v-98h12.1zm25.8-30a5 5 0 1 1 0-2H274v44.1a5 5 0 1 1-2 0V146h-10.1zm-64 96a5 5 0 1 1 0-2H208v-80h16v-14h-42.1a5 5 0 1 1 0-2H226v18h-16v80h-12.1zm86.2-210a5 5 0 1 1 0 2H272V0h2v32h10.1zM98 101.9V146H53.9a5 5 0 1 1 0-2H96v-42.1a5 5 0 1 1 2 0zM53.9 34a5 5 0 1 1 0-2H80V0h2v34H53.9zm60.1 3.9V66H82v64H69.9a5 5 0 1 1 0-2H80V64h32V37.9a5 5 0 1 1 2 0zM101.9 82a5 5 0 1 1 0-2H128V37.9a5 5 0 1 1 2 0V82h-28.1zm16-64a5 5 0 1 1 0-2H146v44.1a5 5 0 1 1-2 0V18h-26.1zm102.2 270a5 5 0 1 1 0 2H98v14h-2v-16h124.1zM242 149.9V160h16v34h-16v62h48v48h-2v-46h-48v-66h16v-30h-16v-12.1a5 5 0 1 1 2 0zM53.9 18a5 5 0 1 1 0-2H64V2H48V0h18v18H53.9zm112 32a5 5 0 1 1 0-2H192V0h50v2h-48v48h-28.1zm-48-48a5 5 0 0 1-9.8-2h2.07a3 3 0 1 0 5.66 0H178v34h-18V21.9a5 5 0 1 1 2 0V32h14V2h-58.1zm0 96a5 5 0 1 1 0-2H137l32-32h39V21.9a5 5 0 1 1 2 0V66h-40.17l-32 32H117.9zm28.1 90.1a5 5 0 1 1-2 0v-76.51L175.59 80H224V21.9a5 5 0 1 1 2 0V82h-49.59L146 112.41v75.69zm16 32a5 5 0 1 1-2 0v-99.51L184.59 96H300.1a5 5 0 0 1 3.9-3.9v2.07a3 3 0 0 0 0 5.66v2.07a5 5 0 0 1-3.9-3.9H185.41L162 121.41v98.69zm-144-64a5 5 0 1 1-2 0v-3.51l48-48V48h32V0h2v50H66v55.41l-48 48v2.69zM50 53.9v43.51l-48 48V208h26.1a5 5 0 1 1 0 2H0v-65.41l48-48V53.9a5 5 0 1 1 2 0zm-16 16V89.41l-34 34v-2.82l32-32V69.9a5 5 0 1 1 2 0zM12.1 32a5 5 0 1 1 0 2H9.41L0 43.41V40.6L8.59 32h3.51zm265.8 18a5 5 0 1 1 0-2h18.69l7.41-7.41v2.82L297.41 50H277.9zm-16 160a5 5 0 1 1 0-2H288v-71.41l16-16v2.82l-14 14V210h-28.1zm-208 32a5 5 0 1 1 0-2H64v-22.59L40.59 194H21.9a5 5 0 1 1 0-2H41.41L66 216.59V242H53.9zm150.2 14a5 5 0 1 1 0 2H96v-56.6L56.6 162H37.9a5 5 0 1 1 0-2h19.5L98 200.6V256h106.1zm-150.2 2a5 5 0 1 1 0-2H80v-46.59L48.59 178H21.9a5 5 0 1 1 0-2H49.41L82 208.59V258H53.9zM34 39.8v1.61L9.41 66H0v-2h8.59L32 40.59V0h2v39.8zM2 300.1a5 5 0 0 1 3.9 3.9H3.83A3 3 0 0 0 0 302.17V256h18v48h-2v-46H2v42.1zM34 241v63h-2v-62H0v-2h34v1zM17 18H0v-2h16V0h2v18h-1zm273-2h14v2h-16V0h2v16zm-32 273v15h-2v-14h-14v14h-2v-16h18v1zM0 92.1A5.02 5.02 0 0 1 6 97a5 5 0 0 1-6 4.9v-2.07a3 3 0 1 0 0-5.66V92.1zM80 272h2v32h-2v-32zm37.9 32h-2.07a3 3 0 0 0-5.66 0h-2.07a5 5 0 0 1 9.8 0zM5.9 0A5.02 5.02 0 0 1 0 5.9V3.83A3 3 0 0 0 3.83 0H5.9zm294.2 0h2.07A3 3 0 0 0 304 3.83V5.9a5 5 0 0 1-3.9-5.9zm3.9 300.1v2.07a3 3 0 0 0-1.83 1.83h-2.07a5 5 0 0 1 3.9-3.9zM97 100a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-48 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 96a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-144a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-96 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm96 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-32 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM49 36a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-32 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM33 68a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 240a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm80-176a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 48a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm112 176a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm-16 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM17 180a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0 16a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm0-32a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16 0a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM17 84a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm32 64a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm16-16a3 3 0 1 0 0-6 3 3 0 0 0 0 6z'%3E%3C/path%3E%3C/svg%3E"); } +/* Typography: line breaking, selection, and article prose */ +@layer base { + h1, + h2, + h3, + h4 { + text-wrap: balance; + } + + p, + li, + blockquote, + dd, + figcaption { + text-wrap: pretty; + } + + ::selection { + background-color: oklch(from var(--color-primary) l c h / 0.28); + } +} + +/* Article prose: headings share the site's Hanuman voice, with clear size + steps (h2 > h3 > h4 > body) instead of prose-xl's close 36/30px pair */ +.prose { + line-height: 1.7; +} + +.prose :where(h2, h3, h4):not(:where(.not-prose, .not-prose *)) { + font-family: + var(--font-base-serif), + Iowan Old Style, + Baskerville, + serif; + font-weight: 700; + letter-spacing: -0.01em; + scroll-margin-top: 5rem; +} + +.prose :where(h2):not(:where(.not-prose, .not-prose *)) { + font-size: 1.6em; + line-height: 1.2; + margin-top: 2em; + margin-bottom: 0.6em; +} + +.prose :where(h3):not(:where(.not-prose, .not-prose *)) { + font-size: 1.25em; + line-height: 1.3; + margin-top: 1.8em; + margin-bottom: 0.5em; +} + +.prose :where(h4):not(:where(.not-prose, .not-prose *)) { + font-size: 1.05em; + line-height: 1.4; + margin-top: 1.6em; + margin-bottom: 0.4em; +} + +.prose :where(h2 + h3, h3 + h4):not(:where(.not-prose, .not-prose *)) { + margin-top: 0.8em; +} + +.prose :where(a):not(:where(.not-prose, .not-prose *)) { + text-underline-offset: 0.18em; + text-decoration-thickness: 1px; +} + +.prose :where(a):not(:where(.not-prose, .not-prose *)):hover { + text-decoration-thickness: 2px; +} + .content h1, .content h2, .content h3, @@ -258,12 +331,12 @@ /* Admonition styles */ aside.admonition { --admonition-color: var(--color-neutral); - border-left-width: 3px; - border-left-style: solid; - border-color: var(--admonition-color); - padding: 1rem; + /* Type is carried by the tinted surface, colored icon, and title; a hairline + in the same hue just defines the edge */ + border: 1px solid oklch(from var(--admonition-color) l c h / 0.25); + padding: 1rem 1.25rem; margin: 1.5rem 0; - border-radius: 0.25rem; + border-radius: 0.5rem; background-color: var(--color-base-200); } From e23bbb3af38ece4428facfa67ca3a59e523dac11 Mon Sep 17 00:00:00 2001 From: Luciano Mammino Date: Sat, 7 Nov 2026 21:44:50 +0000 Subject: [PATCH 02/28] fix(a11y): WCAG AA contrast for brand green and callout titles - Light theme primary deepened to oklch(50% 0.16 149): ~5:1 as text on light surfaces and behind white button labels (was 2.5-3.1:1) - New caution/danger ink tokens for callout titles (were 1.55-2.4:1) - Footer credits and GitHub link raised above 4.5:1 - Callout titles keep authored casing (.env was rendered as .Env) --- src/components/Footer.astro | 4 ++-- src/plugins/remark-admonitions.ts | 4 +++- src/styles/global.css | 14 ++++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 2dd79a8..f141afe 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -210,12 +210,12 @@ const currentYear = new Date().getFullYear()
-
+
Found an error or something that can be improved? You can help us make this website better on{' '} diff --git a/src/plugins/remark-admonitions.ts b/src/plugins/remark-admonitions.ts index 423f057..d6626e8 100644 --- a/src/plugins/remark-admonitions.ts +++ b/src/plugins/remark-admonitions.ts @@ -57,7 +57,9 @@ export const remarkAdmonitions: Plugin<[], Root> = () => (tree) => { const admonitionType = node.name if (!isAdmonition(admonitionType)) return - let title: string = admonitionType + // Default title is the capitalized type ("Tip"); custom titles are kept verbatim + let title: string = + admonitionType.charAt(0).toUpperCase() + admonitionType.slice(1) let titleNode: PhrasingContent[] = [{ type: 'text', value: title }] // Check if there's a custom title diff --git a/src/styles/global.css b/src/styles/global.css index a79d07e..03e2ca9 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -31,7 +31,9 @@ --color-base-200: oklch(92% 0.013 255.508); --color-base-300: oklch(70% 0.04 256.788); --color-base-content: oklch(20% 0.042 265.755); - --color-primary: oklch(62.7% 0.194 149.214); + /* Deep enough to pass WCAG AA both as text on light surfaces (~5:1) + and behind white button labels (~5:1). Dark theme keeps the brighter green */ + --color-primary: oklch(50% 0.16 149.214); --color-primary-content: oklch(98% 0.003 247.858); --color-secondary: oklch(76% 0.188 70.08); --color-secondary-content: oklch(20% 0.042 265.755); @@ -49,6 +51,9 @@ --color-warning-content: oklch(27% 0.077 45.635); --color-error: oklch(71% 0.194 13.428); --color-error-content: oklch(27% 0.105 12.094); + /* Readable text versions of the warning/error hues, for callout titles */ + --color-caution-ink: oklch(50% 0.13 60); + --color-danger-ink: oklch(52% 0.19 20); --radius-selector: 0.5rem; --radius-field: 0.25rem; --radius-box: 0.5rem; @@ -104,6 +109,8 @@ --color-warning-content: oklch(18% 0.07 50); --color-error: oklch(66% 0.18 25); --color-error-content: oklch(15% 0.08 20); + --color-caution-ink: var(--color-warning); + --color-danger-ink: var(--color-error); /* Shared tokens */ --radius-selector: 0.5rem; @@ -347,7 +354,6 @@ aside.admonition .admonition-title { gap: 0.5rem; font-size: 1rem; font-weight: bold; - text-transform: capitalize; color: var(--admonition-color); } @@ -405,7 +411,7 @@ aside.admonition[data-admonition-type='important'] .admonition-title::before { /* Caution admonition */ aside.admonition[data-admonition-type='caution'] { - --admonition-color: var(--color-warning); + --admonition-color: var(--color-caution-ink); background-color: oklch(from var(--color-warning) l c h / 0.1); } @@ -416,7 +422,7 @@ aside.admonition[data-admonition-type='caution'] .admonition-title::before { /* Danger/Warning admonition */ aside.admonition[data-admonition-type='danger'], aside.admonition[data-admonition-type='warning'] { - --admonition-color: var(--color-error); + --admonition-color: var(--color-danger-ink); background-color: oklch(from var(--color-error) l c h / 0.1); } From 98747b63ab32b453173c71a3aecd9238f748f2f4 Mon Sep 17 00:00:00 2001 From: Luciano Mammino Date: Sat, 7 Nov 2026 21:48:43 +0000 Subject: [PATCH 03/28] fix(responsive): no horizontal page scroll on phones, larger tap targets - Wrap markdown tables in a focusable, labelled horizontal scroll region - Long inline code, link text and callout titles wrap instead of overflowing - Single-column grids use minmax(0,1fr) so images cannot widen them (320px) - Sidebar promo card is one large link instead of card + 20px inner link - Mobile menu links are 44px tall --- astro.config.ts | 3 +- src/components/Navigation.astro | 6 ++-- src/components/blog/BookPromo.astro | 13 +++++---- src/components/pages/Home/Authors.astro | 2 +- src/components/pages/Home/Faq.astro | 2 +- src/components/pages/Home/FreeChapter.astro | 2 +- src/components/pages/Home/Hero.astro | 2 +- src/components/pages/Home/WhatsInside.astro | 4 +-- src/plugins/remark-table-scroll.ts | 32 +++++++++++++++++++++ src/styles/global.css | 22 ++++++++++++++ 10 files changed, 73 insertions(+), 15 deletions(-) create mode 100644 src/plugins/remark-table-scroll.ts diff --git a/astro.config.ts b/astro.config.ts index cd00279..ffdf7ab 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -8,6 +8,7 @@ import { defineConfig, fontProviders } from 'astro/config' import expressiveCode from 'astro-expressive-code' import remarkDirective from 'remark-directive' /* Handle ::: directives as nodes */ import { remarkAdmonitions } from './src/plugins/remark-admonitions' /* Add admonitions */ +import { remarkTableScroll } from './src/plugins/remark-table-scroll' /* Scrollable tables on mobile */ // https://astro.build/config export default defineConfig({ @@ -20,7 +21,7 @@ export default defineConfig({ /* Explicitly use the remark/rehype pipeline (instead of Astro 7's default Sätteri) since admonitions depend on remark plugins */ processor: unified({ - remarkPlugins: [remarkDirective, remarkAdmonitions], + remarkPlugins: [remarkDirective, remarkAdmonitions, remarkTableScroll], }), }, vite: { diff --git a/src/components/Navigation.astro b/src/components/Navigation.astro index 2f6ec91..1153454 100644 --- a/src/components/Navigation.astro +++ b/src/components/Navigation.astro @@ -118,12 +118,12 @@ const buyButton = { id="mobile-menu" class="md:hidden border-t border-base-300 overflow-hidden transition-all duration-200 ease-in-out max-h-0 opacity-0 p-0" > -
+
{ menuItems.map((item) => ( {item.label} @@ -134,7 +134,7 @@ const buyButton = { href={buyButton.href} variant="primary" size="sm" - class="bg-primary hover:bg-primary-focus text-primary-content w-fit" + class="mt-3 bg-primary hover:bg-primary/90 text-primary-content w-fit" id="mobile-cta-button" > {buyButton.label} diff --git a/src/components/blog/BookPromo.astro b/src/components/blog/BookPromo.astro index a8f4710..200a9b4 100644 --- a/src/components/blog/BookPromo.astro +++ b/src/components/blog/BookPromo.astro @@ -78,8 +78,9 @@ const promoVariant = extractPromoVariant(selectedPromoKey) data-analytics-cta-type="book_promo_card" data-analytics-cta-position="sidebar" > - Link to buy Node.js Design PatternsGet your copy of Node.js Design Patterns
@@ -94,15 +95,17 @@ const promoVariant = extractPromoVariant(selectedPromoKey)

{selectedPromoMessage}

+
diff --git a/src/components/pages/Home/Authors.astro b/src/components/pages/Home/Authors.astro index d77f137..57d6260 100644 --- a/src/components/pages/Home/Authors.astro +++ b/src/components/pages/Home/Authors.astro @@ -31,7 +31,7 @@ import { Globe } from '@lucide/astro'
-
+
-
+
-
+
diff --git a/src/components/pages/Home/Hero.astro b/src/components/pages/Home/Hero.astro index 619aebd..f2a1ce5 100644 --- a/src/components/pages/Home/Hero.astro +++ b/src/components/pages/Home/Hero.astro @@ -21,7 +21,7 @@ const numberFormatter = new Intl.NumberFormat('en-US', { >
-
+
-
+
-
+

= () => (tree) => { + visit(tree, 'table', (node, index, parent: Parent | undefined) => { + if (!parent || index === undefined) return + const wrapper = { + type: 'tableScroll', + data: { + hName: 'div', + hProperties: { + className: ['table-scroll'], + role: 'region', + ariaLabel: 'Scrollable table', + tabIndex: 0, + }, + }, + children: [node], + } + parent.children.splice(index, 1, wrapper as unknown as typeof node) + // Skip the wrapper's children so the same table isn't wrapped twice + return index + 1 + }) +} diff --git a/src/styles/global.css b/src/styles/global.css index 03e2ca9..b7562db 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -191,6 +191,27 @@ margin-top: 0.8em; } +/* Narrow screens: long inline code (URLs, env strings) wraps instead of + pushing the page sideways; wide tables scroll inside their own region */ +.prose :where(:not(pre) > code, a):not(:where(.not-prose, .not-prose *)) { + overflow-wrap: anywhere; +} + +.prose .table-scroll { + overflow-x: auto; + margin-block: 2em; + border-radius: 0.25rem; +} + +.prose .table-scroll:focus-visible { + outline: 2px solid var(--color-primary); + outline-offset: 2px; +} + +.prose .table-scroll > table { + margin-block: 0; +} + .prose :where(a):not(:where(.not-prose, .not-prose *)) { text-underline-offset: 0.18em; text-decoration-thickness: 1px; @@ -349,6 +370,7 @@ aside.admonition { aside.admonition .admonition-title { margin: 0 0 0.75rem 0; + overflow-wrap: anywhere; display: flex; align-items: center; gap: 0.5rem; From 05f07d98a8c3e674f8a8b7223a82a2b4a577f06d Mon Sep 17 00:00:00 2001 From: Luciano Mammino Date: Sat, 7 Nov 2026 21:55:00 +0000 Subject: [PATCH 04/28] fix(a11y): keyboard order, landmarks and heading structure - Homepage rendered twice (duplicate ids); render it once - Hidden top bar reveals itself while focus is inside it; collapsed mobile menu is inert; toggle exposes aria-expanded/aria-controls and a label - Skip-to-content link and a
on every page - Blog cards: drop positive tabindex and role=link; one stretched title link per card instead of three - FAQ accordion: heading > button pattern with aria-expanded (was h5 inside button) - Footer column titles h3 -> h2; article share block is a
; labelled breadcrumb, related-articles nav and numbered table regions --- src/Layout.astro | 5 ++++ src/components/Footer.astro | 18 +++++++------- src/components/Navigation.astro | 30 ++++++++++++++++++++-- src/components/blog/AuthorInfo.astro | 6 ++--- src/components/blog/BlogCard.astro | 22 ++++++++--------- src/components/blog/BlogLayout.astro | 31 +++++++++++------------ src/components/blog/Breadcrumb.astro | 2 +- src/components/pages/Home/Faq.astro | 37 ++++++++++++++++------------ src/pages/404.astro | 6 ++++- src/pages/blog/index.astro | 10 +++++--- src/pages/index.astro | 30 +++++++++++----------- src/plugins/remark-table-scroll.ts | 5 +++- 12 files changed, 123 insertions(+), 79 deletions(-) diff --git a/src/Layout.astro b/src/Layout.astro index 40ffaa5..1302878 100644 --- a/src/Layout.astro +++ b/src/Layout.astro @@ -261,6 +261,11 @@ const { + Skip to content diff --git a/src/components/Footer.astro b/src/components/Footer.astro index f141afe..71ea15a 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -33,12 +33,12 @@ const currentYear = new Date().getFullYear() >
-

Get the book -

+

-

Connect -

+
-

@@ -146,7 +146,7 @@ const currentYear = new Date().getFullYear() class="text-base-content/80 hover:text-primary transition-colors duration-200" >blog -

+
{ latestBlogPosts.map((post) => ( @@ -169,12 +169,12 @@ const currentYear = new Date().getFullYear()
-

Community -

+
diff --git a/src/components/Navigation.astro b/src/components/Navigation.astro index 1153454..9271a0e 100644 --- a/src/components/Navigation.astro +++ b/src/components/Navigation.astro @@ -18,6 +18,7 @@ const buyButton = {