@taprootio/site-authoring 0.42.0 → 0.55.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 +32 -1
- package/examples/riverbend-wellness/settings/site-publishing-preferences.json +3 -0
- package/examples/riverbend-wellness/settings/taproot-styles.json +11 -0
- package/package.json +4 -3
- package/src/api.js +161 -8
- package/src/appearance-contract.js +264 -3
- package/src/authored-tag-names.js +88 -0
- package/src/block-flow.js +103 -1
- package/src/brand-color.js +22 -0
- package/src/breadcrumb-artwork.js +234 -0
- package/src/breadcrumb-separators.js +11 -0
- package/src/changelog.json +143 -0
- package/src/chrome-features.js +6 -2
- package/src/chrome-input.js +1 -0
- package/src/chrome-paint-catalog-taproot.json +3 -3
- package/src/chrome-report.js +91 -12
- package/src/cli.js +45 -16
- package/src/content/components.js +27 -4
- package/src/content/external-link.js +2 -1
- package/src/content/markdown.js +271 -101
- package/src/content/tiptap-prosemirror.ts +125 -43
- package/src/content/validate-document.js +4 -1
- package/src/content-inset.js +48 -0
- package/src/errors.js +1 -0
- package/src/espalier-shared.js +26 -0
- package/src/field-suggestions.js +40 -0
- package/src/fixture-init.js +22 -5
- package/src/font-catalog.js +11 -1
- package/src/footer-brand-inputs.js +22 -3
- package/src/footer-content.js +1 -0
- package/src/footer-contract.js +11 -0
- package/src/footer-cta-styles.js +6 -0
- package/src/footer-draft-hash.js +4 -2
- package/src/footer-fit.js +62 -15
- package/src/footer-workspace.js +44 -7
- package/src/latest-posts-tags.js +57 -0
- package/src/page-structure-checks.js +5 -0
- package/src/page-tag-badge-modes.js +6 -0
- package/src/page-tag-writes.js +158 -0
- package/src/page-type-tags.js +16 -0
- package/src/presentation-reference.js +297 -86
- package/src/recipe-page-options.js +22 -0
- package/src/recipe-step-contract.js +164 -0
- package/src/recipe-step-contract.json +65 -0
- package/src/reference-help.js +164 -78
- package/src/session.js +39 -24
- package/src/setting-reference.js +239 -48
- package/src/settings-catalog.js +63 -0
- package/src/site-check-findings.js +23 -5
- package/src/site-check-rules.json +1 -0
- package/src/site-health-findings.js +13 -13
- package/src/styling-fixed-values.js +71 -0
- package/src/tag-destination-warnings.js +35 -0
- package/src/template-token-reach.json +242 -0
- package/src/theme-proposals.js +18 -27
- package/src/theme-resolve.js +265 -23
- package/src/theme-validation.js +118 -7
- package/src/token-reach.js +222 -0
- package/src/typed-page-reference.js +72 -15
- package/src/typed-pages.js +171 -71
- package/src/verbs/deploy.js +6 -0
- package/src/verbs/footer-push.js +30 -5
- package/src/verbs/forms-push.js +11 -3
- package/src/verbs/pages-delete.js +19 -10
- package/src/verbs/pages-push.js +125 -36
- package/src/verbs/plan.js +10 -4
- package/src/verbs/pull.js +277 -67
- package/src/verbs/staging-review.js +27 -1
- package/src/verbs/status.js +22 -0
- package/src/verbs/theme-push.js +93 -25
- package/src/verbs/theme-resolve.js +189 -55
- package/src/verbs/validate.js +6 -5
- package/src/workspace-check.js +35 -3
- package/src/workspace.js +37 -1
- package/test/fixtures/default-site-theme.json +516 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ROLE_DERIVED_INK,
|
|
3
|
+
ROLE_DERIVED_SURFACE,
|
|
4
|
+
ROLE_TOKEN_PLAN,
|
|
5
|
+
SEMANTIC_COLOR_NAMES,
|
|
6
|
+
semanticToCSS,
|
|
7
|
+
} from "@taprootio/espalier/shared/theme";
|
|
8
|
+
|
|
9
|
+
import { BADGE_FOCUS_RING, getEspalierTokenManifest, supportsBadgeFocusRing } from "./espalier-shared.js";
|
|
10
|
+
import templateTokenReach from "./template-token-reach.json" with { type: "json" };
|
|
11
|
+
|
|
12
|
+
const DERIVATIONS = new Map();
|
|
13
|
+
for (const [role, slots] of Object.entries(ROLE_TOKEN_PLAN)) {
|
|
14
|
+
for (const [slot, mappings] of Object.entries(slots)) {
|
|
15
|
+
const key = `${role}.${slot}`;
|
|
16
|
+
const derived = ROLE_DERIVED_INK.has(key) || ROLE_DERIVED_SURFACE.has(key);
|
|
17
|
+
for (const [name, stop] of mappings) {
|
|
18
|
+
DERIVATIONS.set(name, Object.freeze({ role, slot, defaultStop: derived ? "derived per scheme" : stop }));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const STATUS_NOTE = "Status color outside the role plan.";
|
|
24
|
+
const BORDER_PAINT_NOTES = [
|
|
25
|
+
{
|
|
26
|
+
token: "--esp-color-border",
|
|
27
|
+
component: "esp-header",
|
|
28
|
+
part: "header",
|
|
29
|
+
state: "default",
|
|
30
|
+
label: "header border value",
|
|
31
|
+
folder: "header",
|
|
32
|
+
text: "The header bottom hairline uses 1px of the context's border token.",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
token: "--esp-color-border",
|
|
36
|
+
component: "esp-footer",
|
|
37
|
+
part: "footer",
|
|
38
|
+
state: "default",
|
|
39
|
+
label: "footer border block start",
|
|
40
|
+
folder: "footer",
|
|
41
|
+
text: "The footer top hairline uses 1px of the context's border token.",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
token: "--esp-color-border",
|
|
45
|
+
component: "esp-root",
|
|
46
|
+
part: "blockquote",
|
|
47
|
+
state: "default",
|
|
48
|
+
label: "quote border-inline-start",
|
|
49
|
+
folder: "shared",
|
|
50
|
+
text: "--esp-blockquote-bar-color overrides the quote bar.",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
token: "--esp-color-border",
|
|
54
|
+
component: "esp-root",
|
|
55
|
+
part: "quote-mark",
|
|
56
|
+
state: "default",
|
|
57
|
+
label: "quote mark background",
|
|
58
|
+
folder: "shared",
|
|
59
|
+
text: "--esp-blockquote-glyph-color overrides the quote glyph. When unset, the glyph follows the bar.",
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
const COMPONENT_PAINT_NOTES = {
|
|
63
|
+
border: BORDER_PAINT_NOTES,
|
|
64
|
+
headings: [1, 2, 3, 4].map((level) => ({
|
|
65
|
+
token: "--esp-color-headings",
|
|
66
|
+
component: "esp-root",
|
|
67
|
+
part: `h${level}`,
|
|
68
|
+
state: "default",
|
|
69
|
+
label: `h${level} ink`,
|
|
70
|
+
folder: "root",
|
|
71
|
+
text: `--esp-heading-${level}-color overrides native h${level} ink.`,
|
|
72
|
+
})),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// An alias is optional in a component paint. The owning token is the entry's key.
|
|
76
|
+
const COMPONENT_FIELDS = ["component", "part", "state", "label", "folder", "alias"];
|
|
77
|
+
const TEMPLATE_FIELDS = ["file", "markup", "part", "label"];
|
|
78
|
+
const TEMPLATE_PAINT = -1;
|
|
79
|
+
const CATALOG_FIELDS = [...new Set([...COMPONENT_FIELDS, ...TEMPLATE_FIELDS, "topics"])];
|
|
80
|
+
const PAGE_FIELDS = ["token", ...TEMPLATE_FIELDS, "topics"];
|
|
81
|
+
|
|
82
|
+
let manifestPaintsByCssName;
|
|
83
|
+
|
|
84
|
+
function getComponentPaints(name) {
|
|
85
|
+
if (manifestPaintsByCssName === undefined) {
|
|
86
|
+
manifestPaintsByCssName = new Map(getEspalierTokenManifest().tokens.map(({ name, paints }) => [name, paints]));
|
|
87
|
+
}
|
|
88
|
+
return manifestPaintsByCssName.get(semanticToCSS(name));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function getTokenDerivation(name) {
|
|
92
|
+
return DERIVATIONS.get(name) ?? null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function installedTemplatePaints() {
|
|
96
|
+
return supportsBadgeFocusRing() ? templateTokenReach
|
|
97
|
+
: templateTokenReach.filter(({ token, part }) => token !== BADGE_FOCUS_RING && part !== BADGE_FOCUS_RING);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function getPageTokenReach(type) {
|
|
101
|
+
return structuredClone(installedTemplatePaints().filter(({ topics }) => topics.includes(type)));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function paintNotesFor(name, paints) {
|
|
105
|
+
const notes = [];
|
|
106
|
+
for (const { text, ...identity } of COMPONENT_PAINT_NOTES[name] ?? []) {
|
|
107
|
+
const paintIndex = paints.findIndex((paint) =>
|
|
108
|
+
Object.entries(identity).every(([field, value]) => paint[field] === value)
|
|
109
|
+
);
|
|
110
|
+
if (paintIndex === -1) {
|
|
111
|
+
throw new Error(`The installed Espalier manifest is missing the ${name} paint "${identity.label}".`);
|
|
112
|
+
}
|
|
113
|
+
notes.push({ paintIndex, text });
|
|
114
|
+
}
|
|
115
|
+
return notes;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function createCatalog(fields) {
|
|
119
|
+
const dictionary = Object.fromEntries(fields.map((field) => [field, []]));
|
|
120
|
+
const indexes = Object.fromEntries(fields.map((field) => [field, new Map()]));
|
|
121
|
+
function intern(field, value) {
|
|
122
|
+
const key = Array.isArray(value) ? JSON.stringify(value) : value;
|
|
123
|
+
const index = indexes[field].get(key);
|
|
124
|
+
if (index !== undefined) return index;
|
|
125
|
+
const items = dictionary[field];
|
|
126
|
+
indexes[field].set(key, items.length);
|
|
127
|
+
items.push(value);
|
|
128
|
+
return items.length - 1;
|
|
129
|
+
}
|
|
130
|
+
return { dictionary, intern };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function encodePageTokenReach(paints) {
|
|
134
|
+
const { dictionary, intern } = createCatalog(PAGE_FIELDS);
|
|
135
|
+
const rows = paints.map((paint) => PAGE_FIELDS.map((field) => intern(field, paint[field])));
|
|
136
|
+
return { dictionary, rows };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function decodePageTokenReach({ dictionary, rows }) {
|
|
140
|
+
return rows.map((row) => Object.fromEntries(
|
|
141
|
+
PAGE_FIELDS.map((field, index) => [field, dictionary[field][row[index]]]),
|
|
142
|
+
));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Intern paint fields in first-use order and keep the release's paint row order. */
|
|
146
|
+
export function buildTokenPaintCatalog(names = SEMANTIC_COLOR_NAMES) {
|
|
147
|
+
const { dictionary: paintCatalog, intern } = createCatalog(CATALOG_FIELDS);
|
|
148
|
+
const templateRows = installedTemplatePaints();
|
|
149
|
+
|
|
150
|
+
const tokens = Object.fromEntries([...names].map((name) => {
|
|
151
|
+
const cssName = semanticToCSS(name);
|
|
152
|
+
const componentRows = getComponentPaints(name);
|
|
153
|
+
const componentPaints = componentRows.map((paint) =>
|
|
154
|
+
COMPONENT_FIELDS.filter((field) => Object.hasOwn(paint, field)).map((field) => intern(field, paint[field]))
|
|
155
|
+
);
|
|
156
|
+
const templatePaints = [];
|
|
157
|
+
for (const paint of templateRows) {
|
|
158
|
+
if (paint.token !== cssName) continue;
|
|
159
|
+
templatePaints.push([
|
|
160
|
+
TEMPLATE_PAINT,
|
|
161
|
+
...TEMPLATE_FIELDS.map((field) => intern(field, paint[field])),
|
|
162
|
+
...paint.topics.map((topic) => intern("topics", topic)),
|
|
163
|
+
]);
|
|
164
|
+
}
|
|
165
|
+
const derivation = getTokenDerivation(name);
|
|
166
|
+
const entry = {
|
|
167
|
+
derivation,
|
|
168
|
+
paints: [...componentPaints, ...templatePaints],
|
|
169
|
+
...(derivation === null ? { note: STATUS_NOTE } : {}),
|
|
170
|
+
};
|
|
171
|
+
const paintNotes = paintNotesFor(name, componentRows);
|
|
172
|
+
if (paintNotes.length > 0) entry.paintNotes = paintNotes;
|
|
173
|
+
return [name, entry];
|
|
174
|
+
}));
|
|
175
|
+
return { tokens, paintCatalog };
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function decodeTokenPaint(catalog, name, [first, ...rest]) {
|
|
179
|
+
const token = semanticToCSS(name);
|
|
180
|
+
if (first === TEMPLATE_PAINT) {
|
|
181
|
+
const fields = TEMPLATE_FIELDS.map((field, index) => [field, catalog[field][rest[index]]]);
|
|
182
|
+
return {
|
|
183
|
+
token,
|
|
184
|
+
...Object.fromEntries(fields),
|
|
185
|
+
topics: rest.slice(TEMPLATE_FIELDS.length).map((index) => catalog.topics[index]),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const row = [first, ...rest];
|
|
189
|
+
return {
|
|
190
|
+
token,
|
|
191
|
+
...Object.fromEntries(row.map((index, fieldIndex) => {
|
|
192
|
+
const field = COMPONENT_FIELDS[fieldIndex];
|
|
193
|
+
return [field, catalog[field][index]];
|
|
194
|
+
})),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function formatTokenPaints(tokens, paintCatalog) {
|
|
199
|
+
const groups = new Map();
|
|
200
|
+
for (const [name, entry] of Object.entries(tokens)) {
|
|
201
|
+
const notes = new Map(entry.paintNotes?.map(({ paintIndex, text }) => [paintIndex, text]));
|
|
202
|
+
for (const [index, row] of entry.paints.entries()) {
|
|
203
|
+
const paint = decodeTokenPaint(paintCatalog, name, row);
|
|
204
|
+
const group = paint.component ?? paint.file;
|
|
205
|
+
if (!groups.has(group)) groups.set(group, []);
|
|
206
|
+
const lines = groups.get(group);
|
|
207
|
+
const details = [paint.markup, paint.part, paint.state, paint.alias].filter(Boolean).join(", ");
|
|
208
|
+
lines.push(` ${name} — ${paint.label} (${details})`);
|
|
209
|
+
if (notes.has(index)) lines.push(` ${notes.get(index)}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return [...groups].flatMap(([group, lines]) => [` ${group}`, ...lines]);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function describeChromeToken(name, role) {
|
|
216
|
+
const paints = getComponentPaints(name) ?? [];
|
|
217
|
+
const folders = role === "header" ? ["menu", "header"] : ["footer"];
|
|
218
|
+
const labels = new Set(folders.flatMap((folder) =>
|
|
219
|
+
paints.filter((paint) => paint.folder === folder).map(({ label }) => label)
|
|
220
|
+
));
|
|
221
|
+
return labels.size === 0 ? name : `${name} (${[...labels].slice(0, 4).join(", ")})`;
|
|
222
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CLI_BINARY_NAME } from "./constants.js";
|
|
2
|
+
import { RECIPE_STEP_CONTRACT } from "./recipe-step-contract.js";
|
|
2
3
|
import {
|
|
3
4
|
frontMatterKeysFor,
|
|
4
5
|
PLACE_REVIEW_RATINGS,
|
|
6
|
+
RECIPE_STEP_UNSUPPORTED,
|
|
5
7
|
TEMPLATE_ALBUM,
|
|
6
8
|
TEMPLATE_ARTICLE,
|
|
7
9
|
TEMPLATE_GENERATED,
|
|
@@ -44,6 +46,14 @@ const FIELD_HELP = Object.freeze({
|
|
|
44
46
|
+ "address. Pages are authorless unless you name one, and an author already on the page is never replaced. "
|
|
45
47
|
+ "'authors list' shows who can be named; 'authors add' creates a site author without an account.",
|
|
46
48
|
},
|
|
49
|
+
tags: {
|
|
50
|
+
type: "JSON array of names",
|
|
51
|
+
required: false,
|
|
52
|
+
description:
|
|
53
|
+
'Set topic tags with a list such as ["Trail running", "PNW"]. Omit tags to preserve the site\'s assignment. '
|
|
54
|
+
+ "An unchanged pulled list is also omitted from the save. Set [] to clear topic tags. "
|
|
55
|
+
+ "To replace a list on an existing page, pull first and use a key with site.tags.manage.",
|
|
56
|
+
},
|
|
47
57
|
displayDate: {
|
|
48
58
|
type: "YYYY-MM-DD",
|
|
49
59
|
required: false,
|
|
@@ -56,7 +66,7 @@ const FIELD_HELP = Object.freeze({
|
|
|
56
66
|
required: false,
|
|
57
67
|
description:
|
|
58
68
|
"A file recorded by 'media upload', e.g. media/cover.jpg. The site requires the cover to be one of the page's own "
|
|
59
|
-
+ "images, so the same file must also appear in the body, introduction
|
|
69
|
+
+ "images, so the same file must also appear in the body, introduction or album images "
|
|
60
70
|
+ "(pages.cover_image_unused). Omit it for automatic selection; an empty value clears it.",
|
|
61
71
|
},
|
|
62
72
|
prepTimeMinutes: { type: "whole number", required: false, description: "Preparation time in minutes." },
|
|
@@ -123,6 +133,8 @@ cookingMethod: Baking
|
|
|
123
133
|
|
|
124
134
|
Tart, sweet, and easy to double.
|
|
125
135
|
|
|
136
|
+
> Let the crust cool before slicing. Add longer notes or photos here.
|
|
137
|
+
|
|
126
138
|
## Ingredients
|
|
127
139
|
|
|
128
140
|
### Crust
|
|
@@ -137,10 +149,11 @@ Tart, sweet, and easy to double.
|
|
|
137
149
|
|
|
138
150
|
## Instructions
|
|
139
151
|
|
|
140
|
-
1. Press the crust into a pan and bake for 20 minutes.
|
|
141
|
-
2. Whisk the filling and pour it over the warm crust
|
|
152
|
+
1. Press the **crust** into a pan and bake for 20 minutes.
|
|
153
|
+
2. Whisk the filling and pour it over the *warm* crust.\\
|
|
154
|
+
Check it after 15 minutes.
|
|
142
155
|
|
|
143
|
-
Bake until set.
|
|
156
|
+
Bake until set. See the [baking temperature guide](/baking){title="Baking temperatures"}.
|
|
144
157
|
`;
|
|
145
158
|
|
|
146
159
|
const ALBUM_EXAMPLE = `---
|
|
@@ -196,12 +209,18 @@ const TYPE_DETAILS = Object.freeze({
|
|
|
196
209
|
displayName: "Recipe",
|
|
197
210
|
summary: "Structured ingredients and steps with times, servings and category, published with recipe markup.",
|
|
198
211
|
body:
|
|
199
|
-
"Text before '## Ingredients' is the introduction
|
|
200
|
-
+ "
|
|
201
|
-
+ "'
|
|
202
|
-
+ "
|
|
203
|
-
+ "
|
|
204
|
-
|
|
212
|
+
"Text before '## Ingredients' is the optional introduction. It accepts paragraphs, headings, lists, quotes, "
|
|
213
|
+
+ "code, images, tables and components. Sections and inline facts are refused (pages.node_unsupported_for_template). "
|
|
214
|
+
+ "'## Ingredients' holds text bullets, optionally grouped by '### Group name'. '## Instructions' holds a list "
|
|
215
|
+
+ "whose items are steps, optionally grouped by '### Section name'. Use plain text for group and section names. "
|
|
216
|
+
+ "Indent later paragraphs to the start of the step text. Use both level-2 headings in that order.",
|
|
217
|
+
stepContract: Object.freeze({
|
|
218
|
+
...RECIPE_STEP_CONTRACT,
|
|
219
|
+
errorCode: RECIPE_STEP_UNSUPPORTED,
|
|
220
|
+
guidance: "Use paragraphs and line breaks. Put notes, tips, quotes and photos in the introduction. "
|
|
221
|
+
+ "Unsupported blocks, marks and attributes are refused by validate and pages push. "
|
|
222
|
+
+ "The CLI reports the file, section and step, plus the source line for Markdown.",
|
|
223
|
+
}),
|
|
205
224
|
markdownExample: RECIPE_EXAMPLE,
|
|
206
225
|
documentExample: documentExample(
|
|
207
226
|
TEMPLATE_RECIPE,
|
|
@@ -212,7 +231,27 @@ const TYPE_DETAILS = Object.freeze({
|
|
|
212
231
|
name: "Crust",
|
|
213
232
|
ingredients: [{ rawText: "2 cups flour", quantity: "", unit: "", name: "", parsed: false }],
|
|
214
233
|
}],
|
|
215
|
-
instructionSections: [{
|
|
234
|
+
instructionSections: [{
|
|
235
|
+
name: "",
|
|
236
|
+
stepBodies: [{
|
|
237
|
+
type: "doc",
|
|
238
|
+
content: [{
|
|
239
|
+
type: "paragraph",
|
|
240
|
+
content: [
|
|
241
|
+
{ type: "text", text: "Press the crust into a pan.", marks: [{ type: "bold" }] },
|
|
242
|
+
{ type: "hardBreak" },
|
|
243
|
+
{ type: "text", text: "Bake until set.", marks: [{ type: "underline" }] },
|
|
244
|
+
],
|
|
245
|
+
}, {
|
|
246
|
+
type: "paragraph",
|
|
247
|
+
content: [{
|
|
248
|
+
type: "text",
|
|
249
|
+
text: "Read the baking temperature guide.",
|
|
250
|
+
marks: [{ type: "link", attrs: { href: "/baking", title: "Baking temperatures" } }],
|
|
251
|
+
}],
|
|
252
|
+
}],
|
|
253
|
+
}],
|
|
254
|
+
}],
|
|
216
255
|
prepTimeMinutes: 15,
|
|
217
256
|
cookTimeMinutes: 35,
|
|
218
257
|
servings: 16,
|
|
@@ -224,12 +263,17 @@ const TYPE_DETAILS = Object.freeze({
|
|
|
224
263
|
dataFields: [
|
|
225
264
|
"introductionBody: ProseMirror document (optional)",
|
|
226
265
|
"ingredientGroups: [{ name, ingredients: [{ rawText, quantity, unit, name, parsed }] }]; at least one ingredient",
|
|
227
|
-
"instructionSections: [{ name, stepBodies: [ProseMirror document] }]
|
|
266
|
+
"instructionSections: [{ name, stepBodies: [ProseMirror document] }]. Include at least one step. Every step must contain text.",
|
|
228
267
|
"prepTimeMinutes, cookTimeMinutes, servings: whole numbers; recipeCategory, recipeCuisine, cookingMethod: strings",
|
|
229
268
|
],
|
|
230
269
|
note:
|
|
231
270
|
"A Markdown source supplies each ingredient as text only, so it publishes as written. A .pm.json source may also "
|
|
232
|
-
+ "carry quantity, unit and name with parsed: true."
|
|
271
|
+
+ "carry quantity, unit and name with parsed: true. The site-wide recipeJumpControl sets the Jump to recipe "
|
|
272
|
+
+ "control beside the date in the public recipe byline. recipeTagsContent chooses the bar contents and recipeTagsIcon sets its icon. "
|
|
273
|
+
+ "See help settings for these choices, the bar colors and metadata destinations. A default-height sticky header can cover the top of the card after a jump to "
|
|
274
|
+
+ "#recipe. Member-only recipes have no jump control. Opening a URL with #recipe before the card decrypts can "
|
|
275
|
+
+ "leave the reader at the top of the page. Public recipes publish recipe markup with ingredients and steps "
|
|
276
|
+
+ "even without an author. Google recommends a credited author for recipe rich results.",
|
|
233
277
|
},
|
|
234
278
|
[TEMPLATE_ALBUM]: {
|
|
235
279
|
displayName: "Album",
|
|
@@ -280,6 +324,10 @@ const TYPE_DETAILS = Object.freeze({
|
|
|
280
324
|
`rating: ${Object.keys(PLACE_REVIEW_RATINGS).join(" | ")}`,
|
|
281
325
|
"body: ProseMirror document (required, not empty)",
|
|
282
326
|
],
|
|
327
|
+
note:
|
|
328
|
+
"Google review snippets require a valid reviewer name under 100 characters, a supported place type, and a rating. "
|
|
329
|
+
+ "A public review with missing or ineligible review data still publishes article markup. For public reviews "
|
|
330
|
+
+ "without a credited reviewer, validate and deploy --staging report an advisory. Pull first to refresh a tracked page.",
|
|
283
331
|
},
|
|
284
332
|
[TEMPLATE_GENERATED]: {
|
|
285
333
|
displayName: "Generated page",
|
|
@@ -465,7 +513,11 @@ function typedReference(type) {
|
|
|
465
513
|
]),
|
|
466
514
|
}),
|
|
467
515
|
...(generated ? {} : { markdown: Object.freeze({ body: details.body, example: details.markdownExample }) }),
|
|
468
|
-
document: Object.freeze({
|
|
516
|
+
document: Object.freeze({
|
|
517
|
+
example: details.documentExample,
|
|
518
|
+
...(details.stepContract === undefined ? {} : { stepContract: details.stepContract }),
|
|
519
|
+
...(details.note ? { note: details.note } : {}),
|
|
520
|
+
}),
|
|
469
521
|
workflow: Object.freeze([
|
|
470
522
|
...(generated
|
|
471
523
|
? [Object.freeze({
|
|
@@ -514,12 +566,17 @@ export function formatTypedPageReference(page) {
|
|
|
514
566
|
if (page.type === LEGAL_PAGE_TYPE) return formatLegalReference(page);
|
|
515
567
|
const markdown = page.workspace.formats.find((format) => format.extension === ".md");
|
|
516
568
|
const json = page.workspace.formats.find((format) => format.extension === ".pm.json");
|
|
569
|
+
const contract = page.document.stepContract;
|
|
570
|
+
const stepHelp = contract === undefined ? "" : `\nRecipe step contract\n ${contract.guidance}\n`
|
|
571
|
+
+ ` Inline formatting includes ${Object.keys(contract.marks).join(", ")}.\n`
|
|
572
|
+
+ ` A link can carry ${contract.marks.link.join(", ")}. Use .pm.json for underline. In Markdown put title in a link's attribute braces.\n`
|
|
573
|
+
+ ` Refusal code ${contract.errorCode}.\n`;
|
|
517
574
|
const markdownSection = markdown === undefined
|
|
518
575
|
? ""
|
|
519
576
|
: `Markdown front matter:\n${markdown.metadata.map(formatField).join("\n")}\n\nMarkdown body: ${page.markdown.body}\n\nMarkdown example:\n${page.markdown.example}\n`;
|
|
520
577
|
return `${page.displayName} (${page.type})\n${page.summary}\n\nWorkspace (${page.workspace.directory}):\n source rule ${page.workspace.sourceRule}\n pull ${page.workspace.pull}\n\n${markdownSection}.pm.json (${json.purpose})\n data:\n${
|
|
521
578
|
json.dataFields.map((field) => ` ${field}`).join("\n")
|
|
522
|
-
}\n${page.document.note === undefined ? "" : ` ${page.document.note}\n`}\n.pm.json example:\n${
|
|
579
|
+
}\n${page.document.note === undefined ? "" : ` ${page.document.note}\n`}${stepHelp}\n.pm.json example:\n${
|
|
523
580
|
JSON.stringify(page.document.example, null, 2)
|
|
524
581
|
}\n\nWorkflow:\n${
|
|
525
582
|
page.workflow.map((step) => ` ${step.command}: ${step.result}`).join("\n")
|