@brandon_m_behring/book-scaffold-astro 4.22.0 → 4.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ChapterNav.astro +3 -2
- package/components/Cite.astro +2 -1
- package/components/PartReview.astro +2 -1
- package/components/Rationale.astro +1 -1
- package/components/Sidebar.astro +18 -11
- package/components/Term.astro +2 -1
- package/components/TipsCard.astro +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -0
- package/dist/schemas.d.ts +1 -1
- package/dist/{types-CwsA0C9T.d.ts → types-CGN95mrX.d.ts} +11 -0
- package/layouts/Base.astro +4 -3
- package/package.json +1 -1
|
@@ -10,17 +10,18 @@ interface Props {
|
|
|
10
10
|
}
|
|
11
11
|
const { currentId } = Astro.props;
|
|
12
12
|
const { prev, next } = await getNeighbors(currentId);
|
|
13
|
+
const baseUrl = import.meta.env.BASE_URL ?? '/';
|
|
13
14
|
---
|
|
14
15
|
{(prev || next) && (
|
|
15
16
|
<nav class="chapter-nav" aria-label="Chapter navigation">
|
|
16
17
|
{prev && (
|
|
17
|
-
<a href={
|
|
18
|
+
<a href={`${baseUrl}chapters/${prev.id}/`} class="prev">
|
|
18
19
|
<span class="nav-label">← Previous</span>
|
|
19
20
|
<span class="nav-title">{prev.data.title}</span>
|
|
20
21
|
</a>
|
|
21
22
|
)}
|
|
22
23
|
{next && (
|
|
23
|
-
<a href={
|
|
24
|
+
<a href={`${baseUrl}chapters/${next.id}/`} class="next">
|
|
24
25
|
<span class="nav-label">Next →</span>
|
|
25
26
|
<span class="nav-title">{next.data.title}</span>
|
|
26
27
|
</a>
|
package/components/Cite.astro
CHANGED
|
@@ -45,6 +45,7 @@ interface Props {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const { key, page } = Astro.props;
|
|
48
|
+
const baseUrl = import.meta.env.BASE_URL ?? '/';
|
|
48
49
|
const entry = map[key];
|
|
49
50
|
if (!entry) {
|
|
50
51
|
throw new Error(
|
|
@@ -66,6 +67,6 @@ else authorText = `${surname(authors[0])} et al.`;
|
|
|
66
67
|
const year = entry.issued?.['date-parts']?.[0]?.[0] ?? 'n.d.';
|
|
67
68
|
const yearText = page ? `${year}, p. ${page}` : `${year}`;
|
|
68
69
|
---
|
|
69
|
-
<a href={
|
|
70
|
+
<a href={`${baseUrl}references#${key}`} class="cite" title={entry.title ?? key}>
|
|
70
71
|
{authorText} ({yearText})
|
|
71
72
|
</a>
|
|
@@ -27,6 +27,7 @@ interface Props {
|
|
|
27
27
|
title?: string;
|
|
28
28
|
}
|
|
29
29
|
const { part, title } = Astro.props;
|
|
30
|
+
const baseUrl = import.meta.env.BASE_URL ?? '/';
|
|
30
31
|
|
|
31
32
|
// Reuse the build-exercises index (keyed by chapter slug). Project-root-relative
|
|
32
33
|
// glob (the tips.astro / exercises.astro lesson) so it resolves across consumers.
|
|
@@ -65,7 +66,7 @@ const heading = title ?? `Part ${part} Review`;
|
|
|
65
66
|
</p>
|
|
66
67
|
{groups.map((g) => (
|
|
67
68
|
<section class="part-review-chapter">
|
|
68
|
-
<h3 class="part-review-chapter-title"><a href={
|
|
69
|
+
<h3 class="part-review-chapter-title"><a href={`${baseUrl}chapters/${g.chapter}/`}>{g.chapter}</a></h3>
|
|
69
70
|
<ol class="part-review-list">
|
|
70
71
|
{g.exercises.map((ex) => (
|
|
71
72
|
<li id={`review-${ex.id}`} class="part-review-item">
|
|
@@ -54,7 +54,7 @@ const asLink = appendix && !onAnswersRoute;
|
|
|
54
54
|
---
|
|
55
55
|
{asLink ? (
|
|
56
56
|
<p class="question-rationale-ref">
|
|
57
|
-
<a href={
|
|
57
|
+
<a href={`${basePath}/answers#answer-${forId}`}>{title} →</a>
|
|
58
58
|
</p>
|
|
59
59
|
) : (
|
|
60
60
|
<details class="question-rationale">
|
package/components/Sidebar.astro
CHANGED
|
@@ -14,16 +14,21 @@
|
|
|
14
14
|
* Visual: ~280px wide, sticky to top, scrollable independently of main.
|
|
15
15
|
* Site title at top doubles as a "home" link.
|
|
16
16
|
*
|
|
17
|
-
* Customize:
|
|
18
|
-
*
|
|
17
|
+
* Customize (v4.23.0, #135): the brand reads `defineBookConfig({ title,
|
|
18
|
+
* subtitle })` via the book-config virtual module — consumers set both in
|
|
19
|
+
* astro.config.mjs with zero component overrides. The previous hardcoded
|
|
20
|
+
* strings remain the fallbacks, so existing books render unchanged until
|
|
21
|
+
* they configure a title.
|
|
19
22
|
*/
|
|
20
23
|
import { getCollection } from 'astro:content';
|
|
24
|
+
import bookConfig from 'virtual:book-scaffold/book-config';
|
|
21
25
|
import { academicParts } from '../src/schemas';
|
|
22
26
|
import { academicPartHeading } from '../src/lib/academic-parts';
|
|
23
27
|
|
|
24
28
|
const profile = import.meta.env.BOOK_PROFILE ?? 'minimal';
|
|
25
|
-
const siteTitle = 'Book';
|
|
26
|
-
const siteSubtitle = 'A scaffold-astro book';
|
|
29
|
+
const siteTitle = bookConfig.title ?? 'Book';
|
|
30
|
+
const siteSubtitle = bookConfig.subtitle ?? 'A scaffold-astro book';
|
|
31
|
+
const baseUrl = import.meta.env.BASE_URL ?? '/';
|
|
27
32
|
|
|
28
33
|
// Academic profile: part is a string enum. `academicParts` (schemas.ts) is
|
|
29
34
|
// the canonical order, shared with the renderer and ChapterHeader (#95); the
|
|
@@ -87,8 +92,10 @@ for (const r of rows) {
|
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
const currentPath = Astro.url.pathname;
|
|
95
|
+
const chaptersIndexHref = `${baseUrl}chapters/`;
|
|
96
|
+
const referencesHref = `${baseUrl}references/`;
|
|
90
97
|
function isCurrent(id: string): boolean {
|
|
91
|
-
return currentPath ===
|
|
98
|
+
return currentPath === `${baseUrl}chapters/${id}/` || currentPath === `${baseUrl}chapters/${id}`;
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
function partLabel(key: string): string {
|
|
@@ -99,22 +106,22 @@ function partLabel(key: string): string {
|
|
|
99
106
|
|
|
100
107
|
<aside class="sidebar" aria-label="Chapter navigation">
|
|
101
108
|
<div class="sidebar-inner">
|
|
102
|
-
<a href=
|
|
109
|
+
<a href={baseUrl} class="sidebar-home">
|
|
103
110
|
<strong>{siteTitle}</strong>
|
|
104
111
|
<span class="sidebar-subtitle">{siteSubtitle}</span>
|
|
105
112
|
</a>
|
|
106
113
|
|
|
107
114
|
<nav class="sidebar-nav">
|
|
108
115
|
<a
|
|
109
|
-
href=
|
|
110
|
-
class={`sidebar-link sidebar-link-index ${currentPath ===
|
|
116
|
+
href={chaptersIndexHref}
|
|
117
|
+
class={`sidebar-link sidebar-link-index ${currentPath === chaptersIndexHref ? 'is-current' : ''}`}
|
|
111
118
|
>
|
|
112
119
|
All chapters
|
|
113
120
|
</a>
|
|
114
121
|
{profile === 'academic' && (
|
|
115
122
|
<a
|
|
116
|
-
href=
|
|
117
|
-
class={`sidebar-link sidebar-link-index ${currentPath ===
|
|
123
|
+
href={referencesHref}
|
|
124
|
+
class={`sidebar-link sidebar-link-index ${currentPath === referencesHref ? 'is-current' : ''}`}
|
|
118
125
|
>
|
|
119
126
|
References
|
|
120
127
|
</a>
|
|
@@ -127,7 +134,7 @@ function partLabel(key: string): string {
|
|
|
127
134
|
{list.map((r) => (
|
|
128
135
|
<li>
|
|
129
136
|
<a
|
|
130
|
-
href={
|
|
137
|
+
href={`${baseUrl}chapters/${r.id}/`}
|
|
131
138
|
class={`sidebar-link ${isCurrent(r.id) ? 'is-current' : ''}`}
|
|
132
139
|
>
|
|
133
140
|
<span class="sidebar-week">{r.prefix}</span>
|
package/components/Term.astro
CHANGED
|
@@ -17,8 +17,9 @@ interface Props {
|
|
|
17
17
|
id: string;
|
|
18
18
|
}
|
|
19
19
|
const { id } = Astro.props;
|
|
20
|
+
const baseUrl = import.meta.env.BASE_URL ?? '/';
|
|
20
21
|
---
|
|
21
|
-
<a href={
|
|
22
|
+
<a href={`${baseUrl}glossary#term-${id}`} class="term-link"><slot /></a>
|
|
22
23
|
|
|
23
24
|
<style>
|
|
24
25
|
.term-link {
|
|
@@ -20,6 +20,7 @@ const tipsModules = import.meta.glob<{ default: Array<{ n: number; title: string
|
|
|
20
20
|
{ eager: true },
|
|
21
21
|
);
|
|
22
22
|
const tips = tipsModules['/src/data/tips.json']?.default ?? [];
|
|
23
|
+
const baseUrl = import.meta.env.BASE_URL ?? '/';
|
|
23
24
|
---
|
|
24
25
|
<aside class="tips-card" role="contentinfo">
|
|
25
26
|
<h2 class="tips-card-title">Tips</h2>
|
|
@@ -33,7 +34,7 @@ const tips = tipsModules['/src/data/tips.json']?.default ?? [];
|
|
|
33
34
|
<ol class="tips-card-list">
|
|
34
35
|
{tips.map((tip) => (
|
|
35
36
|
<li class="tips-card-item">
|
|
36
|
-
<a href={
|
|
37
|
+
<a href={`${baseUrl}tips#tip-${tip.n}`} class="tips-card-link">
|
|
37
38
|
<span class="tips-card-number">{tip.n}.</span>
|
|
38
39
|
<strong class="tips-card-rule">{tip.title}</strong>
|
|
39
40
|
</a>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AstroUserConfig, AstroIntegration } from 'astro';
|
|
2
|
-
import { c as BookConfigOptions, f as BookScaffoldIntegrationOptions, h as ChaptersRenderer, l as Style } from './types-
|
|
3
|
-
export { B as BOOK_PRESETS, a as BOOK_PROFILES, b as BookConfigError, d as BookPreset, e as BookProfile, g as BookSchemasOptions, C as ChapterFor, F as FreshnessAffordance, i as FrontmatterRouteConfig, P as PartKey, j as PartialRouteToggles, k as ProfileDefinition, R as RouteToggles, S as StatusBadge, m as StyleInput, V as VolatilityBadge, n as composeStyles, o as defineProfile, p as defineStyle, q as normalizeFrontmatterConfig, r as resolvePreset, s as resolveProfile } from './types-
|
|
2
|
+
import { c as BookConfigOptions, f as BookScaffoldIntegrationOptions, h as ChaptersRenderer, l as Style } from './types-CGN95mrX.js';
|
|
3
|
+
export { B as BOOK_PRESETS, a as BOOK_PROFILES, b as BookConfigError, d as BookPreset, e as BookProfile, g as BookSchemasOptions, C as ChapterFor, F as FreshnessAffordance, i as FrontmatterRouteConfig, P as PartKey, j as PartialRouteToggles, k as ProfileDefinition, R as RouteToggles, S as StatusBadge, m as StyleInput, V as VolatilityBadge, n as composeStyles, o as defineProfile, p as defineStyle, q as normalizeFrontmatterConfig, r as resolvePreset, s as resolveProfile } from './types-CGN95mrX.js';
|
|
4
4
|
import { D as volatilityLevels, c as academicParts, Q as Question } from './schemas-DDWDRUxs.js';
|
|
5
5
|
export { A as AcademicChapter, B as BloomLevel, C as CourseNotesChapter, G as GlossaryTerm, M as MinimalChapter, P as Provenance, a as QuestionType, R as ResearchPortfolioChapter, T as ToolsChapter, b as academicChapterSchema, d as bloomLevels, e as changeKinds, f as changelogSchema, g as chapterStatus, h as citationBackstops, i as courseNotesChapterSchema, j as glossarySchema, m as minimalChapterSchema, p as patternCategories, k as patternsSchema, l as provenanceObject, n as provenanceSchema, q as questionDifficulties, o as questionSchema, r as questionTypes, s as refineQuestion, t as refinedQuestionSchema, u as researchPortfolioChapterSchema, v as sourceTiers, w as sourceTiersResearch, x as sourcesSchema, y as toolSlugs, z as toolsChapterSchema } from './schemas-DDWDRUxs.js';
|
|
6
6
|
export { KIND_LABEL, ResolvedTheoremLabel, THEOREM_KINDS, TheoremKind, TheoremLabelProps, resolveTheoremNumber, theoremLabel } from './lib/theorem-label.js';
|
package/dist/index.mjs
CHANGED
|
@@ -1188,6 +1188,7 @@ function bookScaffoldIntegration(opts) {
|
|
|
1188
1188
|
mdxComponentsModule,
|
|
1189
1189
|
// v4.5.0: landing-page data, propagated via virtual module to /index.astro.
|
|
1190
1190
|
title,
|
|
1191
|
+
subtitle,
|
|
1191
1192
|
description,
|
|
1192
1193
|
portfolio,
|
|
1193
1194
|
// v4.6.0: book-level author + SEO config, propagated through the
|
|
@@ -1251,6 +1252,7 @@ function bookScaffoldIntegration(opts) {
|
|
|
1251
1252
|
makeMdxComponentsVitePlugin(resolvedMdxPath),
|
|
1252
1253
|
makeBookConfigVitePlugin({
|
|
1253
1254
|
title: title ?? null,
|
|
1255
|
+
subtitle: subtitle ?? null,
|
|
1254
1256
|
description: description ?? null,
|
|
1255
1257
|
portfolio: portfolio ?? false,
|
|
1256
1258
|
enabledRoutes: enabledRouteNames,
|
|
@@ -1388,6 +1390,8 @@ async function defineBookConfig(opts) {
|
|
|
1388
1390
|
// v4.5.0: pass landing-page data through to the integration so it can
|
|
1389
1391
|
// be exposed to the auto-injected /index.astro via the virtual module.
|
|
1390
1392
|
title: opts.title,
|
|
1393
|
+
// v4.23.0 (#135): sidebar brand subtitle.
|
|
1394
|
+
subtitle: opts.subtitle,
|
|
1391
1395
|
description: opts.description,
|
|
1392
1396
|
portfolio: resolvedPortfolio,
|
|
1393
1397
|
// v4.6.0: book-level author + SEO config (ogImage, twitterHandle),
|
|
@@ -1439,6 +1443,7 @@ async function defineBookConfig(opts) {
|
|
|
1439
1443
|
katexMacros: _katexMacros,
|
|
1440
1444
|
// v4.5.0: strip new landing-related opts so they don't leak into AstroUserConfig.
|
|
1441
1445
|
title: _title,
|
|
1446
|
+
subtitle: _subtitle,
|
|
1442
1447
|
description: _description,
|
|
1443
1448
|
portfolio: _portfolio,
|
|
1444
1449
|
// v4.6.0: strip new book-level SEO opts (author + seo block).
|
|
@@ -1463,6 +1468,7 @@ async function defineBookConfig(opts) {
|
|
|
1463
1468
|
void _markdown;
|
|
1464
1469
|
void _katexMacros;
|
|
1465
1470
|
void _title;
|
|
1471
|
+
void _subtitle;
|
|
1466
1472
|
void _description;
|
|
1467
1473
|
void _portfolio;
|
|
1468
1474
|
void _author;
|
package/dist/schemas.d.ts
CHANGED
|
@@ -592,6 +592,14 @@ interface BookConfigOptions {
|
|
|
592
592
|
* default <title> when no per-page title is supplied.
|
|
593
593
|
*/
|
|
594
594
|
title?: string;
|
|
595
|
+
/**
|
|
596
|
+
* v4.23.0 (#135): Sidebar brand subtitle — the second line under the brand
|
|
597
|
+
* title in the left chapter-nav. Optional; defaults to the scaffold's
|
|
598
|
+
* placeholder ('A scaffold-astro book') for backward compatibility. The
|
|
599
|
+
* brand TITLE is the existing `title` field above (previously the sidebar
|
|
600
|
+
* hardcoded both strings, so every consumer shipped the placeholder).
|
|
601
|
+
*/
|
|
602
|
+
subtitle?: string;
|
|
595
603
|
/**
|
|
596
604
|
* v4.5.0: Book description. Read by the auto-injected `/` landing page (lead paragraph + <meta description>).
|
|
597
605
|
* Optional; landing renders no description paragraph if unset.
|
|
@@ -708,6 +716,9 @@ interface BookScaffoldIntegrationOptions {
|
|
|
708
716
|
extraStyles?: readonly string[];
|
|
709
717
|
/** v4.5.0: book title, propagated to `/` landing via vite.define. */
|
|
710
718
|
title?: string;
|
|
719
|
+
/** v4.23.0 (#135): sidebar brand subtitle, propagated via the book-config
|
|
720
|
+
* virtual module to Sidebar.astro. */
|
|
721
|
+
subtitle?: string;
|
|
711
722
|
/** v4.5.0: book description, propagated to `/` landing via vite.define. */
|
|
712
723
|
description?: string;
|
|
713
724
|
/**
|
package/layouts/Base.astro
CHANGED
|
@@ -99,13 +99,14 @@ const absoluteOgImage = resolvedOgImage
|
|
|
99
99
|
const twitterHandle = bookConfig.seo?.twitterHandle ?? null;
|
|
100
100
|
const ogSiteName = bookConfig.title ?? title;
|
|
101
101
|
const ogDescription = description ?? bookConfig.description ?? '';
|
|
102
|
+
const baseUrl = import.meta.env.BASE_URL ?? '/';
|
|
102
103
|
---
|
|
103
104
|
|
|
104
105
|
<!doctype html>
|
|
105
106
|
<html lang={lang}>
|
|
106
107
|
<head>
|
|
107
108
|
<meta charset="utf-8" />
|
|
108
|
-
<link rel="icon" type="image/svg+xml" href=
|
|
109
|
+
<link rel="icon" type="image/svg+xml" href={`${baseUrl}favicon.svg`} />
|
|
109
110
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
110
111
|
<meta name="color-scheme" content="light dark" />
|
|
111
112
|
<meta name="generator" content={Astro.generator} />
|
|
@@ -119,7 +120,7 @@ const ogDescription = description ?? bookConfig.description ?? '';
|
|
|
119
120
|
OG tags). sitemap link points at @astrojs/sitemap's auto-emitted
|
|
120
121
|
index. */}
|
|
121
122
|
<link rel="canonical" href={canonicalURL} />
|
|
122
|
-
<link rel="sitemap" type="application/xml" href=
|
|
123
|
+
<link rel="sitemap" type="application/xml" href={`${baseUrl}sitemap-index.xml`} />
|
|
123
124
|
<meta property="og:title" content={title} />
|
|
124
125
|
{ogDescription && <meta property="og:description" content={ogDescription} />}
|
|
125
126
|
<meta property="og:url" content={canonicalURL} />
|
|
@@ -150,7 +151,7 @@ const ogDescription = description ?? bookConfig.description ?? '';
|
|
|
150
151
|
{showToolsChrome && <ToolFilter client:idle />}
|
|
151
152
|
{showToolsChrome && <VersionSelector client:idle />}
|
|
152
153
|
<a
|
|
153
|
-
href=
|
|
154
|
+
href={`${baseUrl}search/`}
|
|
154
155
|
class="chrome-button"
|
|
155
156
|
aria-label="Search the book"
|
|
156
157
|
title="Search"
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brandon_m_behring/book-scaffold-astro",
|
|
3
3
|
"description": "Astro 6 + MDX toolkit for long-form technical books. Profile-aware (academic / tools / minimal); ships Tufte typography, KaTeX, BibTeX citations, Pagefind, Cloudflare Workers deploy. See PACKAGE_DESIGN.md for the API contract.",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.24.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Brandon Behring",
|