@taprootio/site-authoring 0.36.0 → 0.36.2

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/README.md CHANGED
@@ -1090,10 +1090,19 @@ at `site-header.headerHeightMultiplier`. Preserve the file's envelope and other
1090
1090
  settings, then use `validate` and `theme push` as usual.
1091
1091
 
1092
1092
  The multiplier changes the primary bar. Extra menu rows, navigation text and
1093
- header controls retain their size. Fixed headers above 1.0 shrink to standard
1094
- height on scroll and expand near the top. Normal and Sticky retain their
1093
+ header controls retain their size. Fixed headers above 1.0 shrink with scroll
1094
+ distance to their minimum height and expand back at the top. Normal and Sticky retain their
1095
1095
  configured height; Fixed at 1.0 keeps the regular logo.
1096
1096
 
1097
+ From 0.36.2, `settings.headerMinHeightMultiplier` uses the same string range and
1098
+ 0.1 steps, with omitted/empty/`"1"`/`"1.0"` meaning 1.0. For example, set the
1099
+ expanded height to `"3.8"` and the minimum to `"1.9"` to stop shrinking at 1.9×.
1100
+ The effective minimum is capped at expanded height, while pull retains the saved
1101
+ minimum if the expanded height is temporarily lower. Normal and Sticky ignore
1102
+ the minimum. Equal or oversized minima keep the regular logo and avoid unused
1103
+ compact imagery. A final minimum above 1.0 keeps the tall header's quiet icon
1104
+ controls and active-item treatment.
1105
+
1097
1106
  To use alternate artwork after shrinking, upload it with `media upload` and set
1098
1107
  `settings.lightCompactLogoId` and/or `settings.darkCompactLogoId` in the existing
1099
1108
  `settings/taproot-styles.json`. The app exposes **Compact logo** for Fixed above
@@ -1105,6 +1114,51 @@ are read-only server projections. Preview light/dark and desktop/390-wide, then
1105
1114
  stage and deploy the settings for the published site. `help appearance` and
1106
1115
  `help settings` describe both files.
1107
1116
 
1117
+ ### Attributed quotes in 0.36.2
1118
+
1119
+ Ordinary `>` Markdown stays unchanged, including a final quoted paragraph used
1120
+ for attribution. To put attribution and a source in a caption outside the quote
1121
+ panel, use this envelope with ordinary Markdown inside:
1122
+
1123
+ ```markdown
1124
+ :::blockquote {"attribution":"Aldous Huxley","sourceTitle":"Brave New World","cite":"https://www.huxley.net/bnw/four.html"}
1125
+ Words can be like X-rays.
1126
+ :::endblockquote
1127
+ ```
1128
+
1129
+ The same ProseMirror node is:
1130
+
1131
+ ```json
1132
+ {
1133
+ "type": "blockquote",
1134
+ "attrs": {
1135
+ "attribution": "Aldous Huxley",
1136
+ "sourceTitle": "Brave New World",
1137
+ "cite": "https://www.huxley.net/bnw/four.html"
1138
+ },
1139
+ "content": [
1140
+ { "type": "paragraph", "content": [{ "type": "text", "text": "Words can be like X-rays." }] }
1141
+ ]
1142
+ }
1143
+ ```
1144
+
1145
+ All three attrs are optional; absent or null means omitted. Attribution is the
1146
+ person or organization, without introductory punctuation. Source title names the
1147
+ work. Each accepts nonblank single-line plain text up to 200 Unicode characters.
1148
+ The source URL accepts an explicit HTTP(S) address or a root-relative path up to
1149
+ 2048 characters. Protocol-relative, mailto, tel, script/data URLs, control
1150
+ characters and backslashes are refused. Unknown attrs and malformed, orphan or
1151
+ unclosed markers produce path or line diagnostics. Fenced-code markers stay
1152
+ code. The envelope keeps ordinary quote nesting and placement limits, including
1153
+ inside sections and columns; tables and sections cannot be nested inside quotes.
1154
+
1155
+ Pull writes `.pm.json` with the metadata. An unchanged push makes no write.
1156
+ A tracked `.md` stays byte-identical on push and pull, with metadata retained in
1157
+ remote JSON and the internal baseline. A browser metadata edit raises the usual
1158
+ tracked-Markdown conflict, and a stale push is refused. There is no reverse
1159
+ Markdown exporter. See `taproot-site help page free-form` for the closed attrs
1160
+ reference and examples.
1161
+
1108
1162
  ### What changed between releases
1109
1163
 
1110
1164
  Taproot accepts only the latest CLI, so an upgrade can be forced at any time.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taprootio/site-authoring",
3
- "version": "0.36.0",
3
+ "version": "0.36.2",
4
4
  "description": "Taproot site authoring CLI: sign in once in the browser, then pull, validate, push, preview, approve, and deploy a site from the terminal",
5
5
  "type": "module",
6
6
  "license": "ISC",
@@ -28,7 +28,7 @@
28
28
  "README.md"
29
29
  ],
30
30
  "dependencies": {
31
- "@taprootio/espalier": "6.13.1",
31
+ "@taprootio/espalier": "6.14.0",
32
32
  "mediabunny": "1.61.1"
33
33
  },
34
34
  "scripts": {
@@ -131,15 +131,15 @@ export const APPEARANCE_SCALAR_FIELDS = Object.freeze([
131
131
  values: Object.freeze(["normal", "sticky", "fixed"]),
132
132
  default: "normal",
133
133
  }),
134
- Object.freeze({
134
+ ...["headerHeightMultiplier", "headerMinHeightMultiplier"].map(name => Object.freeze({
135
135
  settingsType: SETTINGS_TYPE_SITE_HEADER,
136
- name: "headerHeightMultiplier",
137
- path: "site-header.headerHeightMultiplier",
136
+ name,
137
+ path: `site-header.${name}`,
138
138
  type: "header-height-multiplier",
139
139
  ...HEADER_HEIGHT_MULTIPLIER_LIMITS,
140
140
  optional: true,
141
141
  default: "",
142
- }),
142
+ })),
143
143
  Object.freeze({
144
144
  settingsType: SETTINGS_TYPE_SITE_HEADER,
145
145
  name: "showThemeToggle",
@@ -1,5 +1,31 @@
1
1
  {
2
2
  "entries": [
3
+ {
4
+ "version": "0.36.2",
5
+ "note": "Tall fixed headers follow scrolling, and themed quotes support optional attribution and sources.",
6
+ "behavior": [
7
+ "Above standard height, a Fixed header shrinks with scroll distance until it reaches the configured minimum height (1.0 by default). A ready compact logo appears when shrinking starts; page spacing stays stable.",
8
+ "Set optional headerMinHeightMultiplier in site-header.json from \"1.0\" through \"5.0\" in tenths. A 3.8 expanded header can shrink to 1.9. Minimums above expanded height are capped for rendering while preserving saved intent. Normal and Sticky keep their configured height.",
9
+ "Markdown > quotations now have a themed start border, padding and lead typography in published pages and the editor, including named theme contexts and section columns. Quote panels fill their containing section or column; ordinary prose keeps its reading width. Republish existing pages to apply the new presentation.",
10
+ "Write attribution as an ordinary final quoted paragraph, optionally with existing emphasis or a leading dash. Paragraph order does not create a citation or change the saved content.",
11
+ "For a caption outside the quote panel, author :::blockquote {JSON attrs} / :::endblockquote with ordinary Markdown inside. Optional attribution and sourceTitle are nonblank single-line text up to 200 Unicode characters; cite is an HTTP(S) URL or root-relative path up to 2048. JSON uses the same closed attrs. Invalid settings and malformed markers are refused with their path or line.",
12
+ "Pull preserves quote metadata in .pm.json. A tracked .md stays byte-identical through push/pull, with metadata in remote JSON and the internal baseline. An unchanged push makes no write; a remote browser metadata change raises the existing conflict and refuses a stale push.",
13
+ "The help reference version is 57."
14
+ ],
15
+ "help": [
16
+ "page",
17
+ "settings"
18
+ ]
19
+ },
20
+ {
21
+ "version": "0.36.1",
22
+ "note": "Maintenance release for the authoring CLI.",
23
+ "behavior": [
24
+ "This release includes test and verification maintenance.",
25
+ "The help reference version is 56."
26
+ ],
27
+ "help": []
28
+ },
3
29
  {
4
30
  "version": "0.36.0",
5
31
  "note": "Navigation links can use Button styling, headers can scale and switch to compact logos, and sections can arrange content in responsive columns.",
@@ -0,0 +1,100 @@
1
+ // Generated from shared/blockquote-metadata.ts by scripts/sync-field-validation.mjs. Do not edit.
2
+ import { sanitizeUrl } from "./component-urls.js";
3
+ import registry from "./free-form-section-registry.json" with { type: "json" };
4
+ export const BLOCKQUOTE_METADATA_FIELDS = registry.blockquote.attrs;
5
+ const CONTROL = /[\u0000-\u001f\u007f-\u009f\u2028\u2029\ufeff]/u;
6
+ const object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
7
+ /** Citation URLs are addresses, never markup, executable schemes or fetch requests. */
8
+ export function isSafeBlockquoteSource(value) {
9
+ if (CONTROL.test(value) || sanitizeUrl(value) !== value || value === "")
10
+ return false;
11
+ if (value.startsWith("/"))
12
+ return true;
13
+ if (!/^https?:\/\/[^/?#]+/iu.test(value))
14
+ return false;
15
+ try {
16
+ const url = new URL(value);
17
+ return (url.protocol === "https:" || url.protocol === "http:") && url.hostname !== "";
18
+ }
19
+ catch {
20
+ return false;
21
+ }
22
+ }
23
+ /** Strict write admission; null defaults mean absence and never rewrite stored text. */
24
+ export function validateBlockquoteMetadata(attrs) {
25
+ if (attrs == null)
26
+ return [];
27
+ if (!object(attrs)) {
28
+ return [{ field: "attrs", code: "blockquote.attrs", message: "Blockquote settings must be an object." }];
29
+ }
30
+ const issues = [];
31
+ for (const [field, value] of Object.entries(attrs)) {
32
+ if (!Object.prototype.hasOwnProperty.call(BLOCKQUOTE_METADATA_FIELDS, field)) {
33
+ issues.push({
34
+ field,
35
+ code: "blockquote.unknown_attribute",
36
+ message: "This blockquote setting is not supported.",
37
+ });
38
+ continue;
39
+ }
40
+ if (value == null)
41
+ continue;
42
+ const definition = BLOCKQUOTE_METADATA_FIELDS[field];
43
+ if (typeof value !== "string" || !value.trim() || CONTROL.test(value) || [...value].length > definition.maxScalars) {
44
+ issues.push({
45
+ field,
46
+ code: "blockquote.value",
47
+ message: `${definition.label} must be single-line text of at most ${definition.maxScalars} characters.`,
48
+ });
49
+ }
50
+ else if (field === "cite" && !isSafeBlockquoteSource(value)) {
51
+ issues.push({
52
+ field,
53
+ code: "blockquote.url",
54
+ message: "Source URL must be an HTTP or HTTPS address or a path beginning with one slash.",
55
+ });
56
+ }
57
+ }
58
+ return issues;
59
+ }
60
+ /** Invalid stored settings never become links; callers retain the quote's body. */
61
+ export function readBlockquoteMetadata(attrs) {
62
+ if (validateBlockquoteMetadata(attrs).length > 0)
63
+ return null;
64
+ if (!object(attrs))
65
+ return {};
66
+ return Object.fromEntries(Object.entries(attrs).filter(([, value]) => value != null));
67
+ }
68
+ /** Real caption text is shared by published HTML, clipboard HTML and editing chrome. */
69
+ export function blockquoteCaptionParts(attrs) {
70
+ const metadata = readBlockquoteMetadata(attrs);
71
+ if (!metadata)
72
+ return [];
73
+ const { attribution, sourceTitle, cite } = metadata;
74
+ const parts = [];
75
+ if (attribution)
76
+ parts.push({ kind: "text", text: `— ${attribution}` });
77
+ if (attribution && (sourceTitle || cite))
78
+ parts.push({ kind: "text", text: ", " });
79
+ if (sourceTitle)
80
+ parts.push({ kind: "title", text: sourceTitle, ...(cite ? { href: cite } : {}) });
81
+ else if (cite)
82
+ parts.push({ kind: "source", text: "Source", href: cite });
83
+ return parts;
84
+ }
85
+ /** Check before schema parsing, which would otherwise discard unknown settings. */
86
+ export function hasUnsupportedBlockquoteMetadata(document) {
87
+ const pending = [document];
88
+ while (pending.length > 0) {
89
+ const node = pending.pop();
90
+ if (!object(node))
91
+ continue;
92
+ if (node.type === "blockquote" && validateBlockquoteMetadata(node.attrs).length > 0)
93
+ return true;
94
+ if (Array.isArray(node.content)) {
95
+ for (const child of node.content)
96
+ pending.push(child);
97
+ }
98
+ }
99
+ return false;
100
+ }
@@ -0,0 +1,59 @@
1
+ // Generated from shared/component-urls.ts by scripts/sync-field-validation.mjs. Do not edit.
2
+ /**
3
+ * The one owner of which addresses the page components and the page header
4
+ * markup turn into links (moved here from `generator/client/pages/shared/urls.ts`
5
+ * by TR01331, so `shared/page-header.ts` can use the same rule).
6
+ *
7
+ * `sanitizeUrl` is the byline and page-author contract: root-relative paths and
8
+ * explicit http(s) URLs only. `sanitizeStructuredContentUrl` is the broader
9
+ * structured-content contract the call-to-action and hero components use.
10
+ *
11
+ * The generator cannot import a repo-root file, so
12
+ * `node scripts/sync-field-validation.mjs` writes its copy; edit only this
13
+ * file and re-run it.
14
+ */
15
+ function cleanedUrl(url) {
16
+ if (!url || /[\x00-\x1f\x7f\\]/u.test(url))
17
+ return "";
18
+ const cleaned = url.trim();
19
+ if (!cleaned)
20
+ return "";
21
+ if (cleaned.startsWith("//"))
22
+ return "";
23
+ return cleaned;
24
+ }
25
+ /**
26
+ * Preserve the established URL contract used by byline and page-author
27
+ * links: root-relative paths and explicit HTTP(S) URLs only.
28
+ */
29
+ export function sanitizeUrl(url) {
30
+ const cleaned = cleanedUrl(url);
31
+ if (!cleaned)
32
+ return "";
33
+ if (cleaned.startsWith("/"))
34
+ return cleaned;
35
+ const lower = cleaned.toLowerCase();
36
+ return lower.startsWith("https://") || lower.startsWith("http://") ? cleaned : "";
37
+ }
38
+ /**
39
+ * Sanitize URLs in the structured-content vocabulary. In addition to the
40
+ * established component-link policy, this accepts mailto, tel, fragments,
41
+ * queries, and path-like relative references used by agent-authored content.
42
+ */
43
+ export function sanitizeStructuredContentUrl(url) {
44
+ const cleaned = cleanedUrl(url);
45
+ if (!cleaned)
46
+ return "";
47
+ if (cleaned.startsWith("/")
48
+ || cleaned.startsWith("./")
49
+ || cleaned.startsWith("#")
50
+ || cleaned.startsWith("?"))
51
+ return cleaned;
52
+ try {
53
+ const parsed = new URL(cleaned);
54
+ return ["http:", "https:", "mailto:", "tel:"].includes(parsed.protocol) ? cleaned : "";
55
+ }
56
+ catch {
57
+ return cleaned;
58
+ }
59
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": 17,
2
+ "version": 18,
3
3
 
4
4
  "imageDescription": {
5
5
  "fields": {
@@ -396,6 +396,48 @@
396
396
  "eligibleComponentRootPlacement": "flow",
397
397
  "excludedNodeTypes": ["section", "columns", "column", "integrationFragment"]
398
398
  },
399
+ "blockquote": {
400
+ "nodeType": "blockquote",
401
+ "closed": true,
402
+ "attrs": {
403
+ "attribution": {
404
+ "label": "Attribution",
405
+ "help": "Optional name or organization. Leave out introductory punctuation.",
406
+ "type": "plain-text",
407
+ "required": false,
408
+ "default": null,
409
+ "minScalars": 1,
410
+ "maxScalars": 200
411
+ },
412
+ "sourceTitle": {
413
+ "label": "Source title",
414
+ "help": "Optional title of the work being quoted.",
415
+ "type": "plain-text",
416
+ "required": false,
417
+ "default": null,
418
+ "minScalars": 1,
419
+ "maxScalars": 200
420
+ },
421
+ "cite": {
422
+ "label": "Source URL",
423
+ "help": "Optional HTTP or HTTPS source address or a path on this site.",
424
+ "type": "safe-url",
425
+ "required": false,
426
+ "default": null,
427
+ "minScalars": 1,
428
+ "maxScalars": 2048,
429
+ "schemes": [
430
+ "http",
431
+ "https"
432
+ ],
433
+ "rootRelative": true
434
+ }
435
+ },
436
+ "markdown": {
437
+ "open": ":::blockquote",
438
+ "close": ":::endblockquote"
439
+ }
440
+ },
399
441
  "table": {
400
442
  "nodeTypes": {
401
443
  "table": "table",
@@ -541,7 +583,7 @@
541
583
  },
542
584
  "blockquote": {
543
585
  "label": "Blockquote",
544
- "measure": "prose",
586
+ "measure": "wide",
545
587
  "placement": "flow"
546
588
  },
547
589
  "codeBlock": {
@@ -1,4 +1,5 @@
1
1
  import { SiteAuthoringError } from "../errors.js";
2
+ import { readBlockquoteMetadata, validateBlockquoteMetadata } from "./blockquote-metadata.js";
2
3
  import {
3
4
  canonicalizeComponentData,
4
5
  expandComponentAuthoringShorthand,
@@ -25,6 +26,7 @@ import {
25
26
  LINK_REL_TOKENS,
26
27
  LINK_TARGETS,
27
28
  MARK_TYPES,
29
+ pointerSegment,
28
30
  } from "./vocabulary.js";
29
31
 
30
32
  /**
@@ -32,7 +34,8 @@ import {
32
34
  * dependencies.
33
35
  *
34
36
  * The subset is exactly the renderer's vocabulary: paragraphs, ATX headings
35
- * 1-4, hard breaks, bullet and ordered lists, blockquotes, fenced code with a
37
+ * 1-4, hard breaks, bullet and ordered lists, blockquotes (including the
38
+ * metadata envelope), fenced code with a
36
39
  * language, thematic breaks, images, bounded GFM pipe tables,
37
40
  * `component:<type>` fences, and `inline-facts` JSON-array fences; and the
38
41
  * bold, italic, strike, code, and link marks. **Anything outside it is a hard
@@ -75,6 +78,12 @@ const TABLE_CONTRACT = FREE_FORM_SECTION_REGISTRY.table;
75
78
  const TABLE_NODE_TYPES = TABLE_CONTRACT.nodeTypes;
76
79
  const TABLE_CAPTION_STEM = TABLE_CONTRACT.markdown.captionPrefix.trimEnd();
77
80
  const INLINE_FACTS_CONTRACT = FREE_FORM_SECTION_REGISTRY.inlineFacts;
81
+ const BLOCKQUOTE_CONTRACT = FREE_FORM_SECTION_REGISTRY.blockquote;
82
+ const BLOCKQUOTE_HEADER_RE = new RegExp(`^${BLOCKQUOTE_CONTRACT.markdown.open} (\\{.*\\})$`, "u");
83
+ const BLOCKQUOTE_DIRECTIVE_LIKE_RE = new RegExp(
84
+ `^ *(?:${BLOCKQUOTE_CONTRACT.markdown.open}|${BLOCKQUOTE_CONTRACT.markdown.close})(?=\\s|\\{|$)`,
85
+ "u",
86
+ );
78
87
  const TABLE_DELIMITER_TOKEN_RE = new RegExp(
79
88
  `^:?-{${TABLE_CONTRACT.markdown.delimiterMinHyphens},}:?$`,
80
89
  "u",
@@ -256,7 +265,8 @@ function isBlockStart(text) {
256
265
  || REFERENCE_DEFINITION_RE.test(text)
257
266
  || SECTION_HEADER_LIKE_RE.test(text)
258
267
  || SECTION_CLOSE_RE.test(text)
259
- || COLUMNS_DIRECTIVE_LIKE_RE.test(text);
268
+ || COLUMNS_DIRECTIVE_LIKE_RE.test(text)
269
+ || BLOCKQUOTE_DIRECTIVE_LIKE_RE.test(text);
260
270
  }
261
271
 
262
272
  function guardBlockConstructs(text, line, nextText) {
@@ -333,6 +343,13 @@ async function parseBlocks(lines, context, depth) {
333
343
  continue;
334
344
  }
335
345
 
346
+ if (BLOCKQUOTE_DIRECTIVE_LIKE_RE.test(text)) {
347
+ const consumed = await consumeBlockquoteEnvelope(lines, index, context, depth);
348
+ nodes.push(consumed.node);
349
+ index = consumed.next;
350
+ continue;
351
+ }
352
+
336
353
  if (COLUMNS_DIRECTIVE_LIKE_RE.test(text)) {
337
354
  if (context.blockPlacement !== "section" || !text.startsWith(":::columns ")) {
338
355
  throw fail(CODES.markdownColumns, "columns layout", "A columns layout belongs directly inside a section; its headers and closing markers must match.", line.number);
@@ -1009,6 +1026,68 @@ async function componentNode(componentType, body, line, context) {
1009
1026
  // Blockquotes
1010
1027
  // ---------------------------------------------------------------------------
1011
1028
 
1029
+ async function consumeBlockquoteEnvelope(lines, start, context, depth) {
1030
+ const line = lines[start];
1031
+ const header = expandLeadingTabs(line.text);
1032
+ const match = BLOCKQUOTE_HEADER_RE.exec(header);
1033
+ if (!match) {
1034
+ throw fail(
1035
+ CODES.markdownBlockquote,
1036
+ "blockquote",
1037
+ `Use '${BLOCKQUOTE_CONTRACT.markdown.open} {JSON object}' and a matching '${BLOCKQUOTE_CONTRACT.markdown.close}' without indentation or trailing text. A closing marker needs an open blockquote.`,
1038
+ line.number,
1039
+ );
1040
+ }
1041
+ let parsed;
1042
+ try { parsed = JSON.parse(match[1]); } catch (error) {
1043
+ throw fail(CODES.markdownBlockquote, "blockquote", "A blockquote header needs a valid JSON object.", line.number, error);
1044
+ }
1045
+ const [issue] = validateBlockquoteMetadata(parsed);
1046
+ if (issue) {
1047
+ throw fail(issue.code, issue.code === "blockquote.attrs" ? "/attrs" : `/attrs/${pointerSegment(issue.field)}`, issue.message, line.number);
1048
+ }
1049
+ const attrs = readBlockquoteMetadata(parsed);
1050
+ const body = [];
1051
+ let nested = 0;
1052
+ let activeFence;
1053
+ for (let index = start + 1; index < lines.length; index += 1) {
1054
+ const bodyLine = lines[index];
1055
+ const text = expandLeadingTabs(bodyLine.text);
1056
+ if (activeFence) {
1057
+ body.push(bodyLine);
1058
+ if (activeFence.test(text)) activeFence = undefined;
1059
+ continue;
1060
+ }
1061
+ const fence = FENCE_RE.exec(text);
1062
+ if (fence) {
1063
+ activeFence = fenceClosing(fence[2]);
1064
+ body.push(bodyLine);
1065
+ continue;
1066
+ }
1067
+ if (BLOCKQUOTE_HEADER_RE.test(text)) {
1068
+ nested += 1;
1069
+ if (depth + nested > CONTENT_LIMITS.markdownNesting) {
1070
+ throw fail(CODES.markdownNesting, "nesting", `Markdown may not nest more than ${CONTENT_LIMITS.markdownNesting} levels deep.`, bodyLine.number);
1071
+ }
1072
+ }
1073
+ if (text === BLOCKQUOTE_CONTRACT.markdown.close) {
1074
+ if (nested === 0) {
1075
+ const content = await parseBlocks(body, { ...context, blockPlacement: "nested" }, depth + 1);
1076
+ if (content.length === 0) {
1077
+ throw fail(CODES.markdownEmpty, "blockquote", "A blockquote must contain content.", line.number);
1078
+ }
1079
+ return {
1080
+ node: { type: BLOCKQUOTE_CONTRACT.nodeType, ...(Object.keys(attrs).length > 0 ? { attrs } : {}), content },
1081
+ next: index + 1,
1082
+ };
1083
+ }
1084
+ nested -= 1;
1085
+ }
1086
+ body.push(bodyLine);
1087
+ }
1088
+ throw fail(CODES.markdownBlockquote, "blockquote", `A blockquote was opened but never closed with '${BLOCKQUOTE_CONTRACT.markdown.close}'.`, line.number);
1089
+ }
1090
+
1012
1091
  async function consumeBlockquote(lines, start, context, depth) {
1013
1092
  const inner = [];
1014
1093
  let index = start;
@@ -7,6 +7,7 @@
7
7
  * Keep those publishing copies in sync and covered by parity tests.
8
8
  */
9
9
 
10
+ import { blockquoteCaptionParts, readBlockquoteMetadata } from "./blockquote-metadata.js";
10
11
  import { columnsAttributes, isColumnEligibleBlock } from "./free-form-columns.js";
11
12
  import freeFormSectionRegistry from "./free-form-section-registry.json" with { type: "json" };
12
13
  import { imageDescriptionIssues } from "./image-description-validation.js";
@@ -292,11 +293,7 @@ function renderNode(
292
293
  case "listItem":
293
294
  return renderElement("li", {}, renderNodes(node.content ?? [], options, "nested"));
294
295
  case "blockquote":
295
- return renderElement(
296
- "blockquote",
297
- withProseMeasure({}, node.type, options),
298
- renderNodes(node.content ?? [], options, "nested"),
299
- );
296
+ return renderBlockquote(node, options);
300
297
  case "codeBlock":
301
298
  return renderCodeBlock(node, options);
302
299
  case "horizontalRule":
@@ -400,6 +397,27 @@ function renderHeading(node: ProseMirrorNode, options: RenderProseMirrorOptions)
400
397
  );
401
398
  }
402
399
 
400
+ function renderBlockquote(node: ProseMirrorNode, options: RenderProseMirrorOptions): string {
401
+ const metadata = readBlockquoteMetadata(node.attrs) ?? {};
402
+ const quote = renderElement(
403
+ "blockquote",
404
+ withProseMeasure({ ...(metadata.cite ? { cite: metadata.cite } : {}) }, node.type, options),
405
+ renderNodes(node.content ?? [], { ...options, freeFormSections: false }, "nested"),
406
+ );
407
+ const parts = blockquoteCaptionParts(metadata);
408
+ if (parts.length === 0) return quote;
409
+ const caption = parts.map(part => {
410
+ const text = escapeHtml(part.text);
411
+ const content = part.href ? renderLink(part.href, undefined, text, options) : text;
412
+ return part.kind === "title" ? renderElement("cite", {}, content) : content;
413
+ }).join("");
414
+ return renderElement("figure", {
415
+ "data-taproot-quote": "",
416
+ "data-attribution": metadata.attribution,
417
+ "data-source-title": metadata.sourceTitle,
418
+ }, quote + renderElement("figcaption", {}, caption));
419
+ }
420
+
403
421
  function renderCodeBlock(node: ProseMirrorNode, options: RenderProseMirrorOptions): string {
404
422
  const language = stringAttr(node.attrs?.language);
405
423
  const attrs = language ? { class: `language-${language}` } : {};
@@ -1,4 +1,5 @@
1
1
  import { validateColumnsBody } from "./free-form-columns.js";
2
+ import { validateBlockquoteMetadata } from "./blockquote-metadata.js";
2
3
  import { IMAGE_DESCRIPTION_MODES } from "./image-description-validation.js";
3
4
  import { validateComponentBlock } from "./components.js";
4
5
  import {
@@ -378,7 +379,11 @@ const NODE_RULES = Object.freeze({
378
379
  }),
379
380
  // ListItem's content expression is `paragraph block*`.
380
381
  listItem: rule({ children: BLOCKS, minChildren: 1, firstChild: "paragraph" }),
381
- blockquote: rule({ children: BLOCKS, minChildren: 1 }),
382
+ blockquote: rule({
383
+ blockquote: true,
384
+ children: BLOCKS,
385
+ minChildren: 1,
386
+ }),
382
387
  codeBlock: rule({
383
388
  attrs: Object.freeze({
384
389
  language: spec((value) => {
@@ -599,6 +604,12 @@ function checkMarkKeys(mark, markPath, state) {
599
604
  function checkAttrs(node, path, nodeRule, state) {
600
605
  const attrsPath = `${path}/attrs`;
601
606
  const attrs = node.attrs;
607
+ if (nodeRule.blockquote) {
608
+ for (const issue of validateBlockquoteMetadata(attrs)) {
609
+ report(state, issue.code === "blockquote.attrs" ? attrsPath : `${attrsPath}/${pointerSegment(issue.field)}`, issue.code, issue.message);
610
+ }
611
+ return;
612
+ }
602
613
  const present = isPlainObject(attrs);
603
614
 
604
615
  if (!isAbsent(attrs) && !present) {
@@ -175,6 +175,7 @@ export const CONTENT_ERROR_CODES = Object.freeze({
175
175
  markdownUnclosedFence: "content.markdown_unclosed_fence",
176
176
  markdownCodeLanguage: "content.markdown_code_language",
177
177
  markdownColumns: "content.markdown_columns",
178
+ markdownBlockquote: "content.markdown_blockquote",
178
179
  markdownSectionHeader: "content.markdown_section_header",
179
180
  markdownSectionUnclosed: "content.markdown_section_unclosed",
180
181
  markdownSectionNested: "content.markdown_section_nested",
@@ -22,10 +22,17 @@ export function parseHeaderHeightMultiplier(value) {
22
22
  export function resolveHeaderHeightMultiplier(value) {
23
23
  return parseHeaderHeightMultiplier(value) ?? STANDARD_HEIGHT;
24
24
  }
25
+ /** Clamp only the rendered endpoint, retaining the author's saved minimum. */
26
+ export function resolveHeaderMinHeightMultiplier(minimum, expanded) {
27
+ const height = resolveHeaderHeightMultiplier(expanded);
28
+ const floor = resolveHeaderHeightMultiplier(minimum);
29
+ return floor.tenths < height.tenths ? floor : height;
30
+ }
25
31
  /** Stored compact assets are delivered only when an expanded brand already exists. */
26
- export function canUseCompactHeaderLogo(position, multiplier, hasRegularLogo) {
32
+ export function canUseCompactHeaderLogo(position, multiplier, hasRegularLogo, minimum) {
27
33
  const height = parseHeaderHeightMultiplier(multiplier);
28
- return position === "fixed" && hasRegularLogo && height !== null && height.tenths > 10;
34
+ return position === "fixed" && hasRegularLogo && height !== null
35
+ && height.tenths > resolveHeaderMinHeightMultiplier(minimum, multiplier).tenths;
29
36
  }
30
37
  /** Keep each scheme's selected source and reserved ratio together through fallback. */
31
38
  export function resolveHeaderLogoPairs(input) {
@@ -502,7 +502,7 @@ export function getAppearanceReference() {
502
502
  "Use site-owned image ids retained from pull or returned by media upload. URLs are server projections, never authored inputs.",
503
503
  logoContract:
504
504
  "lightLogoId and darkLogoId are the expanded scheme logos; optional lightCompactLogoId and darkCompactLogoId "
505
- + "supply compact logos for Fixed headers above 1.0 when a regular logo resolves. Inactive choices are retained. "
505
+ + "supply compact logos for Fixed headers above 1.0 when a regular logo resolves. A ready compact logo appears when shrinking starts; pending or failed artwork keeps the regular logo. Inactive choices are retained. "
506
506
  + "Each takes one image id: upload the highest-resolution file you have and assign it. An @2x or @3x suffix is only "
507
507
  + "part of a filename, nothing pairs it with another file, and the platform generates the sizes. "
508
508
  + "Prefer transparent PNG or WebP artwork with genuine alpha so the header background shows through, including "
@@ -95,7 +95,7 @@ import {
95
95
 
96
96
  export { getAppearanceReference, getFooterReference, getSettingsReference, getThemeReference };
97
97
 
98
- export const REFERENCE_VERSION = 56;
98
+ export const REFERENCE_VERSION = 57;
99
99
 
100
100
  // The date-limit examples `help forms` prints; tests run them through the form validator.
101
101
  export const FORM_DATE_WINDOW_FIELD = Object.freeze({
@@ -635,8 +635,10 @@ const WORKFLOW_REFERENCES = Object.freeze({
635
635
  + "the variants yourself with any image tool (a transparent logo at the highest resolution you have, a square favicon); there is no "
636
636
  + "recolor, crop or SVG upload command. Upload each with media upload, then assign lightLogoId and darkLogoId "
637
637
  + "(and brand.faviconId) from the image ids .taproot-site-media.json records for those files, so each scheme carries the artwork that reads on its header. "
638
- + "Optional lightCompactLogoId and darkCompactLogoId in the same styles file provide alternate artwork when a Fixed header above 1.0 shrinks; "
639
- + "set headerHeightMultiplier as a string in site-header.json. See help appearance for the range and fallback rules.",
638
+ + "Optional lightCompactLogoId and darkCompactLogoId in the same styles file provide alternate artwork when a Fixed header above 1.0 starts shrinking. "
639
+ + "Its visible height follows scroll distance down to the minimum height (1.0 by default) and expands again when scrolling back to the top; "
640
+ + "the compact logo switches at the first actual shrink. "
641
+ + "Set headerHeightMultiplier and optional headerMinHeightMultiplier as strings in site-header.json; for example, 3.8 expanded and 1.9 minimum. See help appearance for the range and fallback rules.",
640
642
  `See the compiled colors: ${CLI_BINARY_NAME} theme resolve prints, offline, every semantic color Espalier compiles `
641
643
  + "from the pair for each scheme and context, whether each is compiled from the roles or pinned, and the contrast "
642
644
  + "of every ink-on-surface pair, with a flag for each one under WCAG AA. Run it after each theme edit, in both "
@@ -1863,6 +1865,24 @@ const FREE_FORM_REFERENCE = Object.freeze({
1863
1865
  `Any other rel token, opener included, is refused (${CONTENT_ERROR_CODES.linkRel}); so is another target `
1864
1866
  + `(${CONTENT_ERROR_CODES.linkTarget}). The editor's old default, "noopener noreferrer nofollow", reads as no choice.`,
1865
1867
  }),
1868
+ blockquotes: Object.freeze({
1869
+ appearance: "Native blockquotes fill their containing section or column, with a visible themed start border, padding and lead typography in the page's current theme context.",
1870
+ attribution: "Keep an attribution as a separate final quoted paragraph. Existing emphasis or a leading dash is optional. Attribution is ordinary quote content; the renderer does not infer it from the last paragraph or the following paragraph, and a person's name does not belong in cite.",
1871
+ example: "> Only the outside portion of the double-pane glass was broken, so that's what he fixed!\n>\n> Jeana Baca, Google review",
1872
+ metadata: "For a caption outside the quote panel, use optional attribution (a name or organization without introductory punctuation), sourceTitle (the work title) and cite (the source URL). Ordinary > Markdown is unchanged. Existing final quoted paragraphs stay body content; no attribution is inferred or moved.",
1873
+ attrs: Object.freeze(Object.entries(FREE_FORM_SECTION_REGISTRY.blockquote.attrs).map(([name, definition]) => Object.freeze({ name, ...definition }))),
1874
+ valuePolicy: "All fields are optional; absent or null means omitted. Supplied values must be nonblank single-line plain text, with no control characters. Values are retained exactly, never truncated or rewritten. Unknown settings are refused at their attribute path.",
1875
+ urlPolicy: "cite accepts only an explicit HTTP or HTTPS address or a root-relative path beginning with one slash. Protocol-relative, mailto, tel, script/data URLs and backslashes are refused. The URL is never fetched. Root-relative and same-site sources stay in the same tab; off-site HTTP(S) sources open in a new tab with the usual accessible cue.",
1876
+ markdownSyntax: `${FREE_FORM_SECTION_REGISTRY.blockquote.markdown.open} {JSON attrs}\nordinary Markdown without an extra > prefix\n${FREE_FORM_SECTION_REGISTRY.blockquote.markdown.close}`,
1877
+ metadataExample: `${FREE_FORM_SECTION_REGISTRY.blockquote.markdown.open} {"attribution":"Aldous Huxley","sourceTitle":"Brave New World","cite":"https://www.huxley.net/bnw/four.html"}\nWords can be like X-rays.\n${FREE_FORM_SECTION_REGISTRY.blockquote.markdown.close}`,
1878
+ pmJsonExample: Object.freeze({
1879
+ type: FREE_FORM_SECTION_REGISTRY.blockquote.nodeType,
1880
+ attrs: Object.freeze({ attribution: "Aldous Huxley", sourceTitle: "Brave New World", cite: "https://www.huxley.net/bnw/four.html" }),
1881
+ content: Object.freeze([{ type: "paragraph", content: [{ type: "text", text: "Words can be like X-rays." }] }]),
1882
+ }),
1883
+ placement: "The envelope has the same nesting and placement limits as ordinary quotes. Sections and tables cannot be placed inside it. Fenced-code markers stay code; malformed, orphan and unclosed quote markers are refused with the source line.",
1884
+ roundTrip: "Fresh pull writes .pm.json with these attrs. An unchanged push sends no write. A tracked .md stays byte-identical on push and pull; remote JSON and the internal baseline retain metadata. A browser metadata change raises the existing tracked-Markdown conflict and refuses a stale push. There is no reverse Markdown exporter.",
1885
+ }),
1866
1886
  // TR01220: a free-form page prints no title, so its first level-1 heading is the h1.
1867
1887
  headings: Object.freeze({
1868
1888
  rule:
@@ -2166,7 +2186,7 @@ export function formatReferenceResult(result) {
2166
2186
  page.document.marks.join(", ")
2167
2187
  }\n\nLinks:\n markdown ${page.document.links.markdown}\n rel ${
2168
2188
  page.document.links.rel.join(", ")
2169
- }\n default ${page.document.links.default}\n in Markdown ${page.document.links.markdownRule}\n in .pm.json ${page.document.links.pmJson}\n refusals ${page.document.links.refusals}\n\nHeadings and the h1:\n rule ${page.document.headings.rule}\n banner and hero ${page.document.headings.claimedFirst}\n later headings ${page.document.headings.laterHeadings}\n depth ${page.document.headings.depth}\n example\n${
2189
+ }\n default ${page.document.links.default}\n in Markdown ${page.document.links.markdownRule}\n in .pm.json ${page.document.links.pmJson}\n refusals ${page.document.links.refusals}\n\nBlockquotes:\n appearance ${page.document.blockquotes.appearance}\n attribution ${page.document.blockquotes.attribution}\n example\n${page.document.blockquotes.example.split("\n").map(line => ` ${line}`).join("\n")}\n optional caption ${page.document.blockquotes.metadata}\n values ${page.document.blockquotes.valuePolicy}\n source URL ${page.document.blockquotes.urlPolicy}\n placement ${page.document.blockquotes.placement}\n round trip ${page.document.blockquotes.roundTrip}\n\nBlockquote attributes (closed object):\n${page.document.blockquotes.attrs.map(attr => ` ${attr.name}: ${attr.type} | null; optional; maximum ${attr.maxScalars} Unicode characters. ${attr.help}`).join("\n")}\n\nAttributed Markdown quote:\n${page.document.blockquotes.metadataExample}\n\nDirect ProseMirror blockquote:\n${JSON.stringify(page.document.blockquotes.pmJsonExample, null, 2)}\n\nHeadings and the h1:\n rule ${page.document.headings.rule}\n banner and hero ${page.document.headings.claimedFirst}\n later headings ${page.document.headings.laterHeadings}\n depth ${page.document.headings.depth}\n example\n${
2170
2190
  page.document.headings.example.split("\n").map((line) => ` ${line}`).join("\n")
2171
2191
  }\n\nLegal and privacy pages:\n linking Taproot ${page.document.legalAndPrivacyPages.rule}\n example ${page.document.legalAndPrivacyPages.example}\n versioned policies ${page.document.legalAndPrivacyPages.choosing}\n\nTop-level section container:\n${page.sections.example}\n\nSection attributes:\n${
2172
2192
  page.document.sectionNode.attrs.map(formatSectionAttr).join("\n")
@@ -108,13 +108,13 @@ const TAPROOT_STYLES_ENTRIES = {
108
108
  lightCompactLogoId: entry(
109
109
  `${HEADER} > Compact logo`,
110
110
  "Optional site-owned light-scheme logo for a Fixed header above 1.0. Hidden controls retain saved choices.",
111
- "Only while the header is compact: this scheme's compact logo, then the other compact scheme, then the regular logo.",
111
+ "When the header starts shrinking: this scheme's ready compact logo, then the other compact scheme, then the regular logo. Pending or failed compact artwork keeps the regular logo.",
112
112
  ),
113
113
  lightCompactLogoUrl: entry(`${HEADER} > Compact logo`, "Read-only: the delivery URL of lightCompactLogoId."),
114
114
  darkCompactLogoId: entry(
115
115
  `${HEADER} > Compact logo`,
116
116
  "Optional site-owned dark-scheme logo for a Fixed header above 1.0. Hidden controls retain saved choices.",
117
- "Only while the header is compact: this scheme's compact logo, then the other compact scheme, then the regular logo.",
117
+ "When the header starts shrinking: this scheme's ready compact logo, then the other compact scheme, then the regular logo. Pending or failed compact artwork keeps the regular logo.",
118
118
  ),
119
119
  darkCompactLogoUrl: entry(`${HEADER} > Compact logo`, "Read-only: the delivery URL of darkCompactLogoId."),
120
120
  lightCanvasImageId: entry(
@@ -226,7 +226,12 @@ const HEADER_ENTRIES = {
226
226
  headerHeightMultiplier: entry(
227
227
  `${HEADER} > Header height`,
228
228
  "A string such as \"1.8\", from \"1.0\" through \"5.0\" in 0.1 steps. Omit it for standard 1.0; integers normalize to one decimal digit.",
229
- "The primary header bar; extra menu rows and controls keep their size. Fixed headers above 1.0 shrink to standard on scroll; Normal and Sticky retain their height.",
229
+ "The primary header bar; extra menu rows and controls keep their size. Fixed headers above 1.0 shrink with scroll distance from the first scroll movement until reaching the minimum header height (1.0 by default); Normal and Sticky retain their height.",
230
+ ),
231
+ headerMinHeightMultiplier: entry(
232
+ `${HEADER} > Minimum header height`,
233
+ "An optional string from \"1.0\" through \"5.0\" in 0.1 steps, using the same units as headerHeightMultiplier. Omit it for 1.0.",
234
+ "The final Fixed header height. For example, expanded 3.8 and minimum 1.9 shrink from 3.8× to 1.9×. The effective minimum is capped at the expanded height; the saved value is retained. Normal and Sticky ignore it.",
230
235
  ),
231
236
  showThemeToggle: entry(
232
237
  `${HEADER} > Theme toggle`,
@@ -101,6 +101,7 @@ export const SETTINGS_GROUPS = Object.freeze([
101
101
  "navMenuDisplay",
102
102
  "headerPosition",
103
103
  "headerHeightMultiplier",
104
+ "headerMinHeightMultiplier",
104
105
  "lightBrandColor",
105
106
  "darkBrandColor",
106
107
  ),
@@ -209,7 +210,7 @@ export function projectSettingsGroup(group, response) {
209
210
  const source = message !== null && typeof message === "object" && !Array.isArray(message) ? message : {};
210
211
  const projected = {};
211
212
  for (const field of group.fields) {
212
- if (field.name === "headerHeightMultiplier") {
213
+ if (field.name === "headerHeightMultiplier" || field.name === "headerMinHeightMultiplier") {
213
214
  const height = parseHeaderHeightMultiplier(source[field.name]);
214
215
  if (!height) {
215
216
  throw new SiteAuthoringError("api.setting_contract", "Taproot returned an invalid header height multiplier.", {