explico 0.12.0 → 0.13.1

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.
Files changed (279) hide show
  1. package/CHANGELOG.md +1137 -1
  2. package/README.md +91 -13
  3. package/dist/compiler/astro.d.ts +4 -3
  4. package/dist/compiler/astro.js +45 -15
  5. package/dist/compiler/cli.d.ts +26 -12
  6. package/dist/compiler/cli.js +96 -25
  7. package/dist/compiler/collections.d.ts +9 -1
  8. package/dist/compiler/collections.js +55 -16
  9. package/dist/compiler/content-schema.d.ts +31 -0
  10. package/dist/compiler/content-schema.js +82 -0
  11. package/dist/compiler/content-schemas.d.ts +422 -0
  12. package/dist/compiler/content-schemas.js +229 -0
  13. package/dist/compiler/course-config.d.ts +1 -1
  14. package/dist/compiler/course-config.js +30 -2
  15. package/dist/compiler/exports/combined-html.d.ts +97 -0
  16. package/dist/compiler/exports/combined-html.js +492 -0
  17. package/dist/compiler/exports/download-index.d.ts +9 -0
  18. package/dist/compiler/exports/download-index.js +33 -0
  19. package/dist/compiler/exports/export-chapters.d.ts +98 -0
  20. package/dist/compiler/exports/export-chapters.js +164 -0
  21. package/dist/compiler/exports/export-pages.d.ts +48 -0
  22. package/dist/compiler/exports/export-pages.js +22 -0
  23. package/dist/compiler/exports/html-tree.d.ts +22 -0
  24. package/dist/compiler/exports/html-tree.js +47 -0
  25. package/dist/compiler/exports/latex/capture.d.ts +106 -0
  26. package/dist/compiler/exports/latex/capture.js +435 -0
  27. package/dist/compiler/exports/latex/compile.d.ts +73 -0
  28. package/dist/compiler/exports/latex/compile.js +115 -0
  29. package/dist/compiler/exports/latex/document.d.ts +102 -0
  30. package/dist/compiler/exports/latex/document.js +349 -0
  31. package/dist/compiler/exports/latex/explico.cls +415 -0
  32. package/dist/compiler/exports/latex/numbering.d.ts +18 -0
  33. package/dist/compiler/exports/latex/numbering.js +57 -0
  34. package/dist/compiler/exports/latex/serialize.d.ts +112 -0
  35. package/dist/compiler/exports/latex/serialize.js +606 -0
  36. package/dist/compiler/exports/latex-export.d.ts +44 -0
  37. package/dist/compiler/exports/latex-export.js +169 -0
  38. package/dist/compiler/exports/markdown/serialize.d.ts +51 -0
  39. package/dist/compiler/exports/markdown/serialize.js +527 -0
  40. package/dist/compiler/exports/markdown-export.d.ts +39 -0
  41. package/dist/compiler/exports/markdown-export.js +240 -0
  42. package/dist/compiler/exports/standalone-html.d.ts +14 -5
  43. package/dist/compiler/exports/standalone-html.js +23 -51
  44. package/dist/compiler/exports/static-tree.d.ts +253 -0
  45. package/dist/compiler/exports/static-tree.js +625 -0
  46. package/dist/compiler/exports/zip.d.ts +16 -0
  47. package/dist/compiler/exports/zip.js +72 -0
  48. package/dist/compiler/lesson-derivation.d.ts +8 -2
  49. package/dist/compiler/lesson-derivation.js +6 -7
  50. package/dist/compiler/manifest.d.ts +87 -6
  51. package/dist/compiler/manifest.js +174 -31
  52. package/dist/compiler/render-diagnostics.d.ts +65 -0
  53. package/dist/compiler/render-diagnostics.js +56 -0
  54. package/dist/compiler/resolution-report.d.ts +2 -1
  55. package/dist/{course-config-Dsnri9Tk.d.ts → course-config-rRtME5UV.d.ts} +56 -13
  56. package/dist/curriculum/validation.d.ts +9 -3
  57. package/dist/curriculum/validation.js +35 -17
  58. package/dist/reference/base-abbreviations.d.mts +2 -2
  59. package/dist/reference/base-abbreviations.mjs +2 -2
  60. package/dist/reference/base-operators.d.mts +2 -2
  61. package/dist/reference/base-operators.mjs +2 -2
  62. package/dist/reference/base-roman-labels.d.mts +4 -3
  63. package/dist/reference/base-roman-labels.mjs +4 -3
  64. package/dist/reference/citation-format.d.mts +35 -0
  65. package/dist/reference/citation-format.mjs +74 -0
  66. package/dist/reference/consistency.d.ts +5 -9
  67. package/dist/reference/consistency.js +34 -38
  68. package/dist/reference/curriculum-alignment.js +3 -24
  69. package/dist/reference/derived-entries.d.ts +45 -0
  70. package/dist/reference/derived-entries.js +50 -0
  71. package/dist/reference/derived-notation.d.mts +125 -0
  72. package/dist/reference/derived-notation.mjs +121 -0
  73. package/dist/reference/diagram-fit.d.ts +45 -0
  74. package/dist/reference/diagram-fit.js +54 -0
  75. package/dist/reference/diagram-layout.d.ts +59 -10
  76. package/dist/reference/diagram-layout.js +85 -24
  77. package/dist/reference/diagrams-validate.d.ts +1 -1
  78. package/dist/reference/equations-validate.d.ts +1 -1
  79. package/dist/reference/equations-validate.js +26 -1
  80. package/dist/reference/equations.d.mts +27 -0
  81. package/dist/reference/equations.mjs +120 -22
  82. package/dist/reference/examples-validate.d.ts +1 -1
  83. package/dist/reference/figure-fit.d.ts +70 -0
  84. package/dist/reference/figure-fit.js +60 -0
  85. package/dist/reference/figure-pictures.d.ts +27 -0
  86. package/dist/reference/figure-pictures.js +49 -0
  87. package/dist/reference/figures-validate.d.ts +1 -1
  88. package/dist/reference/gate-abbreviations.d.ts +1 -1
  89. package/dist/reference/gate-abbreviations.js +1 -1
  90. package/dist/reference/gate-course-rules.d.ts +4 -3
  91. package/dist/reference/gate-course-rules.js +9 -4
  92. package/dist/reference/gate-heading-length.d.ts +2 -0
  93. package/dist/reference/gate-heading-length.js +7 -5
  94. package/dist/reference/gate-heading-structure.js +26 -0
  95. package/dist/reference/gate-indices.d.ts +35 -0
  96. package/dist/reference/gate-indices.js +299 -0
  97. package/dist/reference/gate-math.d.ts +32 -2
  98. package/dist/reference/gate-math.js +68 -12
  99. package/dist/reference/gate-mdx-expression.d.ts +17 -0
  100. package/dist/reference/gate-mdx-expression.js +29 -0
  101. package/dist/reference/gate-part-pages.d.ts +1 -1
  102. package/dist/reference/gate-prop-text.d.ts +28 -0
  103. package/dist/reference/gate-prop-text.js +106 -0
  104. package/dist/reference/gate-prose-notation.d.ts +3 -1
  105. package/dist/reference/gate-prose-notation.js +4 -2
  106. package/dist/reference/gate-retired-keys.d.ts +35 -0
  107. package/dist/reference/gate-retired-keys.js +58 -0
  108. package/dist/reference/gloss.d.ts +2 -0
  109. package/dist/reference/katex-measure.d.ts +17 -0
  110. package/dist/reference/katex-measure.js +223 -0
  111. package/dist/reference/keyed-float-validate.js +12 -0
  112. package/dist/reference/keyed-jsx-floats.d.mts +2 -2
  113. package/dist/reference/keyed-jsx-floats.mjs +11 -14
  114. package/dist/reference/lab-math-scope.d.ts +1 -0
  115. package/dist/reference/lab-math-scope.js +13 -2
  116. package/dist/reference/math-glyphs.d.mts +94 -2
  117. package/dist/reference/math-glyphs.mjs +851 -46
  118. package/dist/reference/mixed-content.d.ts +8 -3
  119. package/dist/reference/mixed-content.js +4 -2
  120. package/dist/reference/page-notation.d.ts +34 -4
  121. package/dist/reference/page-notation.js +54 -2
  122. package/dist/reference/references.d.ts +11 -1
  123. package/dist/reference/references.js +6 -0
  124. package/dist/reference/registry.js +104 -10
  125. package/dist/reference/rehype-fail-katex-errors.d.mts +9 -0
  126. package/dist/reference/rehype-fail-katex-errors.mjs +19 -0
  127. package/dist/reference/rehype-heading-anchors.mjs +11 -1
  128. package/dist/reference/remark-citation.mjs +0 -0
  129. package/dist/reference/remark-notation.mjs +84 -20
  130. package/dist/reference/render-lab-math.d.ts +2 -0
  131. package/dist/reference/render-lab-math.js +17 -5
  132. package/dist/reference/sections-validate.d.ts +28 -3
  133. package/dist/reference/sections-validate.js +31 -4
  134. package/dist/reference/sections.d.mts +24 -6
  135. package/dist/reference/sections.mjs +92 -17
  136. package/dist/reference/tables-validate.d.ts +1 -1
  137. package/dist/reference/tables-validate.js +24 -1
  138. package/dist/reference/text-measure.d.ts +10 -0
  139. package/dist/reference/text-measure.js +41 -0
  140. package/dist/reference/text-widths.d.ts +10 -0
  141. package/dist/reference/text-widths.js +1238 -0
  142. package/dist/reference/types.d.ts +64 -8
  143. package/dist/rules/catalog.js +191 -30
  144. package/dist/rules/in-effect.d.ts +1 -1
  145. package/dist/rules/rules.schema.json +79 -24
  146. package/dist/rules/settings.d.ts +1 -1
  147. package/dist/rules/settings.js +7 -0
  148. package/dist/session/PreferenceStore.d.ts +18 -1
  149. package/dist/session/PreferenceStore.js +29 -1
  150. package/docs/authoring/README.md +32 -21
  151. package/docs/authoring/agents.md +38 -7
  152. package/docs/authoring/components.md +111 -6
  153. package/docs/authoring/migrating.md +707 -0
  154. package/docs/authoring/notation.md +281 -29
  155. package/docs/authoring/retired.md +1 -0
  156. package/docs/authoring/structure-rules.md +10 -41
  157. package/docs/authoring/structure.md +53 -2
  158. package/docs/authoring/visualizations.md +144 -18
  159. package/package.json +12 -7
  160. package/src/compiler/astro.ts +57 -17
  161. package/src/compiler/cli.ts +143 -35
  162. package/src/compiler/collections.ts +92 -19
  163. package/src/compiler/content-schema.ts +108 -0
  164. package/src/compiler/content-schemas.ts +391 -0
  165. package/src/compiler/course-config.ts +86 -15
  166. package/src/compiler/exports/combined-html.ts +669 -0
  167. package/src/compiler/exports/download-index.ts +36 -0
  168. package/src/compiler/exports/export-chapters.ts +233 -0
  169. package/src/compiler/exports/export-pages.ts +44 -0
  170. package/src/compiler/exports/html-tree.ts +62 -0
  171. package/src/compiler/exports/latex/capture.ts +651 -0
  172. package/src/compiler/exports/latex/compile.ts +168 -0
  173. package/src/compiler/exports/latex/document.ts +479 -0
  174. package/src/compiler/exports/latex/explico.cls +415 -0
  175. package/src/compiler/exports/latex/numbering.ts +74 -0
  176. package/src/compiler/exports/latex/serialize.ts +787 -0
  177. package/src/compiler/exports/latex/texlive-packages.txt +76 -0
  178. package/src/compiler/exports/latex-export.ts +255 -0
  179. package/src/compiler/exports/markdown/serialize.ts +632 -0
  180. package/src/compiler/exports/markdown-export.ts +329 -0
  181. package/src/compiler/exports/standalone-html.ts +39 -70
  182. package/src/compiler/exports/static-tree.ts +944 -0
  183. package/src/compiler/exports/zip.ts +88 -0
  184. package/src/compiler/lesson-derivation.ts +13 -8
  185. package/src/compiler/manifest.ts +299 -28
  186. package/src/compiler/render-diagnostics.ts +111 -0
  187. package/src/components/HoverPanel.astro +204 -6
  188. package/src/components/PartOverview.astro +12 -9
  189. package/src/components/abbreviation/AbbreviationLayer.astro +21 -12
  190. package/src/components/assessments/AssessmentRunner.tsx +7 -1
  191. package/src/components/assessments/AssessmentSet.astro +14 -1
  192. package/src/components/block-heading.ts +38 -0
  193. package/src/components/card-arrow.ts +18 -4
  194. package/src/components/card-carry.ts +406 -0
  195. package/src/components/card-drag.ts +1 -30
  196. package/src/components/card-fetch.ts +87 -0
  197. package/src/components/card-manager.ts +1222 -38
  198. package/src/components/card-memory.ts +5 -1
  199. package/src/components/card-placement.ts +211 -13
  200. package/src/components/card-side.ts +281 -31
  201. package/src/components/citation/CitationLayer.astro +45 -40
  202. package/src/components/diagram/Diagram.astro +123 -44
  203. package/src/components/figure/Figure.astro +11 -0
  204. package/src/components/figure/FloatCaption.astro +4 -17
  205. package/src/components/float-toolbar.ts +274 -0
  206. package/src/components/memo/Memo.astro +21 -10
  207. package/src/components/memo/ShortNote.astro +4 -0
  208. package/src/components/notation/NotationGlossary.astro +22 -17
  209. package/src/components/notation/NotationLayer.astro +321 -79
  210. package/src/components/notation/NotationMath.astro +8 -1
  211. package/src/components/notation/render-notation-math.ts +51 -5
  212. package/src/components/readable-text.ts +25 -0
  213. package/src/components/reference/FloatRefLayer.astro +162 -89
  214. package/src/components/starlight/HeadingAnchorEnhancer.astro +13 -8
  215. package/src/components/starlight/KeyedFloatEnhancer.astro +28 -9
  216. package/src/components/starlight/LayoutPageSidebar.astro +17 -3
  217. package/src/components/starlight/LayoutSocialIcons.astro +79 -29
  218. package/src/components/starlight/LessonExportActions.astro +384 -310
  219. package/src/components/starlight/LessonFooter.astro +47 -9
  220. package/src/components/starlight/PrintController.astro +28 -0
  221. package/src/components/starlight/TextSizeControl.astro +137 -0
  222. package/src/components/starlight/print-controller.ts +380 -0
  223. package/src/components/starlight/section-summary.ts +13 -5
  224. package/src/components/table/Table.astro +13 -21
  225. package/src/components/table/table-truncation.ts +15 -0
  226. package/src/content-config.ts +20 -312
  227. package/src/curriculum/validation.ts +72 -24
  228. package/src/reference/base-abbreviations.mjs +2 -2
  229. package/src/reference/base-operators.mjs +2 -2
  230. package/src/reference/base-roman-labels.mjs +4 -3
  231. package/src/reference/citation-format.mjs +74 -0
  232. package/src/reference/consistency.ts +47 -61
  233. package/src/reference/curriculum-alignment.ts +4 -41
  234. package/src/reference/derived-entries.ts +68 -0
  235. package/src/reference/derived-notation.mjs +121 -0
  236. package/src/reference/diagram-fit.ts +104 -0
  237. package/src/reference/diagram-layout.ts +182 -51
  238. package/src/reference/diagrams-validate.ts +2 -1
  239. package/src/reference/equations-validate.ts +41 -2
  240. package/src/reference/equations.mjs +120 -22
  241. package/src/reference/examples-validate.ts +1 -0
  242. package/src/reference/figure-fit.ts +139 -0
  243. package/src/reference/figure-pictures.ts +96 -0
  244. package/src/reference/figures-validate.ts +2 -1
  245. package/src/reference/gate-abbreviations.ts +1 -1
  246. package/src/reference/gate-course-rules.ts +22 -7
  247. package/src/reference/gate-heading-length.ts +25 -7
  248. package/src/reference/gate-heading-structure.ts +40 -1
  249. package/src/reference/gate-indices.ts +470 -0
  250. package/src/reference/gate-math.ts +102 -13
  251. package/src/reference/gate-mdx-expression.ts +45 -0
  252. package/src/reference/gate-prop-text.ts +145 -0
  253. package/src/reference/gate-prose-notation.ts +19 -5
  254. package/src/reference/gate-retired-keys.ts +101 -0
  255. package/src/reference/gloss.ts +2 -0
  256. package/src/reference/katex-measure.ts +384 -0
  257. package/src/reference/keyed-float-validate.ts +22 -0
  258. package/src/reference/keyed-jsx-floats.mjs +11 -14
  259. package/src/reference/lab-math-scope.ts +15 -1
  260. package/src/reference/math-glyphs.mjs +851 -46
  261. package/src/reference/mixed-content.ts +11 -2
  262. package/src/reference/page-notation.ts +100 -3
  263. package/src/reference/references.ts +14 -0
  264. package/src/reference/registry.ts +154 -8
  265. package/src/reference/rehype-fail-katex-errors.mjs +19 -0
  266. package/src/reference/rehype-heading-anchors.mjs +11 -1
  267. package/src/reference/remark-citation.mjs +0 -0
  268. package/src/reference/remark-notation.mjs +84 -20
  269. package/src/reference/render-lab-math.ts +29 -5
  270. package/src/reference/sections-validate.ts +67 -3
  271. package/src/reference/sections.mjs +92 -17
  272. package/src/reference/tables-validate.ts +40 -2
  273. package/src/reference/text-measure.ts +63 -0
  274. package/src/reference/text-widths.ts +133 -0
  275. package/src/reference/types.ts +75 -8
  276. package/src/rules/catalog.ts +205 -29
  277. package/src/rules/settings.ts +10 -0
  278. package/src/session/PreferenceStore.ts +53 -0
  279. package/src/styles/global.css +291 -75
@@ -0,0 +1,72 @@
1
+ import { Buffer } from "node:buffer";
2
+ import { crc32, deflateRawSync } from "node:zlib";
3
+ const DOS_DATE_1980_01_01 = 33;
4
+ const UTF8_NAMES = 2048;
5
+ const REGULAR_FILE_644 = 33188 << 16;
6
+ function zip(entries) {
7
+ const sorted = [...entries].sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
8
+ const seen = /* @__PURE__ */ new Set();
9
+ const locals = [];
10
+ const centrals = [];
11
+ let offset = 0;
12
+ for (const entry of sorted) {
13
+ if (!entry.path || entry.path.startsWith("/") || entry.path.split("/").includes("..")) {
14
+ throw new Error(`Zip entry path ${JSON.stringify(entry.path)} is not a relative path.`);
15
+ }
16
+ if (seen.has(entry.path)) throw new Error(`Zip entry ${entry.path} appears twice.`);
17
+ seen.add(entry.path);
18
+ const name = Buffer.from(entry.path, "utf8");
19
+ const data = typeof entry.content === "string" ? Buffer.from(entry.content, "utf8") : Buffer.from(entry.content);
20
+ const deflated = deflateRawSync(data, { level: 9 });
21
+ const stored = deflated.length >= data.length;
22
+ const body = stored ? data : deflated;
23
+ const checksum = crc32(data) >>> 0;
24
+ const local = Buffer.alloc(30);
25
+ local.writeUInt32LE(67324752, 0);
26
+ local.writeUInt16LE(20, 4);
27
+ local.writeUInt16LE(UTF8_NAMES, 6);
28
+ local.writeUInt16LE(stored ? 0 : 8, 8);
29
+ local.writeUInt16LE(0, 10);
30
+ local.writeUInt16LE(DOS_DATE_1980_01_01, 12);
31
+ local.writeUInt32LE(checksum, 14);
32
+ local.writeUInt32LE(body.length, 18);
33
+ local.writeUInt32LE(data.length, 22);
34
+ local.writeUInt16LE(name.length, 26);
35
+ local.writeUInt16LE(0, 28);
36
+ locals.push(local, name, body);
37
+ const central = Buffer.alloc(46);
38
+ central.writeUInt32LE(33639248, 0);
39
+ central.writeUInt16LE(3 << 8 | 20, 4);
40
+ central.writeUInt16LE(20, 6);
41
+ central.writeUInt16LE(UTF8_NAMES, 8);
42
+ central.writeUInt16LE(stored ? 0 : 8, 10);
43
+ central.writeUInt16LE(0, 12);
44
+ central.writeUInt16LE(DOS_DATE_1980_01_01, 14);
45
+ central.writeUInt32LE(checksum, 16);
46
+ central.writeUInt32LE(body.length, 20);
47
+ central.writeUInt32LE(data.length, 24);
48
+ central.writeUInt16LE(name.length, 28);
49
+ central.writeUInt16LE(0, 30);
50
+ central.writeUInt16LE(0, 32);
51
+ central.writeUInt16LE(0, 34);
52
+ central.writeUInt16LE(0, 36);
53
+ central.writeUInt32LE(REGULAR_FILE_644 >>> 0, 38);
54
+ central.writeUInt32LE(offset, 42);
55
+ centrals.push(central, name);
56
+ offset += local.length + name.length + body.length;
57
+ }
58
+ const directory = Buffer.concat(centrals);
59
+ const end = Buffer.alloc(22);
60
+ end.writeUInt32LE(101010256, 0);
61
+ end.writeUInt16LE(0, 4);
62
+ end.writeUInt16LE(0, 6);
63
+ end.writeUInt16LE(sorted.length, 8);
64
+ end.writeUInt16LE(sorted.length, 10);
65
+ end.writeUInt32LE(directory.length, 12);
66
+ end.writeUInt32LE(offset, 16);
67
+ end.writeUInt16LE(0, 20);
68
+ return Buffer.concat([...locals, directory, end]);
69
+ }
70
+ export {
71
+ zip
72
+ };
@@ -5,7 +5,7 @@
5
5
  * layout, the tests) goes through that one loader.
6
6
  *
7
7
  * Authored per lesson after C2: `title`, `description`, `teaches`, `assumptions`,
8
- * `editorialStatus`, `notation.local`. Everything below is derived:
8
+ * `notation.local`. Everything below is derived:
9
9
  *
10
10
  * - `lessonId` — the doc slug, `/` → `.` (`foundations/discount-factors`).
11
11
  * - `requires` — direct competency-graph prerequisites of `teaches`, minus
@@ -31,6 +31,12 @@ declare function lessonIdFromSlug(slug: string): string;
31
31
  * future `<section>/index` page would not be one either.
32
32
  */
33
33
  declare function isLessonSlug(slug: string): boolean;
34
+ /**
35
+ * The docs slugs a Starlight route id can stand for. The glob loader shortens
36
+ * `<dir>/index.mdx` to the id `<dir>`, and may give the landing page an empty
37
+ * one, so a manifest entry matches its route either way.
38
+ */
39
+ declare function docsSlugsForRoute(routeSlug: string): readonly string[];
34
40
  /**
35
41
  * Direct prerequisites of everything the lesson `teaches`, minus the taught
36
42
  * competencies themselves, sorted. Editorial "you should also know" extras that
@@ -103,4 +109,4 @@ declare function buildSidebar(tracks: readonly TrackLike[], lessonSlugs: readonl
103
109
  readonly floatIndex?: boolean;
104
110
  }): SidebarGroup[];
105
111
 
106
- export { PART_OVERVIEW_CLASS, type SidebarGroup, type SidebarItem, type SidebarSection, buildSidebar, citedSourceIds, deriveRequires, deriveSources, isLessonSlug, lessonIdFromSlug, mergeTrackOrder, parseCheckList };
112
+ export { PART_OVERVIEW_CLASS, type SidebarGroup, type SidebarItem, type SidebarSection, buildSidebar, citedSourceIds, deriveRequires, deriveSources, docsSlugsForRoute, isLessonSlug, lessonIdFromSlug, mergeTrackOrder, parseCheckList };
@@ -1,3 +1,4 @@
1
+ import { citedIds, withoutLinkCitations } from "../reference/citation-format.mjs";
1
2
  function lessonIdFromSlug(slug) {
2
3
  return slug.replace(/\.(md|mdx)$/, "").replace(/\//g, ".");
3
4
  }
@@ -5,6 +6,9 @@ function isLessonSlug(slug) {
5
6
  const clean = slug.replace(/\.(md|mdx)$/, "");
6
7
  return clean.includes("/") && !clean.endsWith("/index");
7
8
  }
9
+ function docsSlugsForRoute(routeSlug) {
10
+ return routeSlug === "" ? ["index"] : [routeSlug, `${routeSlug}/index`];
11
+ }
8
12
  function deriveRequires(teaches, prerequisitesById) {
9
13
  const taught = new Set(teaches);
10
14
  const required = /* @__PURE__ */ new Set();
@@ -17,13 +21,7 @@ function deriveRequires(teaches, prerequisitesById) {
17
21
  }
18
22
  function citedSourceIds(body) {
19
23
  const withoutCode = body.replace(/```[\s\S]*?```/g, "").replace(/`[^`\n]*`/g, "");
20
- const ids = /* @__PURE__ */ new Set();
21
- for (const match of withoutCode.matchAll(
22
- /\[@([a-z0-9][a-z0-9.-]*)(?:;[^\]]*)?\]/g
23
- )) {
24
- ids.add((match[1] ?? "").trim());
25
- }
26
- return ids;
24
+ return citedIds(withoutLinkCitations(withoutCode));
27
25
  }
28
26
  function deriveSources(body) {
29
27
  return [...citedSourceIds(body)].sort();
@@ -99,6 +97,7 @@ export {
99
97
  citedSourceIds,
100
98
  deriveRequires,
101
99
  deriveSources,
100
+ docsSlugsForRoute,
102
101
  isLessonSlug,
103
102
  lessonIdFromSlug,
104
103
  mergeTrackOrder,
@@ -12,12 +12,13 @@ import { LabKatexDiagnostic } from '../reference/lab-katex-validate.js';
12
12
  import { MathGateDiagnostic } from '../reference/gate-math.js';
13
13
  import { ContentSegment } from '../reference/mixed-content.js';
14
14
  import { GlyphScopeEntry } from '../reference/gloss.js';
15
- import { NotationDefinitionRecord, NotationPageBundle, NotationBacklink, NotationDiagnostic, EditorialStatus, NotationGlossEntry } from '../reference/types.js';
16
- import { b as NormalizedLessonExports, c as NormalizedDisclosure, d as NormalizedNumbering, B as BlockLabels, M as ManifestRules, e as ConfigDiagnostic, C as CourseConfig } from '../course-config-Dsnri9Tk.js';
15
+ import { NotationDefinitionRecord, NotationPageBundle, NotationBacklink, NotationDiagnostic, NotationGlossEntry } from '../reference/types.js';
16
+ import { N as NormalizedLessonExports, a as NormalizedDisclosure, b as NormalizedNumbering, B as BlockLabels, c as NormalizedCards, M as ManifestRules, d as ConfigDiagnostic, C as CourseConfig } from '../course-config-rRtME5UV.js';
17
17
  import { WaiverDiagnostic } from '../rules/waivers.js';
18
18
  import { KnowledgeVersionDiagnostic } from './knowledge-version.js';
19
19
  import { SidebarGroup } from './lesson-derivation.js';
20
20
  import './collections.js';
21
+ import '../reference/gate-retired-keys.js';
21
22
  import '../reference/lint-ignore.js';
22
23
  import '../reference/keyed-float-validate.js';
23
24
  import '../rules/catalog.js';
@@ -174,8 +175,42 @@ import '../rules/course-rules.js';
174
175
  * `id`, `slug`, `file` and a `notation` bundle of the lesson shape, so the
175
176
  * footer renders the cards its `[[key]]` terms and math open.
176
177
  * `notation.bundles` and `notation.backlinks` now carry those pages' ids too.
178
+ *
179
+ * v26 (carried cards, additive): `cards` — the course's `cards` settings with
180
+ * the engine defaults applied: whether "Carry cards" starts on (rule K1).
181
+ *
182
+ * v27 (LaTeX export): `lessonExports.latex` and `lessonExports.latexPaper`;
183
+ * every `assessmentContent` item carries its `type`, a choice item's
184
+ * `options` (plain-text labels) and `correctOptionId`, and a
185
+ * numeric item's `answer`, so an answer key can be printed without re-reading
186
+ * `content/assessments/`.
187
+ *
188
+ * v28 (Markdown export): `lessonExports.markdown`.
189
+ *
190
+ * v29 (no editorial status): the draft / in-review / reviewed flag is gone —
191
+ * `lessons[].status`, `editorialStatus` on the notation definitions of
192
+ * `lessons[]` and `pages[]`, and `status` on `notation.definitions[]` and
193
+ * `notation.bundles[]`. `diagnostics.curriculum` carries `retired-key`, with
194
+ * `file` and `line`, for a content file that still sets the key, and the
195
+ * lesson-assumptions check reports `missing-assumptions`, not `review-state`.
196
+ *
197
+ * v30 (headings with math, additive): `lessons[].headings[].text` is what a
198
+ * reader sees — inline math as it reads (`$\explain{k}{R}$` is `R`, not its
199
+ * LaTeX) and a `[[key]]` term as its label — and `math: true` marks a heading
200
+ * with inline math. A heading's `slug` is unchanged. Each choice option of
201
+ * `assessmentContent` carries `labelSegments`, its label split into text and
202
+ * math like `promptSegments`, so a label's math renders.
203
+ *
204
+ * v31 (indexed symbols, rule N23): the `notation` bundle of `lessons[]` and
205
+ * `pages[]` gains `derived` — the derived cards its body math uses, each
206
+ * composed from a base entry and an index entry (`\mathbf{v}_0` from
207
+ * `\mathbf{v}` and `{}_0`), keyed `<base>.sub.<index>`. A notation
208
+ * definition carries `reads`, `range`, `fixedIndex` and an index entry's
209
+ * `formulaTemplate` when its entry sets them, and a bundle definition its
210
+ * `range`. `diagnostics.math` carries `index-explained`, `index-swallowed`,
211
+ * `index-range` and `derived-key-taken`.
177
212
  */
178
- declare const MANIFEST_SCHEMA_VERSION = 25;
213
+ declare const MANIFEST_SCHEMA_VERSION = 31;
179
214
  declare const MANIFEST_PATH: string;
180
215
  interface ManifestCitation {
181
216
  readonly id: string;
@@ -207,10 +242,11 @@ interface ManifestLessonNotation {
207
242
  readonly notation: string;
208
243
  readonly label: string;
209
244
  readonly summary: string;
210
- readonly editorialStatus: EditorialStatus;
211
245
  readonly seeAlso: readonly string[];
212
246
  readonly units?: string;
213
247
  readonly formula?: string;
248
+ /** Rule N23: the set a running index letter runs over, shown on its card (v31). */
249
+ readonly range?: string;
214
250
  /** Symbols the formula names that have no card of their own (D15). */
215
251
  readonly glosses: readonly NotationGlossEntry[];
216
252
  /**
@@ -220,6 +256,26 @@ interface ManifestLessonNotation {
220
256
  */
221
257
  readonly formulaScope: readonly GlyphScopeEntry[];
222
258
  }
259
+ /**
260
+ * A derived card (rule N23, v31): the card of a symbol with a subscript that
261
+ * an index entry explains, composed from the `base` entry and the `index`
262
+ * entry by `derived-notation.mjs`. Its title and summary are about the
263
+ * indexed symbol; its formula names the base, whose card is one level deeper.
264
+ * It is listed nowhere — not in the Page notation panel, the glossary or an
265
+ * export's notation section — and opens only from the symbol.
266
+ */
267
+ interface ManifestDerivedNotation {
268
+ readonly key: string;
269
+ readonly base: string;
270
+ readonly index: string;
271
+ readonly notation: string;
272
+ readonly label: string;
273
+ readonly summary: string;
274
+ readonly units?: string;
275
+ readonly formula?: string;
276
+ readonly glosses: readonly NotationGlossEntry[];
277
+ readonly formulaScope: readonly GlyphScopeEntry[];
278
+ }
223
279
  /**
224
280
  * One keyed float of a lesson (v21): its key and number, and its caption pair
225
281
  * — `short` (an equation's `\caption{…}`, or the `short` prop) and, for a
@@ -287,9 +343,12 @@ interface ManifestLesson {
287
343
  */
288
344
  readonly headings: readonly {
289
345
  readonly slug: string;
346
+ /** What a reader sees: math as it reads, a `[[key]]` term as its label (v30). */
290
347
  readonly text: string;
291
348
  readonly level: number;
292
349
  readonly number?: string;
350
+ /** The heading has inline math (v30). */
351
+ readonly math?: true;
293
352
  }[];
294
353
  readonly file: string;
295
354
  readonly title: string;
@@ -299,7 +358,6 @@ interface ManifestLesson {
299
358
  readonly min: number;
300
359
  readonly max: number;
301
360
  };
302
- readonly status: EditorialStatus;
303
361
  /** Ordered — the curriculum contract. */
304
362
  readonly teaches: readonly string[];
305
363
  readonly requires: readonly string[];
@@ -343,6 +401,8 @@ interface ManifestLesson {
343
401
  }[];
344
402
  readonly definitionIds: readonly string[];
345
403
  readonly definitions: readonly ManifestLessonNotation[];
404
+ /** The derived cards (rule N23) the page's body math uses (v31). */
405
+ readonly derived: readonly ManifestDerivedNotation[];
346
406
  /** Every `[[key]]` / `\explain{key}` occurrence, resolved and located. */
347
407
  readonly resolution: readonly ManifestNotationResolution[];
348
408
  };
@@ -396,6 +456,25 @@ interface ManifestAssessmentItemContent {
396
456
  readonly itemId: string;
397
457
  readonly promptSegments: readonly ContentSegment[];
398
458
  readonly explanationSegments: readonly ContentSegment[];
459
+ /** What kind of answer the item takes (v27). */
460
+ readonly type: 'single-choice' | 'numeric';
461
+ /**
462
+ * A choice item's options in authored order: the label as authored, and
463
+ * split into text and math like the prompt (`labelSegments`, v30), so a
464
+ * label's math renders.
465
+ */
466
+ readonly options?: readonly {
467
+ readonly id: string;
468
+ readonly label: string;
469
+ readonly labelSegments: readonly ContentSegment[];
470
+ }[];
471
+ /** A choice item's correct option. */
472
+ readonly correctOptionId?: string;
473
+ /** A numeric item's accepted value and tolerance. */
474
+ readonly answer?: {
475
+ readonly value: number;
476
+ readonly tolerance: number;
477
+ };
399
478
  }
400
479
  /**
401
480
  * One **part** (v17) — a sidebar group and the directory its chapters live in,
@@ -439,6 +518,8 @@ interface Manifest {
439
518
  readonly numbering: NormalizedNumbering;
440
519
  /** How a check's and an example set's heading names its kind (`CourseConfig.blockLabels`). */
441
520
  readonly blockLabels: BlockLabels;
521
+ /** How the explanation cards start for a reader, defaults applied (`CourseConfig.cards`). */
522
+ readonly cards: NormalizedCards;
442
523
  /** Reader-facing identity + versions (the `[?]` About panel). */
443
524
  readonly about: ManifestAbout;
444
525
  readonly notation: {
@@ -575,4 +656,4 @@ declare function readManifestSync(): Manifest;
575
656
  */
576
657
  declare function loadManifest(courseConfig?: CourseConfig): Promise<Manifest>;
577
658
 
578
- export { MANIFEST_PATH, MANIFEST_SCHEMA_VERSION, type Manifest, type ManifestAbout, type ManifestAssessmentItemContent, type ManifestCitation, type ManifestLesson, type ManifestLessonFloat, type ManifestLessonNotation, type ManifestNotationResolution, type ManifestPage, type ManifestPart, type ManifestTitledBlock, type PrereqEdge, compileManifest, loadManifest, readManifestSync, serializeManifest, writeManifest };
659
+ export { MANIFEST_PATH, MANIFEST_SCHEMA_VERSION, type Manifest, type ManifestAbout, type ManifestAssessmentItemContent, type ManifestCitation, type ManifestDerivedNotation, type ManifestLesson, type ManifestLessonFloat, type ManifestLessonNotation, type ManifestNotationResolution, type ManifestPage, type ManifestPart, type ManifestTitledBlock, type PrereqEdge, compileManifest, loadManifest, readManifestSync, serializeManifest, writeManifest };