@luhtech/site-template 0.14.3 → 0.14.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luhtech/site-template",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
4
4
  "description": "Shared Astro component library + content-instance contract for LuhTech venture marketing sites -- one template renders every site from content/page.schema.json + content/site.schema.json instances.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "luhtech": {
50
50
  "schemaPins": {
51
- "content/page.schema.json": "2.1.0",
51
+ "content/page.schema.json": "2.2.0",
52
52
  "content/site.schema.json": "1.1.0",
53
53
  "content/capability-claim.schema.json": "0.2.0",
54
54
  "content/tool.schema.json": "1.1.0",
@@ -31,6 +31,7 @@
31
31
  // small external-link marker, the "nice links" treatment.
32
32
  import Diagram from './Diagram.astro';
33
33
  import Icon from './Icon.astro';
34
+ import { formatInlineMarkdown } from '../lib/formatInlineMarkdown';
34
35
 
35
36
  export interface Props {
36
37
  block: { blockType: string; text?: string; label?: string; href?: string; diagramId?: string; src?: string; alt?: string; caption?: string; name?: string; title?: string };
@@ -41,6 +42,11 @@ export interface Props {
41
42
  }
42
43
  const { block, diagrams = [], class: className = '' } = Astro.props;
43
44
  const items = block.blockType === 'list' ? (block.text ?? '').split('\n').filter(Boolean) : [];
45
+ // d-2026-09-16-sr-inline-markdown-rendering: every text-bearing block type
46
+ // gets real **bold**/_italic_/[link](url) rendering instead of literal
47
+ // markdown characters -- see formatInlineMarkdown's own doc comment for
48
+ // the real live bug this closes.
49
+ const text = block.text ? formatInlineMarkdown(block.text) : '';
44
50
  const isExternalLink = typeof block.href === 'string' && block.href.startsWith('https://');
45
51
  const Wrapper = block.href ? 'a' : Fragment;
46
52
  const wrapperProps = block.href
@@ -62,33 +68,33 @@ if (block.blockType === 'diagram') {
62
68
  {block.blockType === 'paragraph' && (
63
69
  <div class={className}>
64
70
  {block.label && <p class="font-display font-semibold text-accent-secondary mb-1">{block.label}</p>}
65
- <p class="leading-relaxed">{block.text}</p>
71
+ <p class="leading-relaxed" set:html={text} />
66
72
  </div>
67
73
  )}
68
- {block.blockType === 'lede' && <p class={`text-lg leading-relaxed ${className}`}>{block.text}</p>}
74
+ {block.blockType === 'lede' && <p class={`text-lg leading-relaxed ${className}`} set:html={text} />}
69
75
  {block.blockType === 'pullquote' && (
70
- <blockquote class={`border-l-4 border-accent-primary pl-4 italic text-lg ${className}`}>{block.text}</blockquote>
76
+ <blockquote class={`border-l-4 border-accent-primary pl-4 italic text-lg ${className}`} set:html={text} />
71
77
  )}
72
78
  {block.blockType === 'definition' && (
73
79
  <div class={className}>
74
80
  {block.label && <dt class="font-semibold">{block.label}</dt>}
75
- <dd class="leading-relaxed">{block.text}</dd>
81
+ <dd class="leading-relaxed" set:html={text} />
76
82
  </div>
77
83
  )}
78
- {block.blockType === 'caption' && <p class={`text-sm text-ink/60 ${className}`}>{block.text}</p>}
84
+ {block.blockType === 'caption' && <p class={`text-sm text-ink/60 ${className}`} set:html={text} />}
79
85
  {block.blockType === 'list' && (
80
86
  <div class={className}>
81
87
  {block.label && <p class="font-display font-semibold mb-1">{block.label}</p>}
82
88
  <ul class="list-disc list-inside space-y-1">
83
- {items.map((item) => <li>{item}</li>)}
89
+ {items.map((item) => <li set:html={formatInlineMarkdown(item)} />)}
84
90
  </ul>
85
91
  </div>
86
92
  )}
87
93
  {block.blockType === 'stat' && (
88
- <p class={`font-display text-xl font-semibold text-accent-primary bg-accent-primary/5 rounded-md px-4 py-3 ${className}`}>{block.text}</p>
94
+ <p class={`font-display text-xl font-semibold text-accent-primary bg-accent-primary/5 rounded-md px-4 py-3 ${className}`} set:html={text} />
89
95
  )}
90
96
  {block.blockType === 'close' && (
91
- <p class={`leading-relaxed border-t border-ink/10 pt-6 ${className}`}>{block.text}</p>
97
+ <p class={`leading-relaxed border-t border-ink/10 pt-6 ${className}`} set:html={text} />
92
98
  )}
93
99
  {block.blockType === 'diagram' && resolvedDiagram && <Diagram diagram={resolvedDiagram} class={`my-8 ${className}`} />}
94
100
  {block.blockType === 'image' && (
@@ -111,7 +117,7 @@ if (block.blockType === 'diagram') {
111
117
  {block.title && <p class="text-sm text-accent-secondary font-mono uppercase tracking-wide">{block.title}</p>}
112
118
  </div>
113
119
  </div>
114
- <p class="text-sm text-ink/80 leading-relaxed">{block.text}</p>
120
+ <p class="text-sm text-ink/80 leading-relaxed" set:html={text} />
115
121
  </div>
116
122
  )}
117
123
  {isExternalLink && (
@@ -6,6 +6,7 @@
6
6
  import RingComparison from './diagrams/RingComparison.astro';
7
7
  import VectorSum from './diagrams/VectorSum.astro';
8
8
  import DataLineChart from './diagrams/DataLineChart.astro';
9
+ import ConnectionGraph from './diagrams/ConnectionGraph.astro';
9
10
 
10
11
  export interface Props {
11
12
  diagram: { diagramId: string; diagramType: string; caption?: string; data: any };
@@ -19,5 +20,8 @@ const { diagram, class: className = 'my-8' } = Astro.props;
19
20
  {diagram.diagramType === 'data-line-chart' && (
20
21
  <DataLineChart points={diagram.data.points} xLabel={diagram.data.xLabel} yLabel={diagram.data.yLabel} annotations={diagram.data.annotations} />
21
22
  )}
23
+ {diagram.diagramType === 'connection-graph' && (
24
+ <ConnectionGraph diagramId={diagram.diagramId} nodes={diagram.data.nodes} edges={diagram.data.edges} />
25
+ )}
22
26
  {diagram.caption && <figcaption class="text-sm text-ink/60 mt-2 text-center">{diagram.caption}</figcaption>}
23
27
  </figure>
@@ -62,8 +62,14 @@ export interface Props {
62
62
  toolSubmitEndpoint?: string;
63
63
  route?: string;
64
64
  ventureRef?: string;
65
+ // d-2026-09-16-bt-article-section-split: which heading level THIS
66
+ // article-kind section renders at -- a page can now carry several in
67
+ // sequence (one per real sub-heading the source article had), and only
68
+ // the first is the page's real H1. Same passthrough shape as the
69
+ // tool-related props above; every other sectionKind ignores it.
70
+ headingLevel?: 'h1' | 'h2';
65
71
  }
66
- const { section, site, companyLabel, icons, tool, toolSubmitEndpoint, route, ventureRef } = Astro.props;
72
+ const { section, site, companyLabel, icons, tool, toolSubmitEndpoint, route, ventureRef, headingLevel } = Astro.props;
67
73
  const Component = SECTION_COMPONENTS[section.sectionKind];
68
74
  if (!Component) {
69
75
  throw new Error(`Section.astro: unknown sectionKind "${section.sectionKind}" (id: ${section.sectionId})`);
@@ -72,7 +78,7 @@ if (!Component) {
72
78
  {section.sectionKind === 'cta' ? (
73
79
  <Cta section={section} leadCapture={site?.leadCapture} companyLabel={companyLabel} icons={icons} />
74
80
  ) : section.sectionKind === 'article' ? (
75
- <Component section={section} icons={icons} tool={tool} toolSubmitEndpoint={toolSubmitEndpoint} route={route} ventureRef={ventureRef} />
81
+ <Component section={section} icons={icons} tool={tool} toolSubmitEndpoint={toolSubmitEndpoint} route={route} ventureRef={ventureRef} headingLevel={headingLevel} />
76
82
  ) : (
77
83
  <Component section={section} icons={icons} />
78
84
  )}
@@ -0,0 +1,240 @@
1
+ ---
2
+ // d-2026-09-15-eb-platform-page-connection-diagram (C5, canonical-connection
3
+ // arc). A real node-and-edge relationship graph -- "what attaches to what" --
4
+ // distinct from RingComparison/VectorSum/DataLineChart, which all encode a
5
+ // single numeric comparison, not a structural relationship. Computed at
6
+ // build time (Astro frontmatter, server-side), matching RingComparison's
7
+ // own convention: the graph shape is fixed at author time, not user-editable.
8
+ //
9
+ // Layout: a longest-path layered (Sugiyama-style) DAG layout, generic over
10
+ // any real nodes[]/edges[] input -- not hand-tuned to one graph. Self-loops
11
+ // (a node citing itself, e.g. "a decision supersedes a decision") are
12
+ // excluded from layering and drawn as a small loop above the node instead.
13
+ export interface Node {
14
+ id: string;
15
+ label: string;
16
+ sub?: string;
17
+ hub?: boolean;
18
+ rail?: boolean;
19
+ }
20
+ export interface Edge {
21
+ from: string;
22
+ to: string;
23
+ label?: string;
24
+ }
25
+ export interface Props {
26
+ diagramId: string;
27
+ nodes: Node[];
28
+ edges: Edge[];
29
+ class?: string;
30
+ }
31
+ const { diagramId, nodes, edges, class: className = 'w-full h-auto' } = Astro.props;
32
+
33
+ const selfLoops = edges.filter((e) => e.from === e.to);
34
+ const crossEdges = edges.filter((e) => e.from !== e.to);
35
+
36
+ // Longest-path layering: layer(n) = 0 if no incoming cross-edge, else
37
+ // 1 + max(layer(source)) over incoming edges. Iterative relaxation with a
38
+ // bounded pass count (nodes.length) makes this safe even if the real data
39
+ // ever contains a longer cycle than a self-loop -- it converges to a stable
40
+ // (if imperfect) layering rather than looping forever.
41
+ const layer = new Map<string, number>(nodes.map((n) => [n.id, 0]));
42
+ for (let pass = 0; pass < nodes.length + 1; pass++) {
43
+ let changed = false;
44
+ for (const e of crossEdges) {
45
+ const want = (layer.get(e.from) ?? 0) + 1;
46
+ if (want > (layer.get(e.to) ?? 0)) {
47
+ layer.set(e.to, want);
48
+ changed = true;
49
+ }
50
+ }
51
+ if (!changed) break;
52
+ }
53
+
54
+ const maxLayer = Math.max(...Array.from(layer.values()), 0);
55
+ const columns: Node[][] = Array.from({ length: maxLayer + 1 }, () => []);
56
+ for (const n of nodes) columns[layer.get(n.id) ?? 0].push(n);
57
+
58
+ const NODE_W = 148;
59
+ const NODE_H = 56;
60
+ const ROW_GAP = 28;
61
+ const PAD = 24;
62
+ // COL_GAP must fit the longest cross-column edge label or the label
63
+ // overlaps both the node it leaves and the node it enters -- found live:
64
+ // "resolve to the cells they occupy" (33 chars) collided with both
65
+ // "Elements" and "The place" at a fixed 96px gap. ~5.4px/char is a safe
66
+ // upper-bound width estimate for JetBrains Mono at font-size 9 (no real
67
+ // text-measurement available at build time); same-column (bow) edges and
68
+ // self-loops don't consume COL_GAP, so only cross-column labels count.
69
+ const longestCrossLabel = Math.max(0, ...crossEdges.filter((e) => e.label).map((e) => e.label!.length));
70
+ const COL_GAP = Math.max(96, longestCrossLabel * 5.4 + 24);
71
+ // A node's own label/sub can be wider than NODE_W (centered text overflows
72
+ // evenly on both sides) -- for a node in the first or last column, that
73
+ // overflow can extend past the SVG's own viewBox edge and get clipped by
74
+ // the SVG itself, not just visually crowded. Found live: "Documents"'s sub
75
+ // "RFI · CO · submittal · drawing rev · BCF" (41 chars) overflowed ~36px
76
+ // past NODE_W/2 in column 0, landing at a negative x and losing its
77
+ // leading "RF" off the left edge of the canvas. Same char-width-estimate
78
+ // approach as COL_GAP above: Inter 600 12.5px runs wider per character
79
+ // than JetBrains Mono 9px, so it gets its own (more generous) rate.
80
+ const maxLabelOverflow = Math.max(
81
+ 0,
82
+ ...nodes.map((n) => (n.label.length * 7.3 - NODE_W) / 2),
83
+ ...nodes.map((n) => (n.sub ? (n.sub.length * 5.4 - NODE_W) / 2 : 0)),
84
+ );
85
+ const PAD_X = PAD + Math.ceil(Math.max(0, maxLabelOverflow)) + 8;
86
+ // A self-loop draws its arc above the node and its label above the arc --
87
+ // both need real vertical room, not just PAD, or they render past y=0 and
88
+ // clip outside the viewBox (found live: the decision-supersedes-decision
89
+ // loop landed at y=-8, invisible in the built page). Reserved only when
90
+ // the graph actually has a self-loop, so every other diagram's canvas
91
+ // stays exactly as tight as before.
92
+ const LOOP_ROOM = selfLoops.length > 0 ? 40 : 0;
93
+ const topPad = PAD + LOOP_ROOM;
94
+
95
+ const maxRows = Math.max(...columns.map((c) => c.length), 1);
96
+ const colHeight = maxRows * NODE_H + (maxRows - 1) * ROW_GAP;
97
+
98
+ type Placed = Node & { x: number; y: number; cx: number; cy: number };
99
+ const positions = new Map<string, Placed>();
100
+ columns.forEach((col, ci) => {
101
+ const colH = col.length * NODE_H + (col.length - 1) * ROW_GAP;
102
+ const yOffset = topPad + (colHeight - colH) / 2;
103
+ col.forEach((n, ri) => {
104
+ const x = PAD_X + ci * (NODE_W + COL_GAP);
105
+ const y = yOffset + ri * (NODE_H + ROW_GAP);
106
+ positions.set(n.id, { ...n, x, y, cx: x + NODE_W / 2, cy: y + NODE_H / 2 });
107
+ });
108
+ });
109
+
110
+ const width = PAD_X * 2 + (maxLayer + 1) * NODE_W + maxLayer * COL_GAP;
111
+ const height = topPad + PAD + colHeight;
112
+
113
+ // Cubic bezier from the right edge of `from` to the left edge of `to`
114
+ // (forward, cross-column edges), or a vertical bow between two nodes in
115
+ // the same column (a same-layer edge, e.g. cell -> ledger when both land
116
+ // in a late layer) -- a straight line between stacked nodes would pass
117
+ // straight through any node placed between them.
118
+ function edgePath(from: Placed, to: Placed): string {
119
+ if (from.x === to.x) {
120
+ const x1 = from.cx + NODE_W / 2 + 2;
121
+ const y1 = from.cy;
122
+ const x2 = to.cx + NODE_W / 2 + 2;
123
+ const y2 = to.cy;
124
+ const bow = 36;
125
+ return `M ${x1} ${y1} C ${x1 + bow} ${y1}, ${x2 + bow} ${y2}, ${x2} ${y2}`;
126
+ }
127
+ const x1 = from.x + NODE_W;
128
+ const y1 = from.cy;
129
+ const x2 = to.x;
130
+ const y2 = to.cy;
131
+ const mx = (x1 + x2) / 2;
132
+ return `M ${x1} ${y1} C ${mx} ${y1}, ${mx} ${y2}, ${x2} ${y2}`;
133
+ }
134
+
135
+ const drawnCrossEdges = crossEdges
136
+ .map((e) => {
137
+ const from = positions.get(e.from);
138
+ const to = positions.get(e.to);
139
+ if (!from || !to) return null;
140
+ return { ...e, from, to, path: edgePath(from, to) };
141
+ })
142
+ .filter((e): e is NonNullable<typeof e> => e !== null);
143
+
144
+ const drawnSelfLoops = selfLoops
145
+ .map((e) => {
146
+ const at = positions.get(e.from);
147
+ if (!at) return null;
148
+ const x = at.cx;
149
+ const yTop = at.y;
150
+ const r = 16;
151
+ const path = `M ${x - 10} ${yTop} C ${x - 10} ${yTop - r * 2}, ${x + 10} ${yTop - r * 2}, ${x + 10} ${yTop}`;
152
+ return { ...e, x, y: yTop - r * 2 - 6, path };
153
+ })
154
+ .filter((e): e is NonNullable<typeof e> => e !== null);
155
+
156
+ const markerId = `cg-arrow-${diagramId}`;
157
+ const ariaLabel = `Connection graph: ${nodes.length} nodes -- ${nodes.map((n) => n.label).join(', ')}. ${edges.length} relationships: ${edges
158
+ .map((e) => `${nodes.find((n) => n.id === e.from)?.label ?? e.from} to ${nodes.find((n) => n.id === e.to)?.label ?? e.to}${e.label ? ` (${e.label})` : ''}`)
159
+ .join('; ')}.`;
160
+ ---
161
+ <svg
162
+ xmlns="http://www.w3.org/2000/svg"
163
+ viewBox={`0 0 ${width} ${height}`}
164
+ class={className}
165
+ role="img"
166
+ aria-label={ariaLabel}
167
+ >
168
+ <defs>
169
+ <marker id={markerId} markerWidth="8" markerHeight="8" refX="6" refY="3" orient="auto" markerUnits="strokeWidth">
170
+ <path d="M0,0 L0,6 L6,3 z" fill="currentColor" fill-opacity="0.55" />
171
+ </marker>
172
+ </defs>
173
+
174
+ {drawnCrossEdges.map((e) => (
175
+ <g class="text-ink/50">
176
+ <path d={e.path} fill="none" stroke="currentColor" stroke-width="1.25" stroke-opacity="0.4" marker-end={`url(#${markerId})`} />
177
+ {e.label && (
178
+ <text
179
+ x={(e.from.x + NODE_W + e.to.x) / 2}
180
+ y={(e.from.cy + e.to.cy) / 2 - 5}
181
+ text-anchor="middle"
182
+ font-family="JetBrains Mono, monospace"
183
+ font-size="9"
184
+ fill="currentColor"
185
+ fill-opacity="0.65"
186
+ >{e.label}</text>
187
+ )}
188
+ </g>
189
+ ))}
190
+
191
+ {drawnSelfLoops.map((e) => (
192
+ <g class="text-ink/50">
193
+ <path d={e.path} fill="none" stroke="currentColor" stroke-width="1.25" stroke-opacity="0.4" marker-end={`url(#${markerId})`} />
194
+ {e.label && (
195
+ <text x={e.x} y={e.y - 5} text-anchor="middle" font-family="JetBrains Mono, monospace" font-size="9" fill="currentColor" fill-opacity="0.65">{e.label}</text>
196
+ )}
197
+ </g>
198
+ ))}
199
+
200
+ {Array.from(positions.values()).map((n) => (
201
+ <g>
202
+ <rect
203
+ x={n.x}
204
+ y={n.y}
205
+ width={NODE_W}
206
+ height={NODE_H}
207
+ rx={n.rail ? 6 : 10}
208
+ class={n.hub ? 'text-accent-primary' : 'text-ink'}
209
+ fill="currentColor"
210
+ fill-opacity={n.hub ? 0.14 : 0.04}
211
+ stroke="currentColor"
212
+ stroke-opacity={n.hub ? 0.7 : 0.35}
213
+ stroke-width={n.hub ? 2 : 1.25}
214
+ stroke-dasharray={n.rail ? '3 3' : undefined}
215
+ />
216
+ <text
217
+ x={n.cx}
218
+ y={n.sub ? n.cy - 5 : n.cy + 4}
219
+ text-anchor="middle"
220
+ font-family="Inter, sans-serif"
221
+ font-weight="600"
222
+ font-size="12.5"
223
+ fill="currentColor"
224
+ class="text-ink"
225
+ >{n.label}</text>
226
+ {n.sub && (
227
+ <text
228
+ x={n.cx}
229
+ y={n.cy + 13}
230
+ text-anchor="middle"
231
+ font-family="JetBrains Mono, monospace"
232
+ font-size="9"
233
+ fill="currentColor"
234
+ fill-opacity="0.55"
235
+ class="text-ink"
236
+ >{n.sub}</text>
237
+ )}
238
+ </g>
239
+ ))}
240
+ </svg>
@@ -8,15 +8,32 @@
8
8
  // silently. Same fix shape as Section.astro's own crossLinks[] fix
9
9
  // (see that file's comment): a documented, schema-legal mechanism that
10
10
  // one section-kind component had quietly never wired up.
11
+ //
12
+ // diagrams pass-through (d-2026-09-15-eb-platform-page-connection-diagram,
13
+ // C5 of canonical-connection): Article.astro already passes section.diagrams
14
+ // into Block (and renders any diagram not referenced by a block, in its own
15
+ // fallback strip) -- Approach.astro never did either, so a page.schema.json
16
+ // mustCarry:"diagram" approach section (e.g. page-platform.json's own
17
+ // template) crashed the build the moment it actually carried one: Block.astro
18
+ // throws when a diagram-type block's diagramId can't resolve against an
19
+ // empty diagrams[] default. Same fix, same fallback-strip shape as Article.astro.
11
20
  import Block from '../Block.astro';
21
+ import Diagram from '../Diagram.astro';
12
22
  import SectionHeading from '../SectionHeading.astro';
13
23
  import type { SectionIcons } from '../Section.astro';
14
24
 
15
25
  export interface Props { section: any; icons?: SectionIcons }
16
26
  const { section, icons } = Astro.props;
17
27
  const sectionIcon = icons?.section?.[section.sectionId];
28
+ const referencedDiagramIds = new Set((section.blocks ?? []).filter((b: any) => b.blockType === 'diagram').map((b: any) => b.diagramId));
29
+ const unreferencedDiagrams = (section.diagrams ?? []).filter((d: any) => !referencedDiagramIds.has(d.diagramId));
18
30
  ---
19
31
  <section id={section.sectionId} class="py-8" data-reveal>
20
32
  <SectionHeading eyebrow={section.eyebrow} heading={section.heading} subheading={section.subheading} icon={sectionIcon} />
21
- {section.blocks?.map((b: any) => <Block block={b} class="mb-3" />)}
33
+ {section.blocks?.map((b: any) => <Block block={b} diagrams={section.diagrams} class="mb-3" />)}
34
+ {unreferencedDiagrams.length > 0 && (
35
+ <div class="space-y-8 mt-8">
36
+ {unreferencedDiagrams.map((d: any) => <Diagram diagram={d} />)}
37
+ </div>
38
+ )}
22
39
  </section>
@@ -30,18 +30,27 @@ export interface Props {
30
30
  toolSubmitEndpoint?: string;
31
31
  route?: string;
32
32
  ventureRef?: string;
33
+ // d-2026-09-16-bt-article-section-split: an article bridged onto a page
34
+ // now lands as MULTIPLE sectionKind:"article" entries (one per real
35
+ // ## heading the source article's ::section chunks carried, previously
36
+ // flattened into one giant section's blocks[] -- see venture_site.py's
37
+ // own history for why). Only the page's own title section is the real
38
+ // H1; every subsequent article section is a real H2 under it. Defaults
39
+ // to 'h1' so a genuinely single-section article page (or any other
40
+ // caller from before this split existed) renders exactly as before.
41
+ headingLevel?: 'h1' | 'h2';
33
42
  }
34
- const { section, tool, toolSubmitEndpoint, route, ventureRef } = Astro.props;
43
+ const { section, tool, toolSubmitEndpoint, route, ventureRef, headingLevel = 'h1' } = Astro.props;
35
44
  const referencedDiagramIds = new Set((section.blocks ?? []).filter((b: any) => b.blockType === 'diagram').map((b: any) => b.diagramId));
36
45
  const unreferencedDiagrams = (section.diagrams ?? []).filter((d: any) => !referencedDiagramIds.has(d.diagramId));
37
46
  ---
38
47
  <section id={section.sectionId} class="py-8" data-reveal>
39
48
  <SectionHeading
40
- level="h1"
49
+ level={headingLevel}
41
50
  eyebrow={section.eyebrow}
42
51
  heading={section.heading}
43
52
  subheading={section.subheading}
44
- headingClass="text-3xl sm:text-4xl"
53
+ headingClass={headingLevel === 'h1' ? 'text-3xl sm:text-4xl' : 'text-2xl sm:text-3xl'}
45
54
  subheadingClass="text-lg"
46
55
  class="mb-3 max-w-2xl"
47
56
  />
@@ -3,7 +3,7 @@ import Ajv from 'ajv';
3
3
  import addFormats from 'ajv-formats';
4
4
  import { fetchSchema, fetchSupportSchema } from './schemaFetch.js';
5
5
 
6
- const PAGE_PIN = '2.1.0';
6
+ const PAGE_PIN = '2.2.0';
7
7
  const CAPABILITY_CLAIM_PIN = '0.2.0';
8
8
 
9
9
  let validatorPromise: ReturnType<typeof buildValidator> | null = null;
@@ -0,0 +1,47 @@
1
+ // d-2026-09-16-sr-inline-markdown-rendering. content/page.schema.json's own
2
+ // description has called block.text "markdown-safe" since it was first
3
+ // authored -- but nothing downstream ever actually parsed markdown out of
4
+ // it: Block.astro rendered `{block.text}` as a plain Astro/JSX text node
5
+ // (auto-escaped, never re-interpreted), on the assumption a consumer that
6
+ // wanted real markdown would "wrap this or replace it" (this file's own
7
+ // prior doc comment). No consumer ever did. Found live, 2026-09-16: every
8
+ // real bridged article carries real markdown in its body -- **bold**
9
+ // clauses, [text](url) links in a close block's CTA sentence -- authored
10
+ // straight through from the source article's own canonical markdown body,
11
+ // and it was rendering as literal asterisks and bracket-paren text on
12
+ // production pages (confirmed on luh.tech's real insight articles).
13
+ //
14
+ // This is a narrow, safe formatter -- not a markdown parser. It supports
15
+ // exactly the two constructs real content actually uses (bold, inline
16
+ // links) plus italic for symmetry with bold, and nothing else: no
17
+ // headings/lists/code/images (those are already their own real
18
+ // block.blockType values or diagram/image blocks, never markdown syntax
19
+ // inside a text block). Escapes the raw text FIRST, then only its own
20
+ // three regexes can introduce a tag -- safe for real authored content
21
+ // (not user input) without needing a full sanitizer dependency.
22
+ function escapeHtml(text: string): string {
23
+ return text
24
+ .replace(/&/g, '&amp;')
25
+ .replace(/</g, '&lt;')
26
+ .replace(/>/g, '&gt;')
27
+ .replace(/"/g, '&quot;');
28
+ }
29
+
30
+ // Same href shape page.schema.json's own cta.href pattern already allows
31
+ // (anchor, same-site path, or an https:// URL) -- a markdown link outside
32
+ // that shape is left as literal escaped text rather than becoming an
33
+ // unvetted href, matching this schema family's existing "mailto: is not
34
+ // permitted" discipline.
35
+ const SAFE_HREF = /^(#[a-z0-9-]+|\/[a-z0-9\-/]*|https:\/\/[^\s")]+)$/i;
36
+
37
+ export function formatInlineMarkdown(text: string): string {
38
+ let html = escapeHtml(text);
39
+ html = html.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (match, label: string, href: string) => {
40
+ if (!SAFE_HREF.test(href)) return match;
41
+ const external = href.startsWith('https://');
42
+ return `<a href="${href}" class="underline decoration-accent-primary/50 underline-offset-2 hover:decoration-accent-primary"${external ? ' target="_blank" rel="noopener noreferrer"' : ''}>${label}</a>`;
43
+ });
44
+ html = html.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
45
+ html = html.replace(/(?<![a-zA-Z0-9])_([^_]+)_(?![a-zA-Z0-9])/g, '<em>$1</em>');
46
+ return html;
47
+ }