@brandon_m_behring/book-scaffold-astro 3.6.0 → 3.6.1
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/LATEX_TO_MDX_MAPPING.md
CHANGED
|
@@ -24,7 +24,7 @@ The scaffold ships **38 components**. Without this map, a `.tex → .mdx` conver
|
|
|
24
24
|
| `\begin{tipbox}` | `TipBox` | `…/components/TipBox.astro` | `title?: string` | Pro tips / shortcuts |
|
|
25
25
|
| `\begin{dynconnect}` | `DynConnect` | `…/components/DynConnect.astro` | `title?: string` | Cross-domain connection |
|
|
26
26
|
| `\begin{theorem}` / `\begin{proposition}` / `\begin{lemma}` / `\begin{corollary}` / `\begin{definition}` / `\begin{remark}` / `\begin{proof}` | `Theorem` | `…/components/Theorem.astro` | `kind, n?, name?, id?` | amsthm family — single component dispatches via `kind` prop |
|
|
27
|
-
| `\marginnote{}` | `MarginNote` | `…/components/MarginNote.astro` |
|
|
27
|
+
| `\marginnote{}` / `\marginnotebox{}` / `\marginwarning{}` / `\margintip{}` | `MarginNote` | `…/components/MarginNote.astro` | `variant?: 'note' \| 'warning' \| 'tip'; label?: string` | `\marginnotebox` → `variant="note"` (blue), `\marginwarning` → `variant="warning"` (rose), `\margintip` → `variant="tip"` (green). `label` overrides the variant's default badge text. Body has a 25-word soft cap. |
|
|
28
28
|
| `\sidenote{}` | `Sidenote` | `…/components/Sidenote.astro` | — | Auto-numbered marginalia (Tufte) |
|
|
29
29
|
| `\includegraphics + \caption` | `Figure` | `…/components/Figure.astro` | `src, caption?, id?` | XRef-registered |
|
|
30
30
|
| `\cite{}` / `\parencite{}` | `Citation` | `…/components/Citation.astro` | `src, as?` | Resolves `sources` collection |
|
|
@@ -41,6 +41,7 @@ Component subset table for tools-profile-specific UI (volatility dashboards, con
|
|
|
41
41
|
| Construct | Component | Use case |
|
|
42
42
|
|---|---|---|
|
|
43
43
|
| Volatility badge | `Tag` | `volatility` enum chip in chapter meta |
|
|
44
|
+
| Practice tag (`\official{}` / `\practitioner{}` / `\convergence{}`, also `\tagofficial{}` / `\tagpractitioner{}` / `\tagconvergence{}`) | `Tag` | `kind="official" \| "practitioner" \| "convergence"` — inline assertion of source authority. Both the bare and `\tag*` prefixed LaTeX forms map to the same component (see `package/components/Tag.astro`). |
|
|
44
45
|
| Tool comparison | `ToolFilter` (island) | Interactive comparison gate |
|
|
45
46
|
| Version selector | `VersionSelector` (island) | Switch between tool versions |
|
|
46
47
|
| Convergence event | `Convergence` | "All tools converged here" timeline marker |
|
package/components/XRef.astro
CHANGED
|
@@ -6,10 +6,19 @@
|
|
|
6
6
|
* (Phase 2.6). For each known id, the map provides:
|
|
7
7
|
* { href: "/chapters/week04#thm-w4-stability", display: "Theorem 4.2" }
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Runtime: renders `<a href>` for known ids; renders an inline `[?id]`
|
|
10
|
+
* placeholder for unknown ids so the Astro dev server stays running while
|
|
11
|
+
* chapters are being authored or labels are being added.
|
|
12
|
+
*
|
|
13
|
+
* CI: `book-scaffold validate` (Phase 2.6, shipped) catches unknown ids
|
|
14
|
+
* and **fails the build with a non-zero exit code** before unresolved
|
|
15
|
+
* placeholders can reach production. The placeholder is a dev-ergonomic
|
|
16
|
+
* affordance, not a soft-degradation path on the deploy critical line.
|
|
17
|
+
*
|
|
18
|
+
* Bootstrapping note: when porting a book chapter-by-chapter, early
|
|
19
|
+
* chapters that reference yet-to-be-ported targets need either plain-prose
|
|
20
|
+
* substitutes or a temporarily-commented `{/* <XRef …/> */}` until the
|
|
21
|
+
* target chapter (and its `id="…"` attributes) exists.
|
|
13
22
|
*
|
|
14
23
|
* Usage:
|
|
15
24
|
* By <XRef id="thm:w4:stability" />, the discretized eigenvalues …
|
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": "3.6.
|
|
4
|
+
"version": "3.6.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Brandon Behring",
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
**Profile**: any (the recipe picks one based on your answer below).
|
|
4
4
|
|
|
5
|
-
**TL;DR**: Pick a
|
|
5
|
+
**TL;DR**: Pick a preset (`academic` / `tools` / `minimal` / `course-notes` / `research-portfolio`). Set `BOOK_PROFILE` in your shell or `.env`. Edit content under `src/content/chapters/`. `npm run dev` to preview.
|
|
6
6
|
|
|
7
|
-
## 1. Choose a
|
|
7
|
+
## 1. Choose a preset
|
|
8
8
|
|
|
9
|
-
The scaffold ships
|
|
9
|
+
The scaffold ships **five presets** as of v3.5.0. `BOOK_PROFILE` (or its canonical alias `BOOK_PRESET`, v3.4.0+) is read at startup by `astro.config.mjs` and `src/content.config.ts`.
|
|
10
10
|
|
|
11
|
-
|
|
|
11
|
+
| Preset | Use when | Frontmatter schema | Default callouts | Math | Bibliography |
|
|
12
12
|
|---|---|---|---|---|---|
|
|
13
|
-
| `academic` | Textbook, research report, lecture notes | `week`, `part`(enum), `status`(7-state) | NoteBox, Theorem family, ExampleBox … | KaTeX with 36 macros | BibTeX → `src/data/references.json` |
|
|
13
|
+
| `academic` | Textbook, research report, lecture notes | `week`, `part`(enum), `status`(7-state) | NoteBox, Theorem family, ExampleBox … | KaTeX with 36 macros (consumer can extend via `katexMacros`, v3.6.0+) | BibTeX → `src/data/references.json` |
|
|
14
14
|
| `tools` | Comparative practitioner book (multiple tools tracked) | `chapter`, `part`(numeric), `volatility`, `tools_compared`, `sources` | SkillBox, KeyIdea, Convergence, Divergence … | off | YAML manifest at `sources/manifest.yaml` |
|
|
15
|
-
| `minimal` | Single-author manifesto, essays, mixed-form work | falls back to `tools` schema
|
|
15
|
+
| `minimal` | Single-author manifesto, essays, mixed-form work | falls back to `tools` schema | tools-family | off | manual references page |
|
|
16
|
+
| `course-notes` (v3.3.0, #4) | Course-derived study notes (DLAI, Coursera, Manning) | `chapter`+`part`(numeric), `course`, `instructor`, `learning_outcomes`, freeform `tags` | tools-family | off | freeform `sources` array |
|
|
17
|
+
| `research-portfolio` (v3.5.0, #6) | Research portfolio with mixed prose + experiments | optional `week` OR `chapter`, `status`, `freshness`(evidence-type enum), T1–T4 inline sources | both families | KaTeX on by default | structured inline `sources` (no separate collection) |
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
If unsure: pick `minimal` and switch later — schemas are forgiving as long as required fields are set.
|
|
18
20
|
|
|
19
21
|
## 2. Set the profile
|
|
20
22
|
|
|
@@ -40,7 +40,10 @@ Each batch of cross-consumer issues drives a minor toolkit release:
|
|
|
40
40
|
- **v3.0–v3.2** absorbed Phase B/C/D feedback from `post_transformers` + `book-template-astro`.
|
|
41
41
|
- **v3.3.0** closed 5 issues surfaced from the DLAI knowledge-graphs-rag pilot (course-notes profile + defineMdxComponents + per-route override + LaTeX migration doc).
|
|
42
42
|
- **v3.4.0** closed 8 more (preset vocabulary + propagation + frontmatter helper + validate root fix + CI hygiene + docs).
|
|
43
|
-
- **v3.5.0**
|
|
43
|
+
- **v3.5.0** added the `research-portfolio` preset (#6) driven by cross-repo coordination with [`prompt-injection-portfolio`](https://github.com/brandon-behring/prompt-injection-portfolio).
|
|
44
|
+
- **v3.5.2 / v3.5.3 / v3.6.0** (the [`double-ml-time-series`](https://github.com/brandon-behring/double-ml-time-series) pilot batch) closed three more issues surfaced within 24 hours of the first non-SSM academic book hitting the scaffold: `/chapters` schema-aware for academic profile (#24), `validate` honors `.env BOOK_PROFILE` (#20), and `katexMacros` extension point for non-SSM math notation (#22). Same release cycle introduced OIDC trusted publishing via [`.github/workflows/publish.yml`](../../.github/workflows/publish.yml).
|
|
45
|
+
|
|
46
|
+
The next consumer-pilot batch lands as v3.7+. File issues against [`brandon-behring/book-scaffold-astro`](https://github.com/brandon-behring/book-scaffold-astro/issues) tagged with `consumer:<your-book-name>` so the batching shows up in the issue tracker.
|
|
44
47
|
|
|
45
48
|
Profile-by-profile growth is the explicit strategy: the toolkit gets a new profile when a real consumer needs one, not before.
|
|
46
49
|
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Recipe 14 — Port a LaTeX book into the scaffold
|
|
2
|
+
|
|
3
|
+
**Profile**: typically `academic` (textbooks, research manuscripts). Adapt for `research-portfolio` if your LaTeX book also tracks freshness/volatility.
|
|
4
|
+
|
|
5
|
+
**TL;DR**: Bootstrap a `web/` subdirectory inside the LaTeX repo. Share the canonical `bibliography.bib` via `BOOK_BIB_PATH`. Smoke-test the bib pipeline *before* writing chapter content. Pick one chapter as the pilot; port it manually (do not script the conversion) so the friction surfaces. File each gap upstream the moment it surfaces — with a real receipt — and consume the fix via a `file:` dependency until it publishes. Defer chapters 2..N until the pilot ships.
|
|
6
|
+
|
|
7
|
+
See [`LATEX_TO_MDX_MAPPING.md`](../LATEX_TO_MDX_MAPPING.md) for the component-mapping reference table (which scaffold component replaces which LaTeX environment).
|
|
8
|
+
|
|
9
|
+
This recipe is the operational *process* that goes around that table.
|
|
10
|
+
|
|
11
|
+
## When to use this recipe
|
|
12
|
+
|
|
13
|
+
Use it when you already have a working LaTeX manuscript (`main.tex` + `chapters/*.tex` + `bibliography.bib`) and want a web companion that:
|
|
14
|
+
|
|
15
|
+
- Builds in parallel with the existing PDF build (you keep LaTeX canonical during the migration window).
|
|
16
|
+
- Reuses the same `bibliography.bib` so citations don't drift.
|
|
17
|
+
- Surfaces the friction points specific to your book so they become upstream improvements to the scaffold, not consumer-side workarounds that rot.
|
|
18
|
+
|
|
19
|
+
If you are *starting* a new book from scratch, prefer [Recipe 00](00-getting-started.md) — no LaTeX baggage to migrate.
|
|
20
|
+
|
|
21
|
+
## 1. Pre-flight (before any code)
|
|
22
|
+
|
|
23
|
+
These two steps are deliberately *not* code changes. They make the work inheritable across sessions and visible to collaborators.
|
|
24
|
+
|
|
25
|
+
### 1a. File a tracking issue in your LaTeX repo
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
gh issue create \
|
|
29
|
+
--repo <you>/<your-book> \
|
|
30
|
+
--label tracked --label P2 --label feature \
|
|
31
|
+
--title "pilot: port <your-book> to book-scaffold-astro" \
|
|
32
|
+
--body "Link to plan, acceptance bar (functional parity), upstream-first strategy"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The issue gives every commit a number to link back to, and shows up on cross-repo project boards.
|
|
36
|
+
|
|
37
|
+
### 1b. Record the strategic context
|
|
38
|
+
|
|
39
|
+
If you have a memory store (Claude `MEMORY.md`, Obsidian, etc.), note:
|
|
40
|
+
|
|
41
|
+
- The scaffold version you targeted (e.g. `^3.6.0`).
|
|
42
|
+
- The fact that you intend to file upstream issues as friction surfaces, *not* work around consumer-side.
|
|
43
|
+
- The pilot's acceptance bar — typically **functional parity** for one chapter: every LaTeX construct has a working MDX equivalent, visual styling may differ.
|
|
44
|
+
|
|
45
|
+
A future session (yours, or another author taking the same approach) inherits the strategy without re-discovering it.
|
|
46
|
+
|
|
47
|
+
## 2. Bootstrap a `web/` subdirectory
|
|
48
|
+
|
|
49
|
+
From inside your LaTeX repo root:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx @brandon_m_behring/create-book web --profile=academic
|
|
53
|
+
cd web && npm install
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
You will get 11 scaffolded files in `web/`. Edit these four immediately:
|
|
57
|
+
|
|
58
|
+
**`web/package.json`** — set the package name, and override `build:bib` so it consumes the canonical bibliography at the repo root:
|
|
59
|
+
|
|
60
|
+
```diff
|
|
61
|
+
- "name": "web",
|
|
62
|
+
+ "name": "my-book-web",
|
|
63
|
+
|
|
64
|
+
- "build:bib": "book-scaffold build-bib",
|
|
65
|
+
+ "build:bib": "BOOK_BIB_PATH=../bibliography.bib book-scaffold build-bib",
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**`web/astro.config.mjs`** — set the deploy URL and make the profile explicit (the env-driven fallback fails in Cloudflare's build container because `.env` is gitignored):
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
export default await defineBookConfig({
|
|
72
|
+
site: 'https://my-book.<your-cloudflare-account>.workers.dev',
|
|
73
|
+
profile: 'academic',
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**`web/src/content.config.ts`** — same reasoning: explicit `profile: 'academic'`.
|
|
78
|
+
|
|
79
|
+
**`web/wrangler.toml`** — Cloudflare project name.
|
|
80
|
+
|
|
81
|
+
Delete the scaffolded `web/bibliography.bib` placeholder (the `BOOK_BIB_PATH` override makes it dead weight).
|
|
82
|
+
|
|
83
|
+
## 3. Bib smoke test (before chapter content)
|
|
84
|
+
|
|
85
|
+
**Do not write a single line of MDX until the bibliography parses cleanly.** Bib bugs cascade into chapter content and are then conflated with "MDX problems."
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
cd web && npm run build:bib
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
You should see, e.g., `build-bib: 34 entries -> src/data/references.json`. Sanity-check the output:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Total entry count matches the raw .bib
|
|
95
|
+
jq 'keys | length' src/data/references.json
|
|
96
|
+
# Should equal: grep -c '^@' ../bibliography.bib
|
|
97
|
+
|
|
98
|
+
# Spot-check 5 entries: surname + year + title + container
|
|
99
|
+
jq '.["chernozhukov2018double"] | {author, "issued.date-parts": ."issued"."date-parts", title, "container-title"}' \
|
|
100
|
+
src/data/references.json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Watch for biblatex-only fields silently dropped (`date`, `journaltitle`, `eventtitle`), `[object Object]` artifacts, or UTF-8 mishandling (umlauts, em-dashes). If any entries mistranslate, that's your first organic upstream issue. File it with the failing entry as evidence, *then* keep going.
|
|
104
|
+
|
|
105
|
+
## 4. The inline-upstream-PR loop
|
|
106
|
+
|
|
107
|
+
The pilot's core discipline. Whenever the port surfaces real friction (a missing macro, a schema mismatch, a component gap, a crashing build):
|
|
108
|
+
|
|
109
|
+
1. **Stop the port.** Capture the receipt: the LaTeX snippet that's hard to translate + what the scaffold currently offers + the proposed API.
|
|
110
|
+
2. **File the issue** at `brandon-behring/book-scaffold-astro` with labels `consumer:<your-book>` + `kind:enhancement` / `kind:api-friction` / `kind:bug` / `kind:doc-drift`. Create labels if they don't exist.
|
|
111
|
+
3. **Implement the upstream PR.** Branch from `v3.0` (or the current dev branch), make the fix, run the scaffold's tests (`cd package && node --test tests/*.test.mjs`), bump the version, document in `CHANGELOG.md`. Add a regression test where one is missing.
|
|
112
|
+
4. **Consume the fix via a `file:` dependency** so the pilot is unblocked before the registry version exists:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
"dependencies": {
|
|
116
|
+
"@brandon_m_behring/book-scaffold-astro": "file:../../book-scaffold-astro/package"
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Run `npm install` again. The local scaffold's built `dist/` is what the consumer now resolves.
|
|
121
|
+
5. **Log it** in a running `web/UPSTREAM_ISSUES.md` — issue link, PR link, version bumped, receipt. Future sessions reading the log understand why the consumer carries any leftover workaround.
|
|
122
|
+
6. **Resume the port** using the now-fixed upstream API. Delete consumer-side workarounds that the upstream PR superseded — those deletions are part of the proof.
|
|
123
|
+
|
|
124
|
+
When the PR merges and the registry version publishes, swap the `file:` dependency back to `^<version>` and rerun `npm install`.
|
|
125
|
+
|
|
126
|
+
> **Triage rule.** If the upstream fix is small (one-line, one-file) and has a clear API, do steps 1–6 inline before the next chapter section. If it's large (cross-cutting, requires API design), file the issue with the receipt, fall back to a consumer-side workaround for the pilot, and mark the PR as Phase-2 work in `UPSTREAM_ISSUES.md`. The slow path is the point — the scaffold improves with every consumer book — but not at the cost of pilot momentum on a single bug.
|
|
127
|
+
|
|
128
|
+
## 5. Wire the build pipeline
|
|
129
|
+
|
|
130
|
+
Per [Recipe 09](09-validation.md), the scaffold ships `book-scaffold validate` to catch authoring errors (bad cite keys, dangling XRef ids, missing figure files). Wire it into `prebuild`:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
"scripts": {
|
|
134
|
+
"predev": "npm run build:bib && npm run build:labels --if-present",
|
|
135
|
+
"prebuild": "npm run build:bib && npm run build:labels --if-present && npm run validate --if-present",
|
|
136
|
+
"build:bib": "BOOK_BIB_PATH=../bibliography.bib book-scaffold build-bib",
|
|
137
|
+
"build:labels": "book-scaffold build-labels",
|
|
138
|
+
"validate": "book-scaffold validate",
|
|
139
|
+
"dev": "astro dev",
|
|
140
|
+
"build": "astro build && pagefind --site dist"
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Use `<XRef id="..." />` for cross-references from the first chapter onward — do not fall back to plain markdown anchors with the intent to "retrofit later." The retrofit is more expensive than wiring labels from the start.
|
|
145
|
+
|
|
146
|
+
## 6. Consumer-side KaTeX macros
|
|
147
|
+
|
|
148
|
+
If your LaTeX preamble defines `\newcommand{\Var}{\mathrm{Var}}` style shortcuts, list the *actually used* ones (not the full preamble!) in `astro.config.mjs`:
|
|
149
|
+
|
|
150
|
+
```js
|
|
151
|
+
katexMacros: {
|
|
152
|
+
'\\Var': '\\mathrm{Var}',
|
|
153
|
+
'\\Cov': '\\mathrm{Cov}',
|
|
154
|
+
// Add macros as the port surfaces real uses. Do not preemptively
|
|
155
|
+
// import every \newcommand from the LaTeX preamble.
|
|
156
|
+
},
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
`katexMacros` is shallow-merged on top of `ssmMacros`. Consumer wins on key collision. The scaffold runs KaTeX with `strict: 'error'`, so any undefined macro fails the build — a forcing function that keeps the macro set honest.
|
|
160
|
+
|
|
161
|
+
If you discover a macro pattern that's clearly cross-book (most causal-inference books need `\ate`, `\att`, `\cate`, `\propensity`; most RL books need `\bellman`, `\argmin`), that is an upstream-issue-worthy signal. File it and shift the consumer-side bridge to an upstream preset.
|
|
162
|
+
|
|
163
|
+
## 7. Pilot port
|
|
164
|
+
|
|
165
|
+
Pick one chapter — ideally Chapter 1, since later chapters depend on its conventions. Port manually.
|
|
166
|
+
|
|
167
|
+
**Manual is the point.** A scripted conversion (pandoc, custom AST walk) misses the friction. The friction is the deliverable.
|
|
168
|
+
|
|
169
|
+
For each LaTeX environment, consult [`LATEX_TO_MDX_MAPPING.md`](../LATEX_TO_MDX_MAPPING.md) and translate. A few hot-spots that consistently produce upstream issues:
|
|
170
|
+
|
|
171
|
+
- **Theorem numbering**. The scaffold's `<Theorem kind="theorem" n="1.3" name="...">` accepts manual `n=` until a counter API lands. Pass the number explicitly; do not assume auto-numbering. (This is open work — see [Recipe 09](09-validation.md) for current status.)
|
|
172
|
+
- **Margin notes**. Map `\marginnote[Title]{body}` → `<MarginNote title="Title">body</MarginNote>` and `\sidenote{...}` → `<Sidenote>...</Sidenote>`. Lean on `<MarginNote>` for Tufte sidebars; `<Sidenote>` is auto-numbered footnote-style.
|
|
173
|
+
- **Citations**. Map `\cite{key}` → `<Cite key="key" />`. The `<Cite>` component validates `key` against the parsed bibliography at build time — broken bibkeys fail `book-scaffold validate`.
|
|
174
|
+
- **Proof blocks**. `\begin{proof}…\end{proof}` → `<Theorem kind="proof">…</Theorem>`. Same component, different `kind`.
|
|
175
|
+
|
|
176
|
+
Frontmatter status: every chapter that already has prose + working code gets `status: implemented`. Do not invent finer-grained migration states (`status: porting` etc.) — if a real distinction emerges, file the upstream issue.
|
|
177
|
+
|
|
178
|
+
## 8. Verify the build
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
cd web
|
|
182
|
+
npm run build:bib && npm run build:labels && npx book-scaffold validate && npm run build
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Acceptance bar (recommended): **functional parity**.
|
|
186
|
+
|
|
187
|
+
- Every LaTeX construct in the pilot chapter has a working MDX equivalent.
|
|
188
|
+
- KaTeX strict mode passes — no undefined macros.
|
|
189
|
+
- Validate passes — no unknown cite keys, no dangling XRef ids, no missing figures.
|
|
190
|
+
- The Astro build produces the auto-injected routes (`/print`, `/references`, `/search`) and your chapter renders inside `/print`.
|
|
191
|
+
|
|
192
|
+
Visual styling may differ from the LaTeX PDF — the scaffold owns visual design; the pilot owns content fidelity.
|
|
193
|
+
|
|
194
|
+
## 9. Known pitfalls (from past pilots)
|
|
195
|
+
|
|
196
|
+
These are real friction discovered by consumer pilots. Some are fixed, some open.
|
|
197
|
+
|
|
198
|
+
### Academic profile and `routes.chapters`
|
|
199
|
+
|
|
200
|
+
The `defineBookConfig` option `routes: { chapters: true }` *appears* to opt an academic book into per-chapter URLs but currently crashes the build — the shipped `pages/chapters.astro` is hardcoded to the tools schema (`volatility`, `tools_compared`, `last_verified`, `chapter`). Track [issue #24](https://github.com/brandon-behring/book-scaffold-astro/issues/24). For now, the academic profile's chapter access point is `/print` (which aggregates all chapters into one Paged.js-friendly page).
|
|
201
|
+
|
|
202
|
+
### Scaffolded demo content is occasionally drifty
|
|
203
|
+
|
|
204
|
+
The `week01-hello-world.mdx` demo created by `create-book` ships with a placeholder cite (`example-key2024`) that's not in the placeholder bibliography. It also uses `<Theorem type="theorem">` (the deprecated prop name) instead of `<Theorem kind="theorem">`. Delete or rewrite the demo before running `validate` for the first time. If the drift recurs across versions, file a `kind:doc-drift` issue.
|
|
205
|
+
|
|
206
|
+
### `BOOK_PROFILE` and `.env`
|
|
207
|
+
|
|
208
|
+
`book-scaffold validate` reads `BOOK_PROFILE` from `.env` per [Issue #20](https://github.com/brandon-behring/book-scaffold-astro/issues/20), fixed in 3.5.2. If you see `profile=minimal` reported despite an academic `.env`, you're on an older scaffold version — upgrade or set the env var explicitly in your npm scripts.
|
|
209
|
+
|
|
210
|
+
### Bibkeys flagged as secrets
|
|
211
|
+
|
|
212
|
+
If your repo has a `gitleaks` pre-commit hook, BibTeX cite keys like `chernozhukov2018double` (high-entropy author-year strings) will trip the default `generic-api-key` rule. Add a repo-level `.gitleaks.toml`:
|
|
213
|
+
|
|
214
|
+
```toml
|
|
215
|
+
title = "my-book"
|
|
216
|
+
|
|
217
|
+
[extend]
|
|
218
|
+
useDefault = true
|
|
219
|
+
|
|
220
|
+
[allowlist]
|
|
221
|
+
description = "Human-authored chapter MDX and the BibTeX bibliography."
|
|
222
|
+
paths = [
|
|
223
|
+
'''web/src/content/.*\.mdx$''',
|
|
224
|
+
'''^bibliography\.bib$''',
|
|
225
|
+
]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Use the singular `[allowlist]` form (not the newer plural `[[allowlists]]`) — older gitleaks releases installed by `pre-commit` don't honor the plural syntax.
|
|
229
|
+
|
|
230
|
+
### `npm install` after `file:` dependency
|
|
231
|
+
|
|
232
|
+
When you switch `web/package.json` to `"@brandon_m_behring/book-scaffold-astro": "file:../../book-scaffold-astro/package"`, `npm install` resolves the local path. The scaffold's `dist/` must be present (run `npm run build` inside the scaffold once). When you later switch back to a registry version, run `npm install` again to drop the file resolution.
|
|
233
|
+
|
|
234
|
+
## 10. Phase 2: chapters 2..N
|
|
235
|
+
|
|
236
|
+
Only after the pilot ships:
|
|
237
|
+
|
|
238
|
+
- Has the manual port pace matched LaTeX authoring? If yes, green-light the full migration. If not, evaluate pandoc-assisted drafts as a 30% time saver on bulk prose; hand-edit minted blocks / margin notes / custom commands (pandoc mangles all three).
|
|
239
|
+
- Did upstream-first investment produce a net gain? It should: each PR makes the *next* chapter port cheaper.
|
|
240
|
+
- Are there scaffold gaps that still warrant inline PRs, or is the remaining work entirely consumer-side?
|
|
241
|
+
- Schema upgrades that were deferred during the pilot (e.g. parameterized `parts` per-book) ship now if they unblock chapter 2's frontmatter.
|
|
242
|
+
|
|
243
|
+
## See also
|
|
244
|
+
|
|
245
|
+
- [Recipe 00 — Getting started](00-getting-started.md) — for new books, not migrations.
|
|
246
|
+
- [Recipe 01 — Add math](01-add-math.md) — KaTeX details + the `katexMacros` consumer option.
|
|
247
|
+
- [Recipe 02 — Bibliography pipeline](02-bibliography-pipeline.md) — `BOOK_BIB_PATH`, `build-bib`, `<Cite>`.
|
|
248
|
+
- [Recipe 09 — Validation](09-validation.md) — `book-scaffold validate` and its checks.
|
|
249
|
+
- [Recipe 12 — Where to file issues](12-where-to-file-issues.md) — consumer-pilot issue template.
|
|
250
|
+
- [`LATEX_TO_MDX_MAPPING.md`](../LATEX_TO_MDX_MAPPING.md) — component mapping reference card.
|
package/recipes/README.md
CHANGED
|
@@ -17,6 +17,9 @@ Terse pointers into canonical code for the most common book-authoring workflows.
|
|
|
17
17
|
| 08 | [Decisions ledger](08-decisions-ledger.md) | any | 15 design decisions explained |
|
|
18
18
|
| 09 | [Pre-flight validation](09-validation.md) | any | `validate.mjs` catches bibkey/XRef/Figure typos |
|
|
19
19
|
| 10 | [Custom domain](10-custom-domain.md) | any | Cloudflare dashboard, apex vs subdomain |
|
|
20
|
+
| 12 | [Where to file issues](12-where-to-file-issues.md) | any | Consumer-pilot issue template, label conventions |
|
|
21
|
+
| 13 | [Research-portfolio getting started](13-research-portfolio-getting-started.md) | research-portfolio | When to use the preset, frontmatter shape, the 4 new components |
|
|
22
|
+
| 14 | [Port a LaTeX book](14-port-latex-book.md) | typically academic | Operational playbook for porting an existing LaTeX manuscript — bib sharing, inline-upstream-PR loop, common pitfalls |
|
|
20
23
|
|
|
21
24
|
## How to read recipes
|
|
22
25
|
|