@bendyline/gezel-sdk 1.0.1 → 1.0.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/dist/checks.js +10 -1
- package/package.json +3 -3
package/dist/checks.js
CHANGED
|
@@ -1445,6 +1445,14 @@ function cleanHeading(text) {
|
|
|
1445
1445
|
function documentH1s(markdown) {
|
|
1446
1446
|
return [...markdown.matchAll(/^#\s+(.+?)\s*$/gm)].map((match) => match[1].trim());
|
|
1447
1447
|
}
|
|
1448
|
+
function documentH2s(markdown) {
|
|
1449
|
+
return [...markdown.matchAll(/^##\s+(.+?)\s*$/gm)].map((match) => match[1].trim());
|
|
1450
|
+
}
|
|
1451
|
+
function headingLevelHint(file, documentHeadings, h2s, expected) {
|
|
1452
|
+
if (documentHeadings.length > 1 || h2s.length !== expected || expected === 0) return null;
|
|
1453
|
+
const title = documentHeadings.length === 1 ? ` and \`# ${documentHeadings[0]}\` as a title` : "";
|
|
1454
|
+
return `${file} puts its ${expected} slides at \`##\`${title}, but slides are split on H1 \u2014 as written this converts to a single slide. Promote each \`## Slide\` heading to \`# \` and drop the document title.`;
|
|
1455
|
+
}
|
|
1448
1456
|
function outlineSlideHeadings(markdown) {
|
|
1449
1457
|
const headings = [];
|
|
1450
1458
|
for (const match of markdown.matchAll(/^#{2,6}\s+(.+?)\s*$/gm)) {
|
|
@@ -1483,9 +1491,10 @@ async function markdownHeadingsMatch(ws, file, outlineFile) {
|
|
|
1483
1491
|
};
|
|
1484
1492
|
}
|
|
1485
1493
|
if (actual.length !== expected.length) {
|
|
1494
|
+
const levelHint = headingLevelHint(file, actual, documentH2s(document), expected.length);
|
|
1486
1495
|
return {
|
|
1487
1496
|
ok: false,
|
|
1488
|
-
detail: `${file} has ${actual.length} H1 slide headings, but ${outlineFile} locks ${expected.length}. Add or remove slides without merging outline items.`,
|
|
1497
|
+
detail: levelHint ?? `${file} has ${actual.length} H1 slide headings, but ${outlineFile} locks ${expected.length}. Add or remove slides without merging outline items.`,
|
|
1489
1498
|
outlineHeadings: expected,
|
|
1490
1499
|
documentHeadings: actual
|
|
1491
1500
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "SDK imported by scripts running in the Gezel sandbox. Exposes the `gezel` object and `defineScript` helper.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"!dist/**/*.map"
|
|
60
60
|
],
|
|
61
61
|
"devDependencies": {
|
|
62
|
+
"@bendyline/gezel": "1.0.2",
|
|
62
63
|
"tsup": "^8.5.1",
|
|
63
64
|
"typescript": "^6.0.3",
|
|
64
|
-
"vitest": "^4.1.10"
|
|
65
|
-
"@bendyline/gezel": "1.0.1"
|
|
65
|
+
"vitest": "^4.1.10"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsup",
|