@taprootio/site-authoring 0.55.0 → 0.59.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/README.md +91 -22
- package/package.json +2 -2
- package/src/api.js +90 -17
- package/src/authors-contract.js +71 -3
- package/src/block-flow.js +4 -2
- package/src/changelog.json +104 -0
- package/src/chrome-additions.js +106 -0
- package/src/chrome-features.js +43 -10
- package/src/chrome-input.js +137 -30
- package/src/chrome-report.js +4 -2
- package/src/cli.js +144 -38
- package/src/constants.js +1 -0
- package/src/content/button-styles.js +27 -0
- package/src/content/components.js +76 -10
- package/src/content/free-form-section-registry.json +9 -0
- package/src/content/free-form-sections.js +55 -16
- package/src/content/markdown.js +133 -56
- package/src/content/media-presentation.js +37 -0
- package/src/content/tiptap-prosemirror.ts +26 -10
- package/src/credentials.js +2 -1
- package/src/delivery-check.js +10 -2
- package/src/font-catalog.js +9 -6
- package/src/footer-content.js +1 -1
- package/src/footer-contract.js +3 -0
- package/src/footer-draft-hash.js +1 -0
- package/src/heading-outline.js +94 -6
- package/src/image-description-contract.js +5 -3
- package/src/image-description-write.js +26 -0
- package/src/index.js +1 -0
- package/src/output.js +2 -1
- package/src/page-metadata.js +15 -13
- package/src/page-structure-checks.js +14 -25
- package/src/placed-image-ids.js +42 -17
- package/src/presentation-reference.js +63 -18
- package/src/problems.js +147 -4
- package/src/reference-help.js +122 -60
- package/src/site-check-findings.js +2 -3
- package/src/site-check-rules.json +0 -1
- package/src/site-health-findings.js +7 -9
- package/src/site-health-image-checks.js +4 -1
- package/src/site-health-precheck.js +23 -6
- package/src/site-navigation-groups.js +16 -0
- package/src/status-warning-paints.js +175 -0
- package/src/template-token-reach.json +13 -18
- package/src/theme-proposals.js +143 -55
- package/src/theme-resolve.js +14 -1
- package/src/theme-validation.js +70 -38
- package/src/token-reach.js +20 -0
- package/src/typed-page-reference.js +25 -3
- package/src/typed-pages.js +73 -14
- package/src/verbs/authors.js +198 -33
- package/src/verbs/changelog.js +23 -2
- package/src/verbs/delivery-check.js +43 -9
- package/src/verbs/index.js +4 -2
- package/src/verbs/media-images.js +4 -4
- package/src/verbs/pages-push.js +138 -67
- package/src/verbs/plan.js +28 -20
- package/src/verbs/pull.js +226 -26
- package/src/verbs/theme-push.js +59 -15
- package/src/verbs/theme-resolve.js +109 -11
- package/src/verbs/validate.js +97 -16
- package/src/workspace-check.js +4 -4
- package/src/workspace-context-usage.js +180 -0
- package/src/workspace.js +48 -1
- package/test/fixtures/default-site-theme.json +1 -1
package/src/problems.js
CHANGED
|
@@ -43,11 +43,151 @@ export function problemsOf(error, context = {}) {
|
|
|
43
43
|
code: error.code,
|
|
44
44
|
...(error.field === undefined ? {} : { field: error.field }),
|
|
45
45
|
...(error.rule === undefined ? {} : { rule: error.rule }),
|
|
46
|
+
...(Number.isSafeInteger(error.markdownLine) ? { line: error.markdownLine } : {}),
|
|
46
47
|
message: error.message,
|
|
47
48
|
}];
|
|
48
49
|
return own.map((problem) => withContext(problem, context, error));
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Names `file` on every problem the refusal carries that has no file yet, so a lone bad page is rethrown as raised
|
|
54
|
+
* and still says where it is. The pre-truncation count survives: `withProblems` resets it to the kept length.
|
|
55
|
+
* Returns the error unchanged when it carries no list.
|
|
56
|
+
*/
|
|
57
|
+
export function attachProblemsFile(error, file) {
|
|
58
|
+
if (!(error instanceof SiteAuthoringError) || !Array.isArray(error.problems) || error.problems.length === 0) return error;
|
|
59
|
+
const count = error.problemCount;
|
|
60
|
+
error.withProblems(error.problems.map((problem) => (problem.file === undefined ? { ...problem, file } : problem)));
|
|
61
|
+
if (Number.isSafeInteger(count) && count > error.problems.length) error.problemCount = count;
|
|
62
|
+
return error;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// A workspace-wide list stops keeping rows at this many; the rest are only counted. It matches the per-error cap in
|
|
66
|
+
// errors.js, so a realistic workspace's output is unchanged and a huge one stays bounded in memory.
|
|
67
|
+
const MAXIMUM_RETAINED_PROBLEMS = 5_000;
|
|
68
|
+
|
|
69
|
+
// What a list dropped past the cap: how many rows, how many distinct refusals only the dropped rows came from (and
|
|
70
|
+
// the rows those refusals dropped past their own cap), and each file's first code. Refusals are never held, so the
|
|
71
|
+
// digest stays small however large the workspace is.
|
|
72
|
+
const OMITTED = Symbol("omitted problems");
|
|
73
|
+
|
|
74
|
+
function omittedOf(list) {
|
|
75
|
+
if (list[OMITTED] === undefined) {
|
|
76
|
+
Object.defineProperty(list, OMITTED, {
|
|
77
|
+
value: { count: 0, sourceCount: 0, sourceExtra: 0, seen: new WeakSet(), retained: undefined, firstCodes: new Map(), areas: new Set() },
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return list[OMITTED];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function keyOf(problem) {
|
|
84
|
+
return problem.file ?? problem.area ?? "";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The files and refusals the list's retained rows already stand for. Built when the first row is dropped. */
|
|
88
|
+
function retainedOf(list, omitted) {
|
|
89
|
+
if (omitted.retained === undefined) {
|
|
90
|
+
const keys = new Set();
|
|
91
|
+
const sources = new WeakSet();
|
|
92
|
+
for (const problem of list) {
|
|
93
|
+
keys.add(keyOf(problem));
|
|
94
|
+
if (problem[SOURCE] !== undefined) sources.add(problem[SOURCE]);
|
|
95
|
+
}
|
|
96
|
+
omitted.retained = { keys, sources };
|
|
97
|
+
}
|
|
98
|
+
return omitted.retained;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function noteOmitted(list, problem) {
|
|
102
|
+
const omitted = omittedOf(list);
|
|
103
|
+
const retained = retainedOf(list, omitted);
|
|
104
|
+
omitted.count += 1;
|
|
105
|
+
if (problem.area !== undefined) omitted.areas.add(problem.area);
|
|
106
|
+
const source = problem[SOURCE];
|
|
107
|
+
if (source !== undefined && !retained.sources.has(source) && !omitted.seen.has(source)) {
|
|
108
|
+
omitted.seen.add(source);
|
|
109
|
+
omitted.sourceCount += 1;
|
|
110
|
+
omitted.sourceExtra += sourceOmissions(source);
|
|
111
|
+
}
|
|
112
|
+
const key = keyOf(problem);
|
|
113
|
+
if (!retained.keys.has(key) && !omitted.firstCodes.has(key)) {
|
|
114
|
+
omitted.firstCodes.set(key, { code: problem.code, area: problem.area, file: problem.file });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** The rows one refusal dropped past its own cap. */
|
|
119
|
+
function sourceOmissions(source) {
|
|
120
|
+
const kept = Array.isArray(source?.problems) ? source.problems.length : 0;
|
|
121
|
+
return Number.isSafeInteger(source?.problemCount) && source.problemCount > kept ? source.problemCount - kept : 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Appends one problem, or counts it once the list holds the cap. */
|
|
125
|
+
function addProblem(target, item) {
|
|
126
|
+
if (target.length < MAXIMUM_RETAINED_PROBLEMS) target.push(item);
|
|
127
|
+
else noteOmitted(target, item);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Appends every item of `items` to `target`, keeping at most the cap and counting the rest. Looping rather than
|
|
132
|
+
* spreading also avoids the RangeError a spread push throws past a few hundred thousand arguments. Whatever
|
|
133
|
+
* `items` had already dropped carries over.
|
|
134
|
+
*/
|
|
135
|
+
export function appendAll(target, items) {
|
|
136
|
+
for (const item of items) addProblem(target, item);
|
|
137
|
+
const carried = items[OMITTED];
|
|
138
|
+
if (carried !== undefined) {
|
|
139
|
+
const omitted = omittedOf(target);
|
|
140
|
+
const keys = new Set(target.map(keyOf));
|
|
141
|
+
omitted.count += carried.count;
|
|
142
|
+
omitted.sourceCount += carried.sourceCount;
|
|
143
|
+
omitted.sourceExtra += carried.sourceExtra;
|
|
144
|
+
for (const area of carried.areas) omitted.areas.add(area);
|
|
145
|
+
for (const [key, entry] of carried.firstCodes) {
|
|
146
|
+
if (!keys.has(key) && !omitted.firstCodes.has(key)) omitted.firstCodes.set(key, entry);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return target;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** The first code of every file whose problems the list dropped, for a digest that notices them change. */
|
|
153
|
+
export function omittedProblemDigest(list) {
|
|
154
|
+
return [...(list[OMITTED]?.firstCodes ?? [])].map(([key, entry]) => [key, entry.code]);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The areas any dropped row belonged to, so a step blocked only by dropped rows is still blocked. */
|
|
158
|
+
export function omittedAreas(list) {
|
|
159
|
+
return list[OMITTED]?.areas ?? new Set();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** The first code and area of each file the list dropped every problem of, for a check that reports per file. */
|
|
163
|
+
export function omittedFileCodes(list) {
|
|
164
|
+
return [...(list[OMITTED]?.firstCodes ?? [])].map(([, entry]) => entry).filter((entry) => entry.file !== undefined);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** How many distinct refusals the list stands for, retained or dropped. */
|
|
168
|
+
function sourceTotal(list) {
|
|
169
|
+
const retained = new Set(list.map((problem) => problem[SOURCE]).filter((source) => source !== undefined));
|
|
170
|
+
return retained.size + (list[OMITTED]?.sourceCount ?? 0);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* How many problems the list stands for: its rows, the rows it dropped past the cap, and the rows each refusal
|
|
175
|
+
* dropped past its own cap.
|
|
176
|
+
*/
|
|
177
|
+
export function problemTotal(list) {
|
|
178
|
+
const retained = new Set(list.map((problem) => problem[SOURCE]).filter((source) => source !== undefined));
|
|
179
|
+
let omitted = (list[OMITTED]?.count ?? 0) + (list[OMITTED]?.sourceExtra ?? 0);
|
|
180
|
+
for (const source of retained) omitted += sourceOmissions(source);
|
|
181
|
+
return list.length + omitted;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Attaches `problems` to `error` with the full count, not the retained length. */
|
|
185
|
+
export function withFullProblems(error, problems) {
|
|
186
|
+
error.withProblems(problems);
|
|
187
|
+
error.problemCount = problemTotal(problems);
|
|
188
|
+
return error;
|
|
189
|
+
}
|
|
190
|
+
|
|
51
191
|
/**
|
|
52
192
|
* Runs `action`, adding its refusal to `problems` instead of throwing. Returns
|
|
53
193
|
* the action's value, or undefined when it refused.
|
|
@@ -57,7 +197,7 @@ export async function collectProblems(problems, context, action) {
|
|
|
57
197
|
return await action();
|
|
58
198
|
} catch (error) {
|
|
59
199
|
if (!(error instanceof SiteAuthoringError)) throw error;
|
|
60
|
-
problems
|
|
200
|
+
appendAll(problems, problemsOf(error, context));
|
|
61
201
|
return undefined;
|
|
62
202
|
}
|
|
63
203
|
}
|
|
@@ -71,14 +211,17 @@ export async function collectProblems(problems, context, action) {
|
|
|
71
211
|
*/
|
|
72
212
|
export function problemsError(problems, summary) {
|
|
73
213
|
const [first] = problems;
|
|
74
|
-
if (problems.every((problem) => problem[SOURCE]
|
|
214
|
+
if (sourceTotal(problems) === 1 && problems.every((problem) => problem[SOURCE] === first[SOURCE])) {
|
|
75
215
|
return first[SOURCE];
|
|
76
216
|
}
|
|
77
|
-
|
|
217
|
+
const total = problemTotal(problems);
|
|
218
|
+
const merged = new SiteAuthoringError(
|
|
78
219
|
first[SOURCE]?.code ?? first.code,
|
|
79
|
-
`${summary}: ${
|
|
220
|
+
`${summary}: ${total} problems. First: ${first[SOURCE]?.message ?? first.message}`,
|
|
80
221
|
{ field: first[SOURCE]?.field ?? first.field ?? first.file },
|
|
81
222
|
).withProblems(problems);
|
|
223
|
+
merged.problemCount = total;
|
|
224
|
+
return merged;
|
|
82
225
|
}
|
|
83
226
|
|
|
84
227
|
// A whole-workspace check can find thousands of problems. A JSON result keeps
|
package/src/reference-help.js
CHANGED
|
@@ -99,7 +99,7 @@ import {
|
|
|
99
99
|
|
|
100
100
|
export { getAppearanceReference, getFooterReference, getSettingsReference, getThemeReference };
|
|
101
101
|
|
|
102
|
-
export const REFERENCE_VERSION =
|
|
102
|
+
export const REFERENCE_VERSION = 83;
|
|
103
103
|
|
|
104
104
|
// The date-limit examples `help forms` prints; tests run them through the form validator.
|
|
105
105
|
export const FORM_DATE_WINDOW_FIELD = Object.freeze({
|
|
@@ -406,6 +406,11 @@ export const REFERENCE_TOPICS = Object.freeze([
|
|
|
406
406
|
usage: `${CLI_BINARY_NAME} help page <page-type>`,
|
|
407
407
|
summary: "Describe one page type.",
|
|
408
408
|
}),
|
|
409
|
+
Object.freeze({
|
|
410
|
+
name: "sections",
|
|
411
|
+
usage: `${CLI_BINARY_NAME} help sections`,
|
|
412
|
+
summary: "Describe free-form sections: fields, photo backgrounds, decorations, contexts, and where each block may sit.",
|
|
413
|
+
}),
|
|
409
414
|
Object.freeze({
|
|
410
415
|
name: "components",
|
|
411
416
|
usage: `${CLI_BINARY_NAME} help components`,
|
|
@@ -534,7 +539,7 @@ const WORKFLOW_REFERENCES = Object.freeze({
|
|
|
534
539
|
+ "part of wp:post_date). Categories beyond the first, and all tags, have no Taproot equivalent (tags are "
|
|
535
540
|
+ "generated per page type): list them. The featured image becomes coverImage on typed pages, and the same image must also appear in the page's own content (put it at the top of the body), or the site refuses the cover; a free-form page "
|
|
536
541
|
+ "has none, so list it.",
|
|
537
|
-
"Content. Convert the HTML to the Markdown subset. Keep body headings from h2 to h4 (deeper levels are refused, so make h5 and h6 an h4). The h1 depends on the template: an article or place review prints its title as the h1, so its body starts at h2 (a recipe and an album print their titles too; their fixed level-2 headings are set out below); a free-form page prints no title, so open its Markdown with a '# ' line holding the page title (
|
|
542
|
+
"Content. Convert the HTML to the Markdown subset. Keep body headings from h2 to h4 (deeper levels are refused, so make h5 and h6 an h4). The h1 depends on the template: an article or place review prints its title as the h1, so its body starts at h2 (a recipe and an album print their titles too; their fixed level-2 headings are set out below); a free-form page prints no title, so open its Markdown with a '# ' line holding the page title (a level-1 heading becomes the h1 when no earlier content has claimed it; see help page free-form). Decode HTML entities (&, ’) in titles, excerpts, menu labels and term names; WordPress stores them encoded. An image "
|
|
538
543
|
+ "must stand alone in its own block, so split paragraphs around images and lift images out of links; a link "
|
|
539
544
|
+ "to the full-size file is dropped, so list it. Tables need a header row and 2 to 12 columns, else write "
|
|
540
545
|
+ "a list and report it. Remove Gutenberg block comments and the more-tag marker. In a recipe, times and servings "
|
|
@@ -550,7 +555,14 @@ const WORKFLOW_REFERENCES = Object.freeze({
|
|
|
550
555
|
+ "files a run). It records every file in .taproot-site-media.json and reports counts and a bounded item list; "
|
|
551
556
|
+ "a run that stopped partway is safe to repeat, because identical files deduplicate.",
|
|
552
557
|
"Check before sending. 'validate' (no credential, no request, unless --site) checks every page source, media reference and "
|
|
553
|
-
+ "setting in the workspace at once and lists
|
|
558
|
+
+ "setting in the workspace at once and lists the refusing validators' findings in error.problems with their code and an optional field (most name a file too; an ordinary .pm.json document finding "
|
|
559
|
+
+ "puts its source path in a file-qualified field, as pages/post.pm.json:data.body, and a refusal that merges several files also adds file, "
|
|
560
|
+
+ "while a .pm.json recipe step finding carries file and a document-relative field), "
|
|
561
|
+
+ "and a line field for a Markdown page when the problem has a source line: every problem in a .pm.json page, "
|
|
562
|
+
+ "and every section decoration, background and section-owned image problem in a free-form Markdown page. Any other "
|
|
563
|
+
+ "Markdown problem, or a decoration or background problem in a typed page such as an article, stops that file at "
|
|
564
|
+
+ "its first; recipe steps report all of theirs. The JSON keeps the problems that fit its size budget (problemCount "
|
|
565
|
+
+ "and problemsTruncated say what was cut; at most 5,000 are kept), and stderr lists the kept ones. "
|
|
554
566
|
+ "'validate --site' also reads the site's image records and reports each placed image with no default description "
|
|
555
567
|
+ "in imageFindings, with the 'media images describe' command to fix it. "
|
|
556
568
|
+ "'pages push --dry-run' then checks the pages against the live site — paths taken, templates, revisions, "
|
|
@@ -579,7 +591,17 @@ const WORKFLOW_REFERENCES = Object.freeze({
|
|
|
579
591
|
"A completed deployment job proves Taproot wrote what it meant to write, not that a visitor receives it. The "
|
|
580
592
|
+ "check verifies the latest completed deployment for the target, and notes when the workspace recorded a "
|
|
581
593
|
+ "different one.",
|
|
582
|
-
"Routes
|
|
594
|
+
"Routes are the pages a published site links in the workspace manifest (a saved page id, published or "
|
|
595
|
+
+ "approved) plus '/', bounded to 20; run pull after approving pages in the app so their statuses are current. "
|
|
596
|
+
+ "Saved pages whose manifest status is another one are omitted from that route sample and listed in "
|
|
597
|
+
+ "uncheckedRoutes (path and reason, bounded to 20 with a total and fitted to the output bound, never '/'). "
|
|
598
|
+
+ "A stale draft status says nothing about whether the deployed site links the page, so the summary says "
|
|
599
|
+
+ "they were left out of the sample because of their manifest status, not that they are unchecked: the "
|
|
600
|
+
+ "check may still fetch one as a link from another page. The verdict covers the sampled routes and the checks made from them "
|
|
601
|
+
+ "(verdictCovers). verdictCovers and uncheckedRoutes are in every delivery report, a failed one included: uncheckedRoutes has "
|
|
602
|
+
+ "no items and a total of 0 when no saved manifest page was left out for its status. With no manifest the sample holds only '/', "
|
|
603
|
+
+ "so a total of 0 does not show that the other deployed pages were covered. The 20-route bound is reported separately as "
|
|
604
|
+
+ "routes.truncated. Each sampled route must answer 200 text/html "
|
|
583
605
|
+ "without redirecting. Internal link targets found in those pages are checked too (bounded to 40).",
|
|
584
606
|
"Assets are what the home page declares: favicon links, module preloads, the site bundle, and up to six "
|
|
585
607
|
+ "images. A 200 is not enough: the content type must match the kind, so an HTML error page served as an "
|
|
@@ -1083,7 +1105,7 @@ const WORKFLOW_REFERENCES = Object.freeze({
|
|
|
1083
1105
|
details: Object.freeze([
|
|
1084
1106
|
"media images list returns one page in images.items and images.nextPageToken; pass --page-size 1–100 (default 25) and --page-token with that exact cursor for the next page. --missing-description is a server-side filter for a null image-owned default, independent of placement alt text, captions or decorative mode. No per-result reads or page-body scans run. The authoritative default-completeness findings are in the stored deployment report that health --staging reads after staging. Before staging, validate --site and pages push report the images the workspace places whose default is missing (imageFindings, with the exact media images describe command), reading the site's image records; without --describe-missing-images they never infer a default from placement strings, and a placement's alt text only suggests the text for that command. pages push --describe-missing-images (also with --dry-run) is the one push path that fills a missing default: it sets each such image's default from the one alt text its selected custom or unset placements agree on, never over an existing description, and reports describedImages (set and skipped, each with its total, and the skip reason of every image it left).",
|
|
1085
1107
|
"media images get <image-id> reads one library image in the selected site. Both reads expose imageId, uploadedName, defaultDescription (null when missing), descriptionRevision as a decimal string, width, height, processingState, previewUrl and responsivePreviewUrls. Preview URLs are for inspection, may expire, and are omitted from GITHUB_OUTPUT. They are not descriptions and these verbs write no workspace file.",
|
|
1086
|
-
"media images describe <image-id> --description <text> --expected-revision <n> saves the default; --clear replaces --description to remove it. Supply the exact revision from list/get, including 0. --if-missing is an atomic server condition, requires nonblank text, and refuses an existing default. Conflicts report media.image_description_conflict or media.image_description_exists with exit 1; read the current image and reconcile, never retry by overwriting it blindly. Input/option errors use exit 2.",
|
|
1108
|
+
"media images describe <image-id> --description <text> --expected-revision <n> saves the default; --clear replaces --description to remove it. Supply the exact revision from list/get, including 0; the revision counts description text changes, so a described-then-cleared image is above 0. With --if-missing alone the CLI reads the current revision itself and refuses (media.image_description_exists) before writing when text exists. --if-missing is also an atomic server condition, requires nonblank text, and refuses an existing default. Conflicts report media.image_description_conflict or media.image_description_exists with exit 1; read the current image and reconcile, never retry by overwriting it blindly. Input/option errors use exit 2.",
|
|
1087
1109
|
"The server owns the 1000-Unicode-scalar limit: outer whitespace is trimmed, blank text becomes null, and oversized text is rejected without truncation. Descriptions may contain Unicode and newlines. The CLI preserves their text in JSON and never copies preview URLs or resolved defaults into page bodies. Site media management is required for all three verbs; profile/account/installation media are excluded. A default edit affects inherited usages at the next selected deployment; current published and in-flight snapshots keep their frozen text, while contextual overrides and decorative placements keep their choices.",
|
|
1088
1110
|
"Paths are relative to the configured workspace root, not the shell's current directory.",
|
|
1089
1111
|
"PNG, JPEG, GIF, and WebP are accepted. Each file uploads as its own image: a name such as logo@2x.png is only a filename, nothing pairs it with logo.png, and the platform generates the display sizes from the one file you assign (see help appearance for logos).",
|
|
@@ -1460,18 +1482,18 @@ function decorationReference() {
|
|
|
1460
1482
|
additionalProperties: false,
|
|
1461
1483
|
fields: sectionAttributeReference().find((attr) => attr.name === "decoration").fields,
|
|
1462
1484
|
deliveryUrlPolicy:
|
|
1463
|
-
"
|
|
1485
|
+
"As for the background images: a media path in Markdown (such as \"media/starburst.webp\"), the complete processed-image record in .pm.json, with the same delivery URL rules.",
|
|
1464
1486
|
tintTokens: Object.freeze({ ...DECORATION_DEFINITION.fields.tint.tokenByValue }),
|
|
1465
1487
|
example: DECORATION_EXAMPLE,
|
|
1466
1488
|
markdownExample: `:::section ${
|
|
1467
1489
|
JSON.stringify({ decoration: { ...DECORATION_EXAMPLE, image: "media/starburst.webp" } })
|
|
1468
1490
|
}\n## Rooted in warmth\n\nMove with confidence.\n:::`,
|
|
1469
1491
|
maskGuidance:
|
|
1470
|
-
"Use a transparent PNG or WebP whose alpha channel
|
|
1492
|
+
"Use a transparent PNG or WebP whose alpha channel holds only the mark; the section context tints it in both schemes.",
|
|
1471
1493
|
sizeGuidance:
|
|
1472
|
-
"Set inlineSizePercent to size the art by the section's width, or blockSizePercent to size
|
|
1494
|
+
"Set inlineSizePercent to size the art by the section's width, or blockSizePercent by its height; the two cannot be combined. Or set repeat to tile a small seamless image: \"repeat\" tiles both ways at its natural size, with neither size; \"repeat-x\" and \"repeat-y\" tile along one axis and take either size. Leave repeat out for no tiling; true and false are refused.",
|
|
1473
1495
|
opaqueWarning:
|
|
1474
|
-
"An opaque rectangle
|
|
1496
|
+
"An opaque rectangle renders as a tinted rectangle, not a cut-out mark.",
|
|
1475
1497
|
});
|
|
1476
1498
|
}
|
|
1477
1499
|
|
|
@@ -1724,6 +1746,29 @@ const TABLE_REFERENCE = tableReference();
|
|
|
1724
1746
|
const INLINE_FACTS_REFERENCE = inlineFactsReference();
|
|
1725
1747
|
const BACKGROUND_REFERENCE = backgroundReference();
|
|
1726
1748
|
|
|
1749
|
+
const SECTIONS_REFERENCE = Object.freeze({
|
|
1750
|
+
summary: "The :::section container for free-form pages: its fields, photo backgrounds, decorations, and where each block may sit.",
|
|
1751
|
+
node: Object.freeze({
|
|
1752
|
+
type: FREE_FORM_SECTION_REGISTRY.section.nodeType,
|
|
1753
|
+
label: FREE_FORM_SECTION_REGISTRY.section.label,
|
|
1754
|
+
help: FREE_FORM_SECTION_REGISTRY.section.help,
|
|
1755
|
+
minimumChildren: FREE_FORM_SECTION_REGISTRY.section.minimumChildren,
|
|
1756
|
+
additionalProperties: false,
|
|
1757
|
+
attrs: Object.freeze(sectionAttributeReference()),
|
|
1758
|
+
content: "ordinary flow blocks or columns layouts; sections may not nest",
|
|
1759
|
+
}),
|
|
1760
|
+
markdownSyntax: ":::section {JSON object}\nordinary structured Markdown\n:::",
|
|
1761
|
+
example:
|
|
1762
|
+
":::section {\"context\":\"inverted\",\"contentPadding\":\"standard\",\"surface\":\"none\"}\n## A real band\n\nOrdinary structured Markdown remains editable here.\n:::",
|
|
1763
|
+
topLevelOnly: true,
|
|
1764
|
+
defaults: Object.freeze(Object.fromEntries(
|
|
1765
|
+
Object.entries(FREE_FORM_SECTION_REGISTRY.section.attrs).map(([name, definition]) => [name, definition.default]),
|
|
1766
|
+
)),
|
|
1767
|
+
background: BACKGROUND_REFERENCE,
|
|
1768
|
+
decoration: decorationReference(),
|
|
1769
|
+
placementMatrix: placementMatrix(),
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1727
1772
|
const FREE_FORM_REFERENCE = Object.freeze({
|
|
1728
1773
|
type: "free-form",
|
|
1729
1774
|
displayName: "Free-form page",
|
|
@@ -1738,8 +1783,8 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1738
1783
|
internalState:
|
|
1739
1784
|
`${INTERNAL_PAGE_BASELINE_DIRECTORY}/<pageId>.pm.json holds the site's document for tracked Markdown. `
|
|
1740
1785
|
+ "<pageId>.revision.json records the revision a refused pull showed for a recovery push. These files are "
|
|
1741
|
-
+ "never discovered as a page source or pushed. A reconciled pull rewrites or removes them.
|
|
1742
|
-
formatChange: "Remove the tracked source before writing the other format.
|
|
1786
|
+
+ "never discovered as a page source or pushed. A reconciled pull rewrites or removes them.",
|
|
1787
|
+
formatChange: "Remove the tracked source before writing the other format.",
|
|
1743
1788
|
formatChangeError: "pages.path_conflict",
|
|
1744
1789
|
renamedSource: "If a renamed source occupies another page's fallback file, rename or remove it and pull again.",
|
|
1745
1790
|
renamedSourceError: "pages.source_conflict",
|
|
@@ -1748,8 +1793,7 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1748
1793
|
+ "pull saves the site version internally and refuses before editing pages/. For .pm.json, pull refreshes the site "
|
|
1749
1794
|
+ "version unless the body or manifest metadata (title, path, description or author) also has local edits. "
|
|
1750
1795
|
+ "Revision covers the stored body, title, path, short description and cover image. Approval, staging and production "
|
|
1751
|
-
+ "leave authored revisions alone. Publishing a legal page stamps its version and changes its revision.
|
|
1752
|
-
+ "Place review category overrides affect the release alone.",
|
|
1796
|
+
+ "leave authored revisions alone. Publishing a legal page stamps its version and changes its revision.",
|
|
1753
1797
|
conflictError: "pages.pull_conflict",
|
|
1754
1798
|
metadata:
|
|
1755
1799
|
"A .pm.json page's title, path and description live in the manifest. Edit title or description with "
|
|
@@ -1761,15 +1805,32 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1761
1805
|
+ "matter for any template or use pages meta set <path> --author for .pm.json. Use a site author's handle "
|
|
1762
1806
|
+ "(jane-doe) or the email of a member who can create pages. authors list refreshes authors.json. "
|
|
1763
1807
|
+ "authors add <handle> --name <name> [--email <address>] creates a site author with a private email, "
|
|
1764
|
-
+ "a byline and structured data.
|
|
1765
|
-
+ "
|
|
1766
|
-
+ "
|
|
1808
|
+
+ "a byline and structured data. "
|
|
1809
|
+
+ "A site author's byline can link to a page on the site (--link-page <path or resourceId>) or a web address "
|
|
1810
|
+
+ "(--link-url <address>), never both (authors.link_conflict), and show an image from the media library "
|
|
1811
|
+
+ "(--image <media path or image id>). authors set <handle> changes the name, email, link or image, sending "
|
|
1812
|
+
+ "only what is passed; --no-link, --no-image and --no-email clear. It asks for the deployments capability "
|
|
1813
|
+
+ "because changing the byline of an author on published pages queues a deployment (authors.deployment_refused "
|
|
1814
|
+
+ "when that is not allowed). authors.json records each author's link and image. "
|
|
1815
|
+
+ "Reusing a handle and name returns existing: true; a link or image is compared only when its option is "
|
|
1816
|
+
+ "passed. A difference triggers authors.handle_taken and points at authors set. "
|
|
1817
|
+
+ "Only the CLI assigns authors, and only to authorless pages. "
|
|
1767
1818
|
+ "A different author triggers pages.author_conflict. Restore the site's author in front matter or with "
|
|
1768
1819
|
+ "pages meta set <path> --author. Use --author \"\" to clear an unsent assignment. "
|
|
1769
1820
|
+ "Offline validate and pages meta set warn pages.author_unverified on authors.json misses. pages push "
|
|
1770
1821
|
+ "and plan check the live list once on a miss. Unknown or ineligible authors trigger pages.author_unknown. "
|
|
1771
|
-
+ "Text that is neither a handle nor an address triggers pages.author_invalid."
|
|
1772
|
-
|
|
1822
|
+
+ "Text that is neither a handle nor an address triggers pages.author_invalid. "
|
|
1823
|
+
// Kept to one sentence: every page type's help carries this rule, and the free-form help is near its
|
|
1824
|
+
// output bound. The typed page's field help holds the detail (TR01402).
|
|
1825
|
+
+ "displayAuthor on a typed page names a site author for the byline instead of the member; that page "
|
|
1826
|
+
+ "type's field help has the rules.",
|
|
1827
|
+
authorshipErrors: Object.freeze([
|
|
1828
|
+
"pages.author_invalid",
|
|
1829
|
+
"pages.author_unknown",
|
|
1830
|
+
"pages.author_conflict",
|
|
1831
|
+
"pages.display_author_invalid",
|
|
1832
|
+
"pages.display_author_unknown",
|
|
1833
|
+
]),
|
|
1773
1834
|
conflictDetail:
|
|
1774
1835
|
"error.differences is absent when the workspace has no baseline document to compare. An empty list means "
|
|
1775
1836
|
+ "only title, path, description, cover image or display date changed. Otherwise it lists changed JSON body paths. "
|
|
@@ -1851,6 +1912,8 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1851
1912
|
root: Object.freeze({ type: "doc", content: "array of supported block nodes" }),
|
|
1852
1913
|
nodes: NODE_TYPES,
|
|
1853
1914
|
marks: MARK_TYPES,
|
|
1915
|
+
// TR01420: hardBreak is listed in nodes, so say how Markdown writes one.
|
|
1916
|
+
hardBreak: "In Markdown, end a line with a backslash or two spaces for a hard break.",
|
|
1854
1917
|
// TR01190: what a link mark's rel and target publish as.
|
|
1855
1918
|
links: Object.freeze({
|
|
1856
1919
|
markdown: '[Shop](https://shop.example){rel="sponsored nofollow" target="_blank"}',
|
|
@@ -1892,11 +1955,13 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1892
1955
|
headings: Object.freeze({
|
|
1893
1956
|
rule:
|
|
1894
1957
|
"A free-form page renders no automatic heading: its title is not printed on the page. "
|
|
1895
|
-
+ "
|
|
1958
|
+
+ "A level-1 heading ('#' in Markdown) becomes the page's h1 when no earlier content has claimed it, so open the Markdown with '# Page title'. A "
|
|
1896
1959
|
+ "structured page (article, recipe, album, place review) prints its title as the h1, so its body starts at '## '.",
|
|
1897
1960
|
claimedFirst:
|
|
1898
|
-
"
|
|
1899
|
-
+ "
|
|
1961
|
+
"The first title on the page claims the h1: a hero-section with a title, an image-banner with overlay text that opens the page, or a '# ' heading. "
|
|
1962
|
+
+ "Anything that comes later publishes as an h2, a hero-section title included, and validate reports it as seo.h1_demoted, so put the hero first when it should be the h1. Without a hero or banner, write the '# ' heading yourself. "
|
|
1963
|
+
+ "validate cannot see an integration placement's rendered h1 (a placement has no HTML in the document), so an earlier placement can make a '# ' heading or a hero title render as an h2 without an seo.h1_demoted finding, "
|
|
1964
|
+
+ "and a page whose only h1 comes from a placement can still receive seo.h1_missing; check the published page. Adopted fragments are different: their stored HTML is visible to validate and can trigger seo.h1_demoted.",
|
|
1900
1965
|
laterHeadings:
|
|
1901
1966
|
"Any later '# ' heading renders as an h2, like the other top-level sections, never as a second h1, "
|
|
1902
1967
|
+ "and the other headings are renumbered so none skips a level.",
|
|
@@ -1916,15 +1981,6 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1916
1981
|
componentData: "JSON string containing that component's data object",
|
|
1917
1982
|
}),
|
|
1918
1983
|
}),
|
|
1919
|
-
sectionNode: Object.freeze({
|
|
1920
|
-
type: FREE_FORM_SECTION_REGISTRY.section.nodeType,
|
|
1921
|
-
label: FREE_FORM_SECTION_REGISTRY.section.label,
|
|
1922
|
-
help: FREE_FORM_SECTION_REGISTRY.section.help,
|
|
1923
|
-
minimumChildren: FREE_FORM_SECTION_REGISTRY.section.minimumChildren,
|
|
1924
|
-
additionalProperties: false,
|
|
1925
|
-
attrs: Object.freeze(sectionAttributeReference()),
|
|
1926
|
-
content: "ordinary flow blocks or columns layouts; sections may not nest",
|
|
1927
|
-
}),
|
|
1928
1984
|
integrationPlacementNode: Object.freeze({
|
|
1929
1985
|
type: "integrationPlacement",
|
|
1930
1986
|
attrs: Object.freeze({
|
|
@@ -1943,18 +1999,8 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1943
1999
|
note: "Adopted integration content: preserved or deleted, never authored.",
|
|
1944
2000
|
}),
|
|
1945
2001
|
}),
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
example:
|
|
1949
|
-
":::section {\"context\":\"inverted\",\"contentPadding\":\"standard\",\"surface\":\"none\"}\n## A real band\n\nOrdinary structured Markdown remains editable here.\n:::",
|
|
1950
|
-
topLevelOnly: true,
|
|
1951
|
-
defaults: Object.freeze(Object.fromEntries(
|
|
1952
|
-
Object.entries(FREE_FORM_SECTION_REGISTRY.section.attrs).map(([name, definition]) => [name, definition.default]),
|
|
1953
|
-
)),
|
|
1954
|
-
background: BACKGROUND_REFERENCE,
|
|
1955
|
-
decoration: decorationReference(),
|
|
1956
|
-
placementMatrix: placementMatrix(),
|
|
1957
|
-
}),
|
|
2002
|
+
// TR01420: the section reference lives in 'help sections' so this topic stays within the output limit.
|
|
2003
|
+
sectionsPointer: `Sections (the :::section container, its fields, photo backgrounds, decorations, and where each block may sit) are in '${CLI_BINARY_NAME} help sections'.`,
|
|
1958
2004
|
columns: Object.freeze({
|
|
1959
2005
|
pageType: "free-form",
|
|
1960
2006
|
placement: "Directly inside a top-level section only. Each region contains ordinary flow blocks; no nested layouts or full-width bands.",
|
|
@@ -1989,6 +2035,13 @@ const FREE_FORM_REFERENCE = Object.freeze({
|
|
|
1989
2035
|
]),
|
|
1990
2036
|
});
|
|
1991
2037
|
|
|
2038
|
+
export function getSectionsReference() {
|
|
2039
|
+
return SECTIONS_REFERENCE;
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
/** True of every page type, so `help pages` owns it and the type topics do not repeat it. */
|
|
2043
|
+
export const PAGE_SOURCE_CONFLICT_RULE = "Two sources for one path are refused (pages.path_conflict).";
|
|
2044
|
+
|
|
1992
2045
|
export function listPageTypeReferences() {
|
|
1993
2046
|
return PAGE_TYPES.map((type) => {
|
|
1994
2047
|
const reference = type === "free-form" ? FREE_FORM_REFERENCE : getTypedPageReference(type);
|
|
@@ -2112,6 +2165,9 @@ function schemaConstraints(schema) {
|
|
|
2112
2165
|
if (schema.applicationRegistered?.accepted === true) {
|
|
2113
2166
|
constraints.push(`application-registered names accepted; ${schema.applicationRegistered.requirement}`);
|
|
2114
2167
|
}
|
|
2168
|
+
if (schema.valueDescriptions !== undefined) {
|
|
2169
|
+
for (const [value, text] of Object.entries(schema.valueDescriptions)) constraints.push(`${value}: ${text.replace(/\.$/u, "")}`);
|
|
2170
|
+
}
|
|
2115
2171
|
if (schema.description) constraints.push(schema.description);
|
|
2116
2172
|
return constraints;
|
|
2117
2173
|
}
|
|
@@ -2226,12 +2282,33 @@ function formatDesignRecipe(recipe) {
|
|
|
2226
2282
|
}`;
|
|
2227
2283
|
}
|
|
2228
2284
|
|
|
2285
|
+
function formatSectionsReference(sections) {
|
|
2286
|
+
return `Top-level section container:\n${sections.example}\n\nSection attributes:\n${
|
|
2287
|
+
sections.node.attrs.map(formatSectionAttr).join("\n")
|
|
2288
|
+
}\n\nSection photo background (closed object):\n${
|
|
2289
|
+
sections.background.fields.map((field) => formatRegistryField(field)).join("\n")
|
|
2290
|
+
}\n delivery URLs ${sections.background.deliveryUrlPolicy}\n compact behavior ${sections.background.compactBehavior}\n\nScrim opacity mapping:\n${
|
|
2291
|
+
Object.entries(sections.background.scrimOpacityByValue).map(([name, opacity]) =>
|
|
2292
|
+
` ${name.padEnd(20)} ${opacity}`
|
|
2293
|
+
).join("\n")
|
|
2294
|
+
}\n\nResponsive background example:\n${sections.background.markdownExample}\n\nSection decoration (closed object):\n${
|
|
2295
|
+
sections.decoration.fields.map((field) => formatRegistryField(field)).join("\n")
|
|
2296
|
+
}\n delivery URLs ${sections.decoration.deliveryUrlPolicy}\n\nTint mapping:\n${
|
|
2297
|
+
Object.entries(sections.decoration.tintTokens).map(([name, token]) => ` ${name.padEnd(20)} ${token}`)
|
|
2298
|
+
.join("\n")
|
|
2299
|
+
}\n\nTransparent-mask example:\n${sections.decoration.markdownExample}\n\nMask guidance: ${sections.decoration.maskGuidance}\nSize guidance: ${sections.decoration.sizeGuidance}\nWarning: ${sections.decoration.opaqueWarning}\n\nRoot defaults and placement:\n${
|
|
2300
|
+
sections.placementMatrix.map(formatPlacement).join("\n")
|
|
2301
|
+
}\n`;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2229
2304
|
export function formatReferenceResult(result) {
|
|
2230
2305
|
switch (result.topic) {
|
|
2231
2306
|
case "fonts":
|
|
2232
2307
|
return formatFontCatalog(result.fonts);
|
|
2233
2308
|
case "tokens":
|
|
2234
2309
|
return formatTokenReference(result);
|
|
2310
|
+
case "sections":
|
|
2311
|
+
return formatSectionsReference(result.sections);
|
|
2235
2312
|
case "topics":
|
|
2236
2313
|
return `Usage: ${CLI_BINARY_NAME} help <topic> [name] [--json]\n\nReference topics:\n${
|
|
2237
2314
|
result.topics.map((topic) => ` ${topic.usage.padEnd(48)} ${topic.summary}`).join("\n")
|
|
@@ -2241,7 +2318,7 @@ export function formatReferenceResult(result) {
|
|
|
2241
2318
|
result.pageTypes.map((page) =>
|
|
2242
2319
|
` ${page.type.padEnd(16)} ${page.summary}\n${" ".repeat(19)}Help: ${page.helpCommand}`
|
|
2243
2320
|
).join("\n")
|
|
2244
|
-
}\n`;
|
|
2321
|
+
}\n\n${result.sourceRule}\n`;
|
|
2245
2322
|
case "component-types":
|
|
2246
2323
|
return `Free-form components:\n${
|
|
2247
2324
|
result.components.map((component) =>
|
|
@@ -2290,26 +2367,11 @@ export function formatReferenceResult(result) {
|
|
|
2290
2367
|
page.document.nodes.join(", ")
|
|
2291
2368
|
}\nSupported marks: ${
|
|
2292
2369
|
page.document.marks.join(", ")
|
|
2293
|
-
}\n\nLinks:\n markdown ${page.document.links.markdown}\n rel ${
|
|
2370
|
+
}\nHard break: ${page.document.hardBreak}\n\nLinks:\n markdown ${page.document.links.markdown}\n rel ${
|
|
2294
2371
|
page.document.links.rel.join(", ")
|
|
2295
2372
|
}\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${
|
|
2296
2373
|
page.document.headings.example.split("\n").map((line) => ` ${line}`).join("\n")
|
|
2297
|
-
}\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\
|
|
2298
|
-
page.document.sectionNode.attrs.map(formatSectionAttr).join("\n")
|
|
2299
|
-
}\n\nSection photo background (closed object):\n${
|
|
2300
|
-
page.sections.background.fields.map((field) => formatRegistryField(field)).join("\n")
|
|
2301
|
-
}\n delivery URLs ${page.sections.background.deliveryUrlPolicy}\n compact behavior ${page.sections.background.compactBehavior}\n\nScrim opacity mapping:\n${
|
|
2302
|
-
Object.entries(page.sections.background.scrimOpacityByValue).map(([name, opacity]) =>
|
|
2303
|
-
` ${name.padEnd(20)} ${opacity}`
|
|
2304
|
-
).join("\n")
|
|
2305
|
-
}\n\nResponsive background example:\n${page.sections.background.markdownExample}\n\nSection decoration (closed object):\n${
|
|
2306
|
-
page.sections.decoration.fields.map((field) => formatRegistryField(field)).join("\n")
|
|
2307
|
-
}\n delivery URLs ${page.sections.decoration.deliveryUrlPolicy}\n\nTint mapping:\n${
|
|
2308
|
-
Object.entries(page.sections.decoration.tintTokens).map(([name, token]) => ` ${name.padEnd(20)} ${token}`)
|
|
2309
|
-
.join("\n")
|
|
2310
|
-
}\n\nTransparent-mask example:\n${page.sections.decoration.markdownExample}\n\nMask guidance: ${page.sections.decoration.maskGuidance}\nSize guidance: ${page.sections.decoration.sizeGuidance}\nWarning: ${page.sections.decoration.opaqueWarning}\n\nRoot defaults and placement:\n${
|
|
2311
|
-
page.sections.placementMatrix.map(formatPlacement).join("\n")
|
|
2312
|
-
}\n\nColumns inside sections:\n${page.columns.markdownSyntax}\n placement ${page.columns.placement}\n defaults ${page.columns.defaults}\n responsive ${page.columns.responsive}\n markers ${page.columns.markers}\n limits ${page.columns.node.limits.rowsPerSection} rows per section; ${page.columns.node.limits.blocksPerRegion} blocks per region; ${page.columns.node.limits.nodesPerDocument} nodes and depth ${page.columns.node.limits.nodeDepth}\n transport ${page.columns.transport}\n\nSemantic tables:\n placement document root or directly inside a top-level section; wide/full-well measure\n rows exactly ${page.tables.structure.headerRows} header row, then ${page.tables.limits.dataRows.min} through ${page.tables.limits.dataRows.max} data rows\n columns ${page.tables.limits.columns.min} through ${page.tables.limits.columns.max}; delimiter and every row must match the header width\n caption optional non-empty plain text; maximum ${page.tables.limits.captionScalars.max} Unicode scalar values; syntax ${page.tables.markdown.captionSyntax}\n caption guidance ${page.tables.captionGuidance}\n cells exactly ${page.tables.structure.paragraphChildrenPerCell} paragraph; headers need non-whitespace text; data cells may be empty; maximum ${page.tables.limits.cellTextScalars.max} text scalars\n inline ${
|
|
2374
|
+
}\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\n${page.sectionsPointer}\n\nColumns inside sections:\n${page.columns.markdownSyntax}\n placement ${page.columns.placement}\n defaults ${page.columns.defaults}\n responsive ${page.columns.responsive}\n markers ${page.columns.markers}\n limits ${page.columns.node.limits.rowsPerSection} rows per section; ${page.columns.node.limits.blocksPerRegion} blocks per region; ${page.columns.node.limits.nodesPerDocument} nodes and depth ${page.columns.node.limits.nodeDepth}\n transport ${page.columns.transport}\n\nSemantic tables:\n placement document root or directly inside a top-level section; wide/full-well measure\n rows exactly ${page.tables.structure.headerRows} header row, then ${page.tables.limits.dataRows.min} through ${page.tables.limits.dataRows.max} data rows\n columns ${page.tables.limits.columns.min} through ${page.tables.limits.columns.max}; delimiter and every row must match the header width\n caption optional non-empty plain text; maximum ${page.tables.limits.captionScalars.max} Unicode scalar values; syntax ${page.tables.markdown.captionSyntax}\n caption guidance ${page.tables.captionGuidance}\n cells exactly ${page.tables.structure.paragraphChildrenPerCell} paragraph; headers need non-whitespace text; data cells may be empty; maximum ${page.tables.limits.cellTextScalars.max} text scalars\n inline ${
|
|
2313
2375
|
page.tables.structure.inlineNodes.join(", ")
|
|
2314
2376
|
}; marks ${
|
|
2315
2377
|
page.tables.structure.marks.join(", ")
|
|
@@ -64,9 +64,7 @@ export const SITE_CHECK_WORDING = Object.freeze({
|
|
|
64
64
|
"seo.h1_missing": () =>
|
|
65
65
|
"has no h1: no level 1 heading, banner title or hero title opens the page, so search engines find no page title",
|
|
66
66
|
"seo.h1_demoted": (finding) =>
|
|
67
|
-
`has the
|
|
68
|
-
"seo.h1_multiple": (finding) =>
|
|
69
|
-
`has the hero title '${finding.subject}', which is a second h1 because ${H1_CLAIMANT[finding.detail] ?? "another element"} is already the page's h1`,
|
|
67
|
+
`has the title '${finding.subject}', which publishes as an h2 because ${H1_CLAIMANT[finding.detail] ?? "another element"} is already the page's h1`,
|
|
70
68
|
"seo.heading_renumbered": (finding) => {
|
|
71
69
|
const [authored, published] = finding.detail.split(">");
|
|
72
70
|
return `has the heading '${finding.subject}' written as an h${authored}, which publishes as an h${published} so no level is skipped`;
|
|
@@ -140,6 +138,7 @@ const H1_CLAIMANT = Object.freeze({
|
|
|
140
138
|
heading: "the first level 1 heading",
|
|
141
139
|
banner: "the banner at the top",
|
|
142
140
|
hero: "the hero title",
|
|
141
|
+
fragment: "the integration's own heading",
|
|
143
142
|
});
|
|
144
143
|
|
|
145
144
|
const FOOTER_REGION_ADVICE = Object.freeze({
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
{ "id": "redirect.source_not_storable", "severity": "error", "scope": "site", "runsAt": ["save", "validate"], "subject": "redirect_source", "detail": "first_segment" },
|
|
23
23
|
{ "id": "seo.h1_missing", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["validate", "edit"], "subject": "none", "detail": "none" },
|
|
24
24
|
{ "id": "seo.h1_demoted", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["validate", "edit"], "subject": "heading_text", "detail": "h1_claimant" },
|
|
25
|
-
{ "id": "seo.h1_multiple", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["validate", "edit"], "subject": "heading_text", "detail": "h1_claimant" },
|
|
26
25
|
{ "id": "seo.heading_renumbered", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["validate", "edit"], "subject": "heading_text", "detail": "authored_and_published_level" },
|
|
27
26
|
{ "id": "seo.heading_before_title", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["validate", "edit"], "subject": "heading_text", "detail": "published_level" },
|
|
28
27
|
{ "id": "a11y.link_text_empty", "severity": "warning", "scope": "document", "appliesTo": ["free_form"], "runsAt": ["validate", "edit"], "subject": "link_target", "detail": "none" },
|
|
@@ -41,9 +41,8 @@ export function usableDescription(value) {
|
|
|
41
41
|
return [...quoted].length > MAXIMUM_QUOTED_SCALARS || sanitizeDiagnostic(quoted, "") !== quoted ? undefined : text;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function describeCommand(imageId, text
|
|
45
|
-
return `${CLI_BINARY_NAME} media images describe ${imageId} --description=${shellQuote(text)}
|
|
46
|
-
+ ` --expected-revision ${revision} --if-missing`;
|
|
44
|
+
function describeCommand(imageId, text) {
|
|
45
|
+
return `${CLI_BINARY_NAME} media images describe ${imageId} --description=${shellQuote(text)} --if-missing`;
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
/** Production's report changes only when the owner promotes a release, so a fix for it says so. */
|
|
@@ -82,9 +81,8 @@ export function buildImageFinding({ imageId, name, descriptionRevision, hasDefau
|
|
|
82
81
|
return {
|
|
83
82
|
...base,
|
|
84
83
|
...needs,
|
|
85
|
-
fix: `This image's state could not be read.
|
|
86
|
-
+
|
|
87
|
-
+ `and run ${CLI_BINARY_NAME} deploy --staging to refresh the report${promotionNote(environment)}.`,
|
|
84
|
+
fix: `This image's state could not be read. Save the description with ${CLI_BINARY_NAME} media images describe ${imageId}, `
|
|
85
|
+
+ `passing --description and --if-missing, and run ${CLI_BINARY_NAME} deploy --staging to refresh the report${promotionNote(environment)}.`,
|
|
88
86
|
};
|
|
89
87
|
}
|
|
90
88
|
const common = { ...base, descriptionRevision, imageAvailable: true };
|
|
@@ -102,15 +100,15 @@ export function buildImageFinding({ imageId, name, descriptionRevision, hasDefau
|
|
|
102
100
|
currentlyDescribed: false,
|
|
103
101
|
needsDescription: true,
|
|
104
102
|
fix: "This image has no description and its placements carry no usable alt text. Write one, then save it with "
|
|
105
|
-
+ `${CLI_BINARY_NAME} media images describe ${imageId}, passing --description
|
|
106
|
-
+ `
|
|
103
|
+
+ `${CLI_BINARY_NAME} media images describe ${imageId}, passing --description and --if-missing, `
|
|
104
|
+
+ `then run ${CLI_BINARY_NAME} deploy --staging to refresh the report${promotionNote(environment)}.`,
|
|
107
105
|
};
|
|
108
106
|
}
|
|
109
107
|
return {
|
|
110
108
|
...common,
|
|
111
109
|
currentlyDescribed: false,
|
|
112
110
|
suggestedDescription: suggestion,
|
|
113
|
-
fix: describeCommand(imageId, suggestion
|
|
111
|
+
fix: describeCommand(imageId, suggestion),
|
|
114
112
|
};
|
|
115
113
|
}
|
|
116
114
|
|