@brandon_m_behring/book-scaffold-astro 3.1.0 → 3.2.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/ChapterHeader.astro +31 -32
- package/package.json +1 -1
- package/styles/chapter.css +23 -0
|
@@ -9,9 +9,15 @@
|
|
|
9
9
|
* part, status, companion artifacts) appears in its place.
|
|
10
10
|
*
|
|
11
11
|
* v3.1.0 — academic flavor: Roman-numeral part labels, StatusBadge
|
|
12
|
-
* component, and an optional companion-artifacts block
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* component, and an optional companion-artifacts block.
|
|
13
|
+
*
|
|
14
|
+
* v3.2.0 — companions refactored from sibling <aside> to inline <span>
|
|
15
|
+
* elements inside the existing .chapter-meta flex row. v3.1.0 shipped
|
|
16
|
+
* <aside class="chapter-companions"> with no CSS; UA-default <ul> block
|
|
17
|
+
* layout added ~100px height at <=1280px, producing a uniform vertical
|
|
18
|
+
* pixel shift on all academic chapters. Inline rendering eliminates the
|
|
19
|
+
* extra block by construction. The data-companion attribute on each
|
|
20
|
+
* inline span preserves introspection.
|
|
15
21
|
*/
|
|
16
22
|
import type { CollectionEntry } from 'astro:content';
|
|
17
23
|
import { getFreshness, freshnessLabel } from '../src/lib/freshness';
|
|
@@ -92,13 +98,14 @@ const volatility = typeof d.volatility === 'string' ? d.volatility : null;
|
|
|
92
98
|
// generic basename strip so any book whose render-notebooks output lands
|
|
93
99
|
// under public/notebooks/ gets a correct deep link (v2.0 hardcoded a
|
|
94
100
|
// post_transformers-specific prefix; v3.1.0 generalizes).
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
//
|
|
102
|
+
// v3.2.0: each companion renders as an inline <span class="chapter-companion">
|
|
103
|
+
// inside .chapter-meta — no sibling <aside>, no <ul>, no "Companion artifacts:"
|
|
104
|
+
// label. Zero added vertical height vs v2.0.
|
|
105
|
+
const codePath = hasAcademicMeta && typeof d.code_path === 'string' ? d.code_path : null;
|
|
106
|
+
const testsPath = hasAcademicMeta && typeof d.tests_path === 'string' ? d.tests_path : null;
|
|
100
107
|
const notebookHtmlPath =
|
|
101
|
-
typeof d.notebook_path === 'string'
|
|
108
|
+
hasAcademicMeta && typeof d.notebook_path === 'string'
|
|
102
109
|
? `/notebooks/${(d.notebook_path as string)
|
|
103
110
|
.replace(/^.*\//, '')
|
|
104
111
|
.replace(/\.ipynb$/, '')}.html`
|
|
@@ -126,33 +133,25 @@ const notebookHtmlPath =
|
|
|
126
133
|
</span>
|
|
127
134
|
)}
|
|
128
135
|
{updated && <span>Updated {formatDate(updated)}</span>}
|
|
136
|
+
{codePath && (
|
|
137
|
+
<span class="chapter-companion" data-companion="code">
|
|
138
|
+
<CodeRef path={codePath} />
|
|
139
|
+
</span>
|
|
140
|
+
)}
|
|
141
|
+
{testsPath && (
|
|
142
|
+
<span class="chapter-companion" data-companion="tests">
|
|
143
|
+
<CodeRef path={testsPath} />
|
|
144
|
+
</span>
|
|
145
|
+
)}
|
|
146
|
+
{notebookHtmlPath && (
|
|
147
|
+
<span class="chapter-companion" data-companion="notebook">
|
|
148
|
+
<a href={notebookHtmlPath}>Notebook</a>
|
|
149
|
+
</span>
|
|
150
|
+
)}
|
|
129
151
|
</div>
|
|
130
152
|
<h1>{title}</h1>
|
|
131
153
|
{description && <p class="chapter-description">{description}</p>}
|
|
132
154
|
|
|
133
|
-
{hasCompanions && (
|
|
134
|
-
<aside class="chapter-companions">
|
|
135
|
-
<strong>Companion artifacts:</strong>
|
|
136
|
-
<ul>
|
|
137
|
-
{typeof d.code_path === 'string' && (
|
|
138
|
-
<li>
|
|
139
|
-
Implementation: <CodeRef path={d.code_path as string} />
|
|
140
|
-
</li>
|
|
141
|
-
)}
|
|
142
|
-
{typeof d.tests_path === 'string' && (
|
|
143
|
-
<li>
|
|
144
|
-
Tests: <CodeRef path={d.tests_path as string} />
|
|
145
|
-
</li>
|
|
146
|
-
)}
|
|
147
|
-
{notebookHtmlPath && (
|
|
148
|
-
<li>
|
|
149
|
-
Notebook: <a href={notebookHtmlPath}>{notebookHtmlPath}</a>
|
|
150
|
-
</li>
|
|
151
|
-
)}
|
|
152
|
-
</ul>
|
|
153
|
-
</aside>
|
|
154
|
-
)}
|
|
155
|
-
|
|
156
155
|
{hasToolsMeta && volatility && (
|
|
157
156
|
<div class="chapter-badge-row">
|
|
158
157
|
<span class="chapter-badge-row-label">Volatility:</span>
|
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.
|
|
4
|
+
"version": "3.2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Brandon Behring",
|
package/styles/chapter.css
CHANGED
|
@@ -38,6 +38,29 @@
|
|
|
38
38
|
font-size: 0.75em;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/* Inline companion-artifact chips inside .chapter-meta.
|
|
42
|
+
* v3.2.0: structural inline rendering. Previous v3.1.0 emitted a sibling
|
|
43
|
+
* <aside class="chapter-companions"><ul>...</ul></aside> with no CSS
|
|
44
|
+
* coverage; UA-default block layout added ~100px height at <=1280px,
|
|
45
|
+
* producing a uniform vertical pixel shift on academic chapter pages
|
|
46
|
+
* vs the v2.0 baseline. The inline span here adds zero block height by
|
|
47
|
+
* construction; styling matches the surrounding .chapter-meta spans. */
|
|
48
|
+
.chapter-companion {
|
|
49
|
+
font-family: var(--font-code);
|
|
50
|
+
font-size: var(--text-sm);
|
|
51
|
+
color: var(--color-text-muted);
|
|
52
|
+
}
|
|
53
|
+
.chapter-companion a,
|
|
54
|
+
.chapter-companion code {
|
|
55
|
+
color: inherit;
|
|
56
|
+
text-decoration: none;
|
|
57
|
+
border-bottom: 1px dotted var(--color-border);
|
|
58
|
+
}
|
|
59
|
+
.chapter-companion a:hover {
|
|
60
|
+
color: var(--color-link);
|
|
61
|
+
border-bottom-style: solid;
|
|
62
|
+
}
|
|
63
|
+
|
|
41
64
|
/* Volatility + tool badges: reuse .tool-badge from callouts.css */
|
|
42
65
|
.volatility-badge {
|
|
43
66
|
display: inline-block;
|