@luhtech/site-template 0.14.4 → 0.14.6
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.
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Usage: luhtech-page-lexicon <path-to-page.json> <path-to-brand-identity.json> [path-to-luhtech-business-brand-identity.json]
|
|
16
16
|
* Exit 0: clean. Exit 1: any prohibited term found, reported per field.
|
|
17
|
+
*
|
|
18
|
+
* Superseded for CI by the Vale package schema-registry generates from the
|
|
19
|
+
* brand-identity instances (tools/lexicon_vale.py -- one engine that also
|
|
20
|
+
* carries spellings, glosses and prohibitedPatterns, which this bin does
|
|
21
|
+
* not). Kept for local use; it reads surface-scoped items (v1.4.0+).
|
|
17
22
|
*/
|
|
18
23
|
import { readFileSync } from 'node:fs';
|
|
19
24
|
|
|
@@ -73,10 +78,21 @@ export function collectTextFields(page) {
|
|
|
73
78
|
* its own name constantly (seo.title alone guarantees it); that must never
|
|
74
79
|
* be a violation regardless of which source list it came from.
|
|
75
80
|
*/
|
|
81
|
+
/**
|
|
82
|
+
* brand-identity v1.4.0+: a prohibited[] item is a bare string (every
|
|
83
|
+
* surface) or {term, surfaces[]} (only the listed surfaces). This bin checks
|
|
84
|
+
* pages, so it keeps bare strings and items whose surfaces include "page".
|
|
85
|
+
*/
|
|
86
|
+
export function pageTerms(prohibited) {
|
|
87
|
+
return (prohibited ?? [])
|
|
88
|
+
.filter((item) => typeof item === 'string' || (item?.term && (item.surfaces ?? []).includes('page')))
|
|
89
|
+
.map((item) => (typeof item === 'string' ? item : item.term));
|
|
90
|
+
}
|
|
91
|
+
|
|
76
92
|
export function buildProhibitedTerms(brand, luhtechBrand) {
|
|
77
93
|
const terms = new Set([
|
|
78
|
-
...(brand.voice?.lexicon?.prohibited
|
|
79
|
-
...(luhtechBrand?.voice?.lexicon?.prohibited
|
|
94
|
+
...pageTerms(brand.voice?.lexicon?.prohibited),
|
|
95
|
+
...pageTerms(luhtechBrand?.voice?.lexicon?.prohibited),
|
|
80
96
|
]);
|
|
81
97
|
const ownNames = [brand.brandId, brand.identity?.name].filter(Boolean);
|
|
82
98
|
for (const own of ownNames) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luhtech/site-template",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.6",
|
|
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",
|
|
@@ -52,7 +52,7 @@
|
|
|
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",
|
|
55
|
-
"portfolio/brand-identity.schema.json": "1.
|
|
55
|
+
"portfolio/brand-identity.schema.json": "1.5.0"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -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"
|
|
71
|
+
<p class="leading-relaxed" set:html={text} />
|
|
66
72
|
</div>
|
|
67
73
|
)}
|
|
68
|
-
{block.blockType === 'lede' && <p class={`text-lg leading-relaxed ${className}`}
|
|
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}`}
|
|
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"
|
|
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}`}
|
|
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
|
|
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}`}
|
|
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}`}
|
|
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"
|
|
120
|
+
<p class="text-sm text-ink/80 leading-relaxed" set:html={text} />
|
|
115
121
|
</div>
|
|
116
122
|
)}
|
|
117
123
|
{isExternalLink && (
|
|
@@ -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
|
)}
|
|
@@ -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=
|
|
49
|
+
level={headingLevel}
|
|
41
50
|
eyebrow={section.eyebrow}
|
|
42
51
|
heading={section.heading}
|
|
43
52
|
subheading={section.subheading}
|
|
44
|
-
headingClass=
|
|
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
|
/>
|
package/src/content/loadBrand.ts
CHANGED
|
@@ -3,7 +3,9 @@ import Ajv from 'ajv';
|
|
|
3
3
|
import addFormats from 'ajv-formats';
|
|
4
4
|
import { fetchSchema, fetchSupportSchema } from './schemaFetch.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// 1.5.0: voice.lexicon spellings/glosses/prohibitedPatterns and surface-scoped
|
|
7
|
+
// prohibited items (additive -- every 1.3.0 instance validates unchanged).
|
|
8
|
+
const BRAND_PIN = '1.5.0';
|
|
7
9
|
|
|
8
10
|
let validatorPromise: ReturnType<typeof buildValidator> | null = null;
|
|
9
11
|
|
|
@@ -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, '&')
|
|
25
|
+
.replace(/</g, '<')
|
|
26
|
+
.replace(/>/g, '>')
|
|
27
|
+
.replace(/"/g, '"');
|
|
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
|
+
}
|