mystmd 1.3.8__tar.gz → 1.3.9__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mystmd
3
- Version: 1.3.8
3
+ Version: 1.3.9
4
4
  Summary: Command line tools for MyST Markdown
5
5
  Project-URL: Homepage, https://github.com/jupyter-book/mystmd
6
6
  Project-URL: Bug Tracker, https://github.com/jupyter-book/mystmd/issues
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mystmd",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "Command line tools for MyST Markdown",
5
5
  "author": "Rowan Cockett <rowan@curvenote.com>",
6
6
  "license": "MIT",
@@ -45,6 +45,6 @@
45
45
  "commander": "^10.0.1",
46
46
  "core-js": "^3.31.1",
47
47
  "js-yaml": "^4.1.0",
48
- "myst-cli": "^1.3.8"
48
+ "myst-cli": "^1.3.9"
49
49
  }
50
50
  }
@@ -193562,7 +193562,7 @@ var {
193562
193562
  } = import_index.default;
193563
193563
 
193564
193564
  // src/version.ts
193565
- var version = "1.3.8";
193565
+ var version = "1.3.9";
193566
193566
  var version_default = version;
193567
193567
 
193568
193568
  // ../myst-cli/dist/build/build.js
@@ -195262,7 +195262,8 @@ var PAGE_FRONTMATTER_KEYS = [
195262
195262
  "kernelspec",
195263
195263
  "jupytext",
195264
195264
  "tags",
195265
- "content_includes_title"
195265
+ "content_includes_title",
195266
+ "site"
195266
195267
  ];
195267
195268
 
195268
195269
  // ../myst-frontmatter/dist/exports/types.js
@@ -198972,6 +198973,9 @@ function validatePageFrontmatterKeys(value, opts) {
198972
198973
  if (defined(value.content_includes_title)) {
198973
198974
  output2.content_includes_title = validateBoolean(value.content_includes_title, incrementOptions("content_includes_title", opts));
198974
198975
  }
198976
+ if (defined(value.site)) {
198977
+ output2.site = validateObject(value.site, incrementOptions("site", opts));
198978
+ }
198975
198979
  return output2;
198976
198980
  }
198977
198981
  function validatePageFrontmatter(input3, opts) {
@@ -241280,6 +241284,61 @@ function writeJsonLogs(session, name3, logData) {
241280
241284
  writeFileToFolder((0, import_node_path6.join)(session.buildPath(), "logs", name3), JSON.stringify(logData, null, 2));
241281
241285
  }
241282
241286
 
241287
+ // ../myst-cli/dist/session/cache.js
241288
+ var import_node_fs2 = __toESM(require("fs"), 1);
241289
+ var import_node_path7 = __toESM(require("path"), 1);
241290
+ function castSession(session) {
241291
+ const cache = session;
241292
+ if (!cache.$citationRenderers)
241293
+ cache.$citationRenderers = {};
241294
+ if (!cache.$doiRenderers)
241295
+ cache.$doiRenderers = {};
241296
+ if (!cache.$internalReferences)
241297
+ cache.$internalReferences = {};
241298
+ if (!cache.$externalReferences)
241299
+ cache.$externalReferences = {};
241300
+ if (!cache.$mdast)
241301
+ cache.$mdast = {};
241302
+ if (!cache.$outputs)
241303
+ cache.$outputs = {};
241304
+ cache.$setMdast = (file, data) => {
241305
+ cache.$mdast[import_node_path7.default.resolve(file)] = data;
241306
+ };
241307
+ cache.$getMdast = (file) => {
241308
+ return cache.$mdast[import_node_path7.default.resolve(file)];
241309
+ };
241310
+ return cache;
241311
+ }
241312
+ function cachePath(session, filename) {
241313
+ return import_node_path7.default.join(session.buildPath(), "cache", filename);
241314
+ }
241315
+ function writeToCache(session, filename, data) {
241316
+ const file = cachePath(session, filename);
241317
+ session.log.debug(`Writing cache file: ${file}`);
241318
+ writeFileToFolder(file, data);
241319
+ }
241320
+ function checkCache(session, filename, opts) {
241321
+ const file = cachePath(session, filename);
241322
+ if (!import_node_fs2.default.existsSync(file)) {
241323
+ session.log.debug(`Cache file not found: ${file}`);
241324
+ return false;
241325
+ }
241326
+ const { ctimeMs } = import_node_fs2.default.lstatSync(file);
241327
+ const age = (Date.now() - ctimeMs) / (1e3 * 60 * 60 * 24);
241328
+ if ((opts === null || opts === void 0 ? void 0 : opts.maxAge) != null && age > opts.maxAge) {
241329
+ session.log.debug(`Cache file has expired (age: ${age.toFixed(3)} days, max: ${opts.maxAge} days): ${file}`);
241330
+ return false;
241331
+ }
241332
+ return true;
241333
+ }
241334
+ function loadFromCache(session, filename, opts) {
241335
+ if (!checkCache(session, filename, opts))
241336
+ return;
241337
+ const file = cachePath(session, filename);
241338
+ session.log.debug(`Loading cache file: ${file}`);
241339
+ return import_node_fs2.default.readFileSync(file).toString();
241340
+ }
241341
+
241283
241342
  // ../myst-cli/dist/frontmatter.js
241284
241343
  function frontmatterValidationOpts(vfile2, opts) {
241285
241344
  var _a6;
@@ -241315,12 +241374,27 @@ function getPageFrontmatter(session, tree, vfile2, preFrontmatter, keepTitleNode
241315
241374
  return { frontmatter: pageFrontmatter, identifiers };
241316
241375
  }
241317
241376
  function processPageFrontmatter(session, pageFrontmatter, validationOpts, path41) {
241318
- var _a6, _b, _c, _d2, _e;
241377
+ var _a6, _b, _c, _d2, _e, _f;
241378
+ const cache = castSession(session);
241319
241379
  const state = session.store.getState();
241320
241380
  const siteFrontmatter = (_a6 = selectors_exports.selectCurrentSiteConfig(state)) !== null && _a6 !== void 0 ? _a6 : {};
241321
241381
  const projectFrontmatter = path41 ? (_b = selectors_exports.selectLocalProjectConfig(state, path41)) !== null && _b !== void 0 ? _b : {} : {};
241322
241382
  const frontmatter = fillPageFrontmatter(pageFrontmatter, projectFrontmatter, validationOpts);
241323
- if (((_c = siteFrontmatter === null || siteFrontmatter === void 0 ? void 0 : siteFrontmatter.options) === null || _c === void 0 ? void 0 : _c.hide_authors) || ((_e = (_d2 = siteFrontmatter === null || siteFrontmatter === void 0 ? void 0 : siteFrontmatter.options) === null || _d2 === void 0 ? void 0 : _d2.design) === null || _e === void 0 ? void 0 : _e.hide_authors)) {
241383
+ const siteTemplate = cache.$siteTemplate;
241384
+ if (siteTemplate) {
241385
+ const siteOptions = siteTemplate.validateOptions((_c = pageFrontmatter.site) !== null && _c !== void 0 ? _c : {}, path41, {
241386
+ // The property is different on the page vs the myst.yml
241387
+ property: "site",
241388
+ // Passing in the log files ensures this isn't prefixed with `myst.yml`.
241389
+ warningLogFn: session.log.warn,
241390
+ errorLogFn: session.log.error
241391
+ });
241392
+ if (siteOptions && Object.keys(siteOptions).length > 0)
241393
+ frontmatter.site = siteOptions;
241394
+ } else {
241395
+ session.log.debug(`Site template not available to validate site frontmatter in ${path41}`);
241396
+ }
241397
+ if (((_d2 = siteFrontmatter === null || siteFrontmatter === void 0 ? void 0 : siteFrontmatter.options) === null || _d2 === void 0 ? void 0 : _d2.hide_authors) || ((_f = (_e = siteFrontmatter === null || siteFrontmatter === void 0 ? void 0 : siteFrontmatter.options) === null || _e === void 0 ? void 0 : _e.design) === null || _f === void 0 ? void 0 : _f.hide_authors)) {
241324
241398
  delete frontmatter.authors;
241325
241399
  }
241326
241400
  return frontmatter;
@@ -241358,61 +241432,6 @@ function updateFileInfoFromFrontmatter(session, file, frontmatter, url, dataUrl)
241358
241432
  }));
241359
241433
  }
241360
241434
 
241361
- // ../myst-cli/dist/session/cache.js
241362
- var import_node_fs2 = __toESM(require("fs"), 1);
241363
- var import_node_path7 = __toESM(require("path"), 1);
241364
- function castSession(session) {
241365
- const cache = session;
241366
- if (!cache.$citationRenderers)
241367
- cache.$citationRenderers = {};
241368
- if (!cache.$doiRenderers)
241369
- cache.$doiRenderers = {};
241370
- if (!cache.$internalReferences)
241371
- cache.$internalReferences = {};
241372
- if (!cache.$externalReferences)
241373
- cache.$externalReferences = {};
241374
- if (!cache.$mdast)
241375
- cache.$mdast = {};
241376
- if (!cache.$outputs)
241377
- cache.$outputs = {};
241378
- cache.$setMdast = (file, data) => {
241379
- cache.$mdast[import_node_path7.default.resolve(file)] = data;
241380
- };
241381
- cache.$getMdast = (file) => {
241382
- return cache.$mdast[import_node_path7.default.resolve(file)];
241383
- };
241384
- return cache;
241385
- }
241386
- function cachePath(session, filename) {
241387
- return import_node_path7.default.join(session.buildPath(), "cache", filename);
241388
- }
241389
- function writeToCache(session, filename, data) {
241390
- const file = cachePath(session, filename);
241391
- session.log.debug(`Writing cache file: ${file}`);
241392
- writeFileToFolder(file, data);
241393
- }
241394
- function checkCache(session, filename, opts) {
241395
- const file = cachePath(session, filename);
241396
- if (!import_node_fs2.default.existsSync(file)) {
241397
- session.log.debug(`Cache file not found: ${file}`);
241398
- return false;
241399
- }
241400
- const { ctimeMs } = import_node_fs2.default.lstatSync(file);
241401
- const age = (Date.now() - ctimeMs) / (1e3 * 60 * 60 * 24);
241402
- if ((opts === null || opts === void 0 ? void 0 : opts.maxAge) != null && age > opts.maxAge) {
241403
- session.log.debug(`Cache file has expired (age: ${age.toFixed(3)} days, max: ${opts.maxAge} days): ${file}`);
241404
- return false;
241405
- }
241406
- return true;
241407
- }
241408
- function loadFromCache(session, filename, opts) {
241409
- if (!checkCache(session, filename, opts))
241410
- return;
241411
- const file = cachePath(session, filename);
241412
- session.log.debug(`Loading cache file: ${file}`);
241413
- return import_node_fs2.default.readFileSync(file).toString();
241414
- }
241415
-
241416
241435
  // ../myst-cli/dist/config.js
241417
241436
  var VERSION = 1;
241418
241437
  function emptyConfig() {
@@ -242190,7 +242209,9 @@ var phrasingTypes = /* @__PURE__ */ new Set([
242190
242209
  "superscript",
242191
242210
  "smallcaps",
242192
242211
  "link",
242193
- "span"
242212
+ "span",
242213
+ "delete",
242214
+ "crossReference"
242194
242215
  ]);
242195
242216
  var UNHANDLED_ERROR_TEXT = "Unhandled TEX conversion";
242196
242217
  function originalValue(original, node3) {
@@ -242201,6 +242222,15 @@ function originalValue(original, node3) {
242201
242222
  return "";
242202
242223
  return original.slice(from4, to);
242203
242224
  }
242225
+ function hasStar(node3) {
242226
+ var _a6, _b;
242227
+ const first2 = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6[0];
242228
+ if (!first2)
242229
+ return false;
242230
+ if (((_b = first2.content) === null || _b === void 0 ? void 0 : _b.length) === 1 && first2.content[0].type === "string" && first2.content[0].content === "*" && first2.openMark === "" && first2.closeMark === "")
242231
+ return true;
242232
+ return false;
242233
+ }
242204
242234
  function getArguments(node3, type2) {
242205
242235
  var _a6, _b;
242206
242236
  return (_b = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6.filter((n) => {
@@ -242411,8 +242441,11 @@ var marks = {
242411
242441
  textsc: "smallcaps",
242412
242442
  textsubscript: "subscript",
242413
242443
  textsuperscript: "superscript",
242414
- hl: "strong"
242444
+ hl: "strong",
242415
242445
  // This needs to be done!
242446
+ cancel: "delete",
242447
+ bcancel: "delete",
242448
+ xcancel: "delete"
242416
242449
  };
242417
242450
  var TEXT_MARKS_HANDLERS = {
242418
242451
  ...Object.fromEntries(Object.entries(marks).map(([macro2, kind]) => {
@@ -242643,6 +242676,12 @@ var LINK_HANDLERS = {
242643
242676
  const url = texToText(urlNode);
242644
242677
  state.renderInline(textNode.content, "link", { url });
242645
242678
  },
242679
+ macro_hyperlink(node3, state) {
242680
+ state.openParagraph();
242681
+ const [urlNode, textNode] = getArguments(node3, "group");
242682
+ const url = texToText(urlNode);
242683
+ state.renderInline(textNode.content, "link", { url });
242684
+ },
242646
242685
  macro_url(node3, state) {
242647
242686
  state.openParagraph();
242648
242687
  const url = texToText(node3);
@@ -242652,8 +242691,14 @@ var LINK_HANDLERS = {
242652
242691
  state.openParagraph();
242653
242692
  const [urlNode] = getArguments(node3, "argument");
242654
242693
  const [textNode] = getArguments(node3, "group");
242655
- const url = texToText(urlNode);
242656
- state.renderInline(textNode.content, "link", { url });
242694
+ const label = texToText(urlNode);
242695
+ state.renderInline(textNode.content, "crossReference", { label });
242696
+ },
242697
+ macro_hypertarget(node3, state) {
242698
+ state.openParagraph();
242699
+ const [urlNode, content3] = getArguments(node3, "group");
242700
+ const label = texToText(urlNode);
242701
+ state.renderInline(content3, "span", { label });
242657
242702
  }
242658
242703
  };
242659
242704
 
@@ -242665,25 +242710,31 @@ var REF_HANDLERS = {
242665
242710
  const label = texToText(node3);
242666
242711
  const parent2 = state.top();
242667
242712
  const last = (_a6 = parent2 === null || parent2 === void 0 ? void 0 : parent2.children) === null || _a6 === void 0 ? void 0 : _a6.slice(-1)[0];
242668
- if ((parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "container") {
242713
+ const grandparent = state.stack[state.stack.length - 2];
242714
+ if (!(parent2 === null || parent2 === void 0 ? void 0 : parent2.label) && ((parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "container" || (parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "proof")) {
242669
242715
  parent2.label = label;
242670
- } else if ((parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "caption" && state.stack[state.stack.length - 2].type === "container") {
242671
- state.stack[state.stack.length - 2].label = label;
242716
+ } else if (!(grandparent === null || grandparent === void 0 ? void 0 : grandparent.label) && ((parent2 === null || parent2 === void 0 ? void 0 : parent2.type) === "caption" && (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === "container" || (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === "proof")) {
242717
+ grandparent.label = label;
242672
242718
  } else {
242673
242719
  if (!last) {
242674
- if (parent2)
242720
+ if (parent2 && !parent2.label)
242675
242721
  parent2.label = label;
242676
242722
  return;
242677
242723
  }
242678
242724
  if (!parent2)
242679
242725
  return;
242680
- last.label = label;
242726
+ if (!(last === null || last === void 0 ? void 0 : last.label))
242727
+ last.label = label;
242681
242728
  }
242682
242729
  },
242683
242730
  macro_ref(node3, state) {
242684
242731
  state.openParagraph();
242685
242732
  const label = texToText(getArguments(node3, "group"));
242686
- state.pushNode(u2("crossReference", { label }, [u2("text", "%s")]));
242733
+ const xref = u2("crossReference", { label }, [u2("text", "%s")]);
242734
+ if (hasStar(node3)) {
242735
+ xref.noLink = true;
242736
+ }
242737
+ state.pushNode(xref);
242687
242738
  },
242688
242739
  macro_subref(node3, state) {
242689
242740
  state.openParagraph();
@@ -278005,7 +278056,11 @@ var macros17 = {
278005
278056
  AA: 1,
278006
278057
  t: 1,
278007
278058
  u: 1,
278008
- v: 1
278059
+ v: 1,
278060
+ // Cancel
278061
+ cancel: 1,
278062
+ bcancel: 1,
278063
+ xcancel: 1
278009
278064
  };
278010
278065
  var mixed_arg_macros = ["multirow"];
278011
278066
  function patchOpenArgument(args) {
@@ -278982,7 +279037,10 @@ var MISC_HANDLERS = {
278982
279037
  state.closeParagraph();
278983
279038
  const top = state.top();
278984
279039
  if ((top === null || top === void 0 ? void 0 : top.type) === "container" && (top === null || top === void 0 ? void 0 : top.kind) === "figure" && ((_a6 = top === null || top === void 0 ? void 0 : top.children) === null || _a6 === void 0 ? void 0 : _a6.length)) {
278985
- const topCopy = { ...top, children: [] };
279040
+ const topCopy = copyNode({ ...top, children: [] });
279041
+ delete topCopy.label;
279042
+ delete topCopy.identifier;
279043
+ delete topCopy.html_id;
278986
279044
  state.closeNode();
278987
279045
  state.openNode("container", topCopy);
278988
279046
  }
@@ -289043,7 +289101,7 @@ var import_node_path15 = __toESM(require("path"), 1);
289043
289101
  var import_nbtx = __toESM(require_cjs2(), 1);
289044
289102
 
289045
289103
  // ../myst-cli/dist/version.js
289046
- var version2 = "1.3.8";
289104
+ var version2 = "1.3.9";
289047
289105
  var version_default2 = version2;
289048
289106
 
289049
289107
  // ../myst-cli/dist/utils/headers.js
@@ -299867,9 +299925,12 @@ var dist_default2 = template_default;
299867
299925
  // ../myst-cli/dist/build/site/template.js
299868
299926
  var DEFAULT_TEMPLATE = "book-theme";
299869
299927
  var DEFAULT_INSTALL_COMMAND = "npm install";
299870
- async function getMystTemplate(session, opts) {
299928
+ async function getSiteTemplate(session, opts) {
299871
299929
  var _a6, _b, _c;
299872
- const state = session.store.getState();
299930
+ const cache = castSession(session);
299931
+ const state = cache.store.getState();
299932
+ if (cache.$siteTemplate)
299933
+ return cache.$siteTemplate;
299873
299934
  const siteConfig = selectors_exports.selectCurrentSiteConfig(state);
299874
299935
  const file = (_a6 = selectors_exports.selectCurrentSiteFile(state)) !== null && _a6 !== void 0 ? _a6 : session.configFiles[0];
299875
299936
  const mystTemplate = new dist_default2(session, {
@@ -299888,6 +299949,7 @@ async function getMystTemplate(session, opts) {
299888
299949
  }
299889
299950
  });
299890
299951
  await mystTemplate.ensureTemplateExistsOnPath();
299952
+ cache.$siteTemplate = mystTemplate;
299891
299953
  return mystTemplate;
299892
299954
  }
299893
299955
  async function installSiteTemplate(session, mystTemplate) {
@@ -300452,7 +300514,7 @@ async function getSiteManifest(session, opts) {
300452
300514
  const { nav } = siteConfig;
300453
300515
  const actions = (_c = siteConfig.actions) === null || _c === void 0 ? void 0 : _c.map((action) => resolveSiteAction(session, action, siteConfigFile, "actions")).filter((action) => !!action);
300454
300516
  const siteFrontmatter = filterKeys(siteConfig, SITE_FRONTMATTER_KEYS);
300455
- const mystTemplate = await getMystTemplate(session, opts);
300517
+ const mystTemplate = await getSiteTemplate(session, opts);
300456
300518
  const validatedOptions = mystTemplate.validateOptions((_d2 = siteFrontmatter.options) !== null && _d2 !== void 0 ? _d2 : {}, siteConfigFile, { allowRemote: true });
300457
300519
  const validatedFrontmatter = mystTemplate.validateDoc(siteFrontmatter, validatedOptions, void 0, siteConfigFile);
300458
300520
  const resolvedOptions = await resolveTemplateFileOptions(session, mystTemplate, validatedOptions);
@@ -302244,14 +302306,13 @@ async function evaluateExpression(kernel, expr) {
302244
302306
  return { status: result.status, result };
302245
302307
  }
302246
302308
  function buildCacheKey(kernelSpec, nodes) {
302247
- var _a6, _b, _c;
302248
302309
  const hashableItems = [];
302249
302310
  for (const node3 of nodes) {
302250
302311
  if (isCellBlock(node3)) {
302251
302312
  hashableItems.push({
302252
302313
  kind: node3.type,
302253
302314
  content: select("code", node3).value,
302254
- raisesException: !!((_c = (_b = (_a6 = node3.data) === null || _a6 === void 0 ? void 0 : _a6.tags) === null || _b === void 0 ? void 0 : _b.includes) === null || _c === void 0 ? void 0 : _c.call(_b, "raises-exception"))
302315
+ raisesException: codeBlockRaisesException(node3)
302255
302316
  });
302256
302317
  } else {
302257
302318
  (0, import_node_assert.default)(isInlineExpression(node3));
@@ -302267,11 +302328,18 @@ function buildCacheKey(kernelSpec, nodes) {
302267
302328
  function isCellBlock(node3) {
302268
302329
  return node3.type === "block" && select("code", node3) !== null && select("output", node3) !== null;
302269
302330
  }
302331
+ function codeBlockRaisesException(node3) {
302332
+ var _a6, _b, _c;
302333
+ return !!((_c = (_b = (_a6 = node3.data) === null || _a6 === void 0 ? void 0 : _a6.tags) === null || _b === void 0 ? void 0 : _b.includes) === null || _c === void 0 ? void 0 : _c.call(_b, "raises-exception"));
302334
+ }
302335
+ function codeBlockSkipsExecution(node3) {
302336
+ var _a6, _b, _c;
302337
+ return !!((_c = (_b = (_a6 = node3.data) === null || _a6 === void 0 ? void 0 : _a6.tags) === null || _b === void 0 ? void 0 : _b.includes) === null || _c === void 0 ? void 0 : _c.call(_b, "skip-execution"));
302338
+ }
302270
302339
  function isInlineExpression(node3) {
302271
302340
  return node3.type === "inlineExpression";
302272
302341
  }
302273
302342
  async function computeExecutableNodes(kernel, nodes, opts) {
302274
- var _a6, _b, _c;
302275
302343
  let errorOccurred = false;
302276
302344
  const results = [];
302277
302345
  for (const matchedNode of nodes) {
@@ -302279,7 +302347,7 @@ async function computeExecutableNodes(kernel, nodes, opts) {
302279
302347
  const code7 = select("code", matchedNode);
302280
302348
  const { status, outputs } = await executeCode(kernel, code7.value);
302281
302349
  results.push(outputs);
302282
- const allowErrors = !!((_c = (_b = (_a6 = matchedNode.data) === null || _a6 === void 0 ? void 0 : _a6.tags) === null || _b === void 0 ? void 0 : _b.includes) === null || _c === void 0 ? void 0 : _c.call(_b, "raises-exception"));
302350
+ const allowErrors = codeBlockRaisesException(matchedNode);
302283
302351
  if (status === "error" && !allowErrors) {
302284
302352
  const errorMessage = outputs.map((item) => item.traceback).flat().join("\n");
302285
302353
  fileError(opts.vfile, `An exception occurred during code execution, halting further execution:
@@ -302324,7 +302392,7 @@ function applyComputedOutputsToNodes(nodes, computedResult) {
302324
302392
  async function kernelExecutionTransform(tree, vfile2, opts) {
302325
302393
  var _a6;
302326
302394
  const log = (_a6 = opts.log) !== null && _a6 !== void 0 ? _a6 : console;
302327
- const executableNodes = selectAll(`block[kind=${NotebookCell.code}],inlineExpression`, tree);
302395
+ const executableNodes = selectAll(`block[kind=${NotebookCell.code}],inlineExpression`, tree).filter((node3) => !(isCellBlock(node3) && codeBlockSkipsExecution(node3)));
302328
302396
  if (executableNodes.length === 0) {
302329
302397
  return;
302330
302398
  }
@@ -303795,168 +303863,6 @@ function renderTemplate(template, opts) {
303795
303863
  ${rendered}`);
303796
303864
  }
303797
303865
 
303798
- // ../myst-to-tex/dist/tables.js
303799
- var TOTAL_TABLE_WIDTH = 886;
303800
- function renderPColumn(width) {
303801
- if (width === 1)
303802
- return `p{\\dimexpr \\linewidth-2\\tabcolsep}`;
303803
- return `p{\\dimexpr ${width.toFixed(3)}\\linewidth-2\\tabcolsep}`;
303804
- }
303805
- function getColumnWidths(node3) {
303806
- var _a6, _b, _c;
303807
- let bestMaybeWidths = [];
303808
- let mostNonNulls = 0;
303809
- for (let i2 = 0; i2 < node3.children.length; i2 += 1) {
303810
- const row2 = node3.children[i2];
303811
- const maybeWidths = row2.children.reduce((acc, cell3) => {
303812
- var _a7, _b2;
303813
- const colwidth = new Array((_a7 = cell3.colspan) !== null && _a7 !== void 0 ? _a7 : 1).fill(cell3.width ? cell3.width / ((_b2 = cell3.colspan) !== null && _b2 !== void 0 ? _b2 : 1) : null);
303814
- return [...acc, ...colwidth];
303815
- }, []);
303816
- const nonNulls = maybeWidths.filter((maybeWidth) => maybeWidth > 0).length;
303817
- if (i2 === 0 || nonNulls >= mostNonNulls) {
303818
- mostNonNulls = nonNulls;
303819
- bestMaybeWidths = maybeWidths;
303820
- if (mostNonNulls === maybeWidths.length) {
303821
- break;
303822
- }
303823
- }
303824
- }
303825
- let widths;
303826
- if (mostNonNulls === bestMaybeWidths.length) {
303827
- widths = bestMaybeWidths;
303828
- } else {
303829
- const totalDefinedWidths = bestMaybeWidths.reduce((acc, cur) => cur == null ? acc : acc + cur, 0);
303830
- const remainingSpace = TOTAL_TABLE_WIDTH - totalDefinedWidths;
303831
- const nullCells = bestMaybeWidths.length - mostNonNulls;
303832
- const defaultWidth = Math.floor(remainingSpace / nullCells);
303833
- widths = bestMaybeWidths.map((w) => w == null || w === 0 ? defaultWidth : w);
303834
- }
303835
- const total = widths.reduce((acc, cur) => acc + cur, 0);
303836
- const fractionalWidths = widths.map((w) => w / total);
303837
- const columnSpec = fractionalWidths.map((w) => renderPColumn(w)).join("");
303838
- const numColumns = widths.length > 0 ? widths.length : (_c = (_b = (_a6 = node3 === null || node3 === void 0 ? void 0 : node3.children[0]) === null || _a6 === void 0 ? void 0 : _a6.children) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
303839
- return { widths: fractionalWidths, columnSpec, numColumns };
303840
- }
303841
- function renderTableCell(state, cell3, i2, spanIdx, widths, childCount) {
303842
- var _a6;
303843
- let renderedSpan = 1;
303844
- const colspan = (_a6 = cell3.colspan) !== null && _a6 !== void 0 ? _a6 : 1;
303845
- if (colspan > 1) {
303846
- let width = 0;
303847
- for (let j = 0; j < colspan; j += 1) {
303848
- width += widths[spanIdx + j];
303849
- }
303850
- state.write(`\\multicolumn{${colspan}}{${renderPColumn(width)}}{`);
303851
- renderedSpan = colspan;
303852
- }
303853
- if (cell3.children.length === 1 && cell3.children[0].type === "paragraph") {
303854
- state.renderChildren(cell3.children[0], true);
303855
- } else {
303856
- state.renderChildren(cell3, true);
303857
- }
303858
- if (colspan > 1)
303859
- state.write("}");
303860
- if (i2 < childCount - 1) {
303861
- state.write(" & ");
303862
- }
303863
- return renderedSpan;
303864
- }
303865
- function renderNodeToLatex(node3, state) {
303866
- state.usePackages("booktabs");
303867
- const { widths, columnSpec, numColumns } = getColumnWidths(node3);
303868
- if (!numColumns) {
303869
- throw new Error("invalid table format, no columns");
303870
- }
303871
- state.data.isInTable = true;
303872
- if (!state.data.isInContainer) {
303873
- state.write("\\bigskip\\noindent");
303874
- }
303875
- state.ensureNewLine();
303876
- let numHeaderRowsFound = 0;
303877
- if (state.data.longFigure) {
303878
- state.ensureNewLine();
303879
- state.write("\\hline");
303880
- state.ensureNewLine();
303881
- let endHeader = false;
303882
- node3.children.forEach(({ children: rowContent }) => {
303883
- var _a6, _b;
303884
- if (endHeader)
303885
- return;
303886
- if ((_a6 = rowContent[0]) === null || _a6 === void 0 ? void 0 : _a6.header) {
303887
- numHeaderRowsFound += 1;
303888
- let spanIdx = 0;
303889
- rowContent.forEach((cell3, i2) => {
303890
- spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
303891
- });
303892
- state.write(" \\\\");
303893
- state.ensureNewLine();
303894
- }
303895
- if (!((_b = rowContent[0]) === null || _b === void 0 ? void 0 : _b.header)) {
303896
- endHeader = true;
303897
- }
303898
- });
303899
- if (numHeaderRowsFound > 0) {
303900
- state.ensureNewLine();
303901
- state.write("\\hline");
303902
- state.ensureNewLine();
303903
- state.write("\\endfirsthead");
303904
- state.ensureNewLine();
303905
- state.write("\\hline");
303906
- state.ensureNewLine();
303907
- state.write(`\\multicolumn{${numColumns}}{c}{\\tablename\\ \\thetable\\ -- \\textit{Continued from previous page}}\\\\`);
303908
- state.ensureNewLine();
303909
- node3.children.forEach(({ children: rowContent }, index4) => {
303910
- if (index4 >= numHeaderRowsFound)
303911
- return;
303912
- let spanIdx = 0;
303913
- rowContent.forEach((cell3, i2) => {
303914
- spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
303915
- });
303916
- state.write(" \\\\");
303917
- state.ensureNewLine();
303918
- });
303919
- state.ensureNewLine();
303920
- state.write("\\hline");
303921
- state.ensureNewLine();
303922
- state.write("\\endhead");
303923
- state.ensureNewLine();
303924
- }
303925
- } else {
303926
- state.write(`\\begin{tabular}{${columnSpec}}`);
303927
- state.ensureNewLine();
303928
- state.write(`\\toprule`);
303929
- state.ensureNewLine();
303930
- }
303931
- node3.children.forEach(({ children: rowContent }, index4) => {
303932
- var _a6;
303933
- if (index4 < numHeaderRowsFound)
303934
- return;
303935
- let spanIdx = 0;
303936
- rowContent.forEach((cell3, i2) => {
303937
- spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
303938
- });
303939
- state.write(" \\\\");
303940
- state.ensureNewLine();
303941
- if ((_a6 = rowContent[0]) === null || _a6 === void 0 ? void 0 : _a6.header) {
303942
- state.write("\\hline");
303943
- state.ensureNewLine();
303944
- }
303945
- });
303946
- if (state.data.longFigure) {
303947
- state.write("\\hline");
303948
- } else {
303949
- state.write("\\bottomrule");
303950
- state.ensureNewLine();
303951
- state.write("\\end{tabular}");
303952
- }
303953
- state.closeBlock(node3);
303954
- state.data.isInTable = false;
303955
- if (!state.data.isInContainer) {
303956
- state.write("\\bigskip");
303957
- }
303958
- }
303959
-
303960
303866
  // ../myst-to-tex/dist/types.js
303961
303867
  var DEFAULT_IMAGE_WIDTH = 0.7;
303962
303868
  var DEFAULT_PAGE_WIDTH_PIXELS = 800;
@@ -304254,6 +304160,169 @@ function addIndexEntries(node3, state) {
304254
304160
  });
304255
304161
  }
304256
304162
 
304163
+ // ../myst-to-tex/dist/tables.js
304164
+ var TOTAL_TABLE_WIDTH = 886;
304165
+ function renderPColumn(width) {
304166
+ if (width === 1)
304167
+ return `p{\\dimexpr \\linewidth-2\\tabcolsep}`;
304168
+ return `p{\\dimexpr ${width.toFixed(3)}\\linewidth-2\\tabcolsep}`;
304169
+ }
304170
+ function getColumnWidths(node3) {
304171
+ var _a6, _b, _c;
304172
+ let bestMaybeWidths = [];
304173
+ let mostNonNulls = 0;
304174
+ for (let i2 = 0; i2 < node3.children.length; i2 += 1) {
304175
+ const row2 = node3.children[i2];
304176
+ const maybeWidths = row2.children.reduce((acc, cell3) => {
304177
+ var _a7, _b2;
304178
+ const colwidth = new Array((_a7 = cell3.colspan) !== null && _a7 !== void 0 ? _a7 : 1).fill(cell3.width ? cell3.width / ((_b2 = cell3.colspan) !== null && _b2 !== void 0 ? _b2 : 1) : null);
304179
+ return [...acc, ...colwidth];
304180
+ }, []);
304181
+ const nonNulls = maybeWidths.filter((maybeWidth) => maybeWidth > 0).length;
304182
+ if (i2 === 0 || nonNulls >= mostNonNulls) {
304183
+ mostNonNulls = nonNulls;
304184
+ bestMaybeWidths = maybeWidths;
304185
+ if (mostNonNulls === maybeWidths.length) {
304186
+ break;
304187
+ }
304188
+ }
304189
+ }
304190
+ let widths;
304191
+ if (mostNonNulls === bestMaybeWidths.length) {
304192
+ widths = bestMaybeWidths;
304193
+ } else {
304194
+ const totalDefinedWidths = bestMaybeWidths.reduce((acc, cur) => cur == null ? acc : acc + cur, 0);
304195
+ const remainingSpace = TOTAL_TABLE_WIDTH - totalDefinedWidths;
304196
+ const nullCells = bestMaybeWidths.length - mostNonNulls;
304197
+ const defaultWidth = Math.floor(remainingSpace / nullCells);
304198
+ widths = bestMaybeWidths.map((w) => w == null || w === 0 ? defaultWidth : w);
304199
+ }
304200
+ const total = widths.reduce((acc, cur) => acc + cur, 0);
304201
+ const fractionalWidths = widths.map((w) => w / total);
304202
+ const columnSpec = fractionalWidths.map((w) => renderPColumn(w)).join("");
304203
+ const numColumns = widths.length > 0 ? widths.length : (_c = (_b = (_a6 = node3 === null || node3 === void 0 ? void 0 : node3.children[0]) === null || _a6 === void 0 ? void 0 : _a6.children) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
304204
+ return { widths: fractionalWidths, columnSpec, numColumns };
304205
+ }
304206
+ function renderTableCell(state, cell3, i2, spanIdx, widths, childCount) {
304207
+ var _a6;
304208
+ let renderedSpan = 1;
304209
+ const colspan = (_a6 = cell3.colspan) !== null && _a6 !== void 0 ? _a6 : 1;
304210
+ if (colspan > 1) {
304211
+ let width = 0;
304212
+ for (let j = 0; j < colspan; j += 1) {
304213
+ width += widths[spanIdx + j];
304214
+ }
304215
+ state.write(`\\multicolumn{${colspan}}{${renderPColumn(width)}}{`);
304216
+ renderedSpan = colspan;
304217
+ }
304218
+ if (cell3.children.length === 1 && cell3.children[0].type === "paragraph") {
304219
+ state.renderChildren(cell3.children[0], true);
304220
+ } else {
304221
+ state.renderChildren(cell3, true);
304222
+ }
304223
+ if (colspan > 1)
304224
+ state.write("}");
304225
+ if (i2 < childCount - 1) {
304226
+ state.write(" & ");
304227
+ }
304228
+ return renderedSpan;
304229
+ }
304230
+ function renderNodeToLatex(node3, state) {
304231
+ state.usePackages("booktabs");
304232
+ const { widths, columnSpec, numColumns } = getColumnWidths(node3);
304233
+ if (!numColumns) {
304234
+ throw new Error("invalid table format, no columns");
304235
+ }
304236
+ addIndexEntries(node3, state);
304237
+ state.data.isInTable = true;
304238
+ if (!state.data.isInContainer) {
304239
+ state.write("\\bigskip\\noindent");
304240
+ }
304241
+ state.ensureNewLine();
304242
+ let numHeaderRowsFound = 0;
304243
+ if (state.data.longFigure) {
304244
+ state.ensureNewLine();
304245
+ state.write("\\hline");
304246
+ state.ensureNewLine();
304247
+ let endHeader = false;
304248
+ node3.children.forEach(({ children: rowContent }) => {
304249
+ var _a6, _b;
304250
+ if (endHeader)
304251
+ return;
304252
+ if ((_a6 = rowContent[0]) === null || _a6 === void 0 ? void 0 : _a6.header) {
304253
+ numHeaderRowsFound += 1;
304254
+ let spanIdx = 0;
304255
+ rowContent.forEach((cell3, i2) => {
304256
+ spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
304257
+ });
304258
+ state.write(" \\\\");
304259
+ state.ensureNewLine();
304260
+ }
304261
+ if (!((_b = rowContent[0]) === null || _b === void 0 ? void 0 : _b.header)) {
304262
+ endHeader = true;
304263
+ }
304264
+ });
304265
+ if (numHeaderRowsFound > 0) {
304266
+ state.ensureNewLine();
304267
+ state.write("\\hline");
304268
+ state.ensureNewLine();
304269
+ state.write("\\endfirsthead");
304270
+ state.ensureNewLine();
304271
+ state.write("\\hline");
304272
+ state.ensureNewLine();
304273
+ state.write(`\\multicolumn{${numColumns}}{c}{\\tablename\\ \\thetable\\ -- \\textit{Continued from previous page}}\\\\`);
304274
+ state.ensureNewLine();
304275
+ node3.children.forEach(({ children: rowContent }, index4) => {
304276
+ if (index4 >= numHeaderRowsFound)
304277
+ return;
304278
+ let spanIdx = 0;
304279
+ rowContent.forEach((cell3, i2) => {
304280
+ spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
304281
+ });
304282
+ state.write(" \\\\");
304283
+ state.ensureNewLine();
304284
+ });
304285
+ state.ensureNewLine();
304286
+ state.write("\\hline");
304287
+ state.ensureNewLine();
304288
+ state.write("\\endhead");
304289
+ state.ensureNewLine();
304290
+ }
304291
+ } else {
304292
+ state.write(`\\begin{tabular}{${columnSpec}}`);
304293
+ state.ensureNewLine();
304294
+ state.write(`\\toprule`);
304295
+ state.ensureNewLine();
304296
+ }
304297
+ node3.children.forEach(({ children: rowContent }, index4) => {
304298
+ var _a6;
304299
+ if (index4 < numHeaderRowsFound)
304300
+ return;
304301
+ let spanIdx = 0;
304302
+ rowContent.forEach((cell3, i2) => {
304303
+ spanIdx += renderTableCell(state, cell3, i2, spanIdx, widths, rowContent.length);
304304
+ });
304305
+ state.write(" \\\\");
304306
+ state.ensureNewLine();
304307
+ if ((_a6 = rowContent[0]) === null || _a6 === void 0 ? void 0 : _a6.header) {
304308
+ state.write("\\hline");
304309
+ state.ensureNewLine();
304310
+ }
304311
+ });
304312
+ if (state.data.longFigure) {
304313
+ state.write("\\hline");
304314
+ } else {
304315
+ state.write("\\bottomrule");
304316
+ state.ensureNewLine();
304317
+ state.write("\\end{tabular}");
304318
+ }
304319
+ state.closeBlock(node3);
304320
+ state.data.isInTable = false;
304321
+ if (!state.data.isInContainer) {
304322
+ state.write("\\bigskip");
304323
+ }
304324
+ }
304325
+
304257
304326
  // ../myst-to-tex/dist/container.js
304258
304327
  var CaptionKind;
304259
304328
  (function(CaptionKind3) {
@@ -304388,27 +304457,17 @@ var captionHandler = (node3, state) => {
304388
304457
  };
304389
304458
 
304390
304459
  // ../myst-to-tex/dist/math.js
304391
- var ENVIRONMENTS2 = [
304460
+ var TOP_LEVEL_ENVIRONMENTS = [
304392
304461
  "equation",
304393
304462
  "multline",
304394
304463
  "gather",
304395
304464
  "align",
304396
304465
  "alignat",
304397
304466
  "flalign",
304398
- "matrix",
304399
- "pmatrix",
304400
- "bmatrix",
304401
- "Bmatrix",
304402
- "vmatrix",
304403
- "Vmatrix",
304404
304467
  "eqnarray"
304405
304468
  ];
304406
- var RE_OPEN2 = new RegExp(`^\\\\begin{(${ENVIRONMENTS2.join("|")})([*]?)}`);
304407
- function isAmsmathEnvironment(value) {
304408
- const matches4 = value.trim().matchAll(new RegExp(`\\\\begin{(${ENVIRONMENTS2.join("|")})}`, "g"));
304409
- if ([...matches4].length > 1) {
304410
- return false;
304411
- }
304469
+ var RE_OPEN2 = new RegExp(`^\\\\begin{(${TOP_LEVEL_ENVIRONMENTS.join("|")})([*]?)}`);
304470
+ function isTopLevelAmsmathEnvironment(value) {
304412
304471
  const matchOpen = value.trim().match(RE_OPEN2);
304413
304472
  if (!matchOpen)
304414
304473
  return false;
@@ -304454,12 +304513,13 @@ var math4 = (node3, state) => {
304454
304513
  }
304455
304514
  state.usePackages("amsmath");
304456
304515
  addMacrosToState(node3.value, state);
304516
+ addIndexEntries(node3, state);
304457
304517
  if (state.data.isInTable) {
304458
304518
  state.write("\\(\\displaystyle ");
304459
304519
  state.write(node3.value);
304460
304520
  state.write(" \\)");
304461
304521
  } else {
304462
- const isAmsMath = isAmsmathEnvironment(node3.value);
304522
+ const isAmsMath = isTopLevelAmsmathEnvironment(node3.value);
304463
304523
  if (isAmsMath) {
304464
304524
  state.ensureNewLine();
304465
304525
  state.write(node3.value);
@@ -304563,6 +304623,7 @@ var proofHandler = (node3, state) => {
304563
304623
  t2.type = "__delete__";
304564
304624
  }
304565
304625
  const newNode = remove(node3, "__delete__");
304626
+ addIndexEntries(node3, state);
304566
304627
  state.write("\\begin{");
304567
304628
  state.write(env7);
304568
304629
  state.write("}");
@@ -304785,6 +304846,7 @@ var handlers3 = {
304785
304846
  state.text(node3.value);
304786
304847
  },
304787
304848
  paragraph(node3, state) {
304849
+ addIndexEntries(node3, state);
304788
304850
  state.renderChildren(node3);
304789
304851
  },
304790
304852
  heading(node3, state) {
@@ -304853,9 +304915,11 @@ var handlers3 = {
304853
304915
  state.write("\\printindex\n");
304854
304916
  return;
304855
304917
  }
304918
+ addIndexEntries(node3, state);
304856
304919
  state.renderChildren(node3, false);
304857
304920
  },
304858
304921
  blockquote(node3, state) {
304922
+ addIndexEntries(node3, state);
304859
304923
  state.renderEnvironment(node3, "quote");
304860
304924
  },
304861
304925
  definitionList(node3, state) {
@@ -304879,6 +304943,7 @@ var handlers3 = {
304879
304943
  if (node3.visibility === "remove") {
304880
304944
  return;
304881
304945
  }
304946
+ addIndexEntries(node3, state);
304882
304947
  let start = "\\begin{verbatim}\n";
304883
304948
  let end = "\n\\end{verbatim}";
304884
304949
  if (state.options.codeStyle === "listings" || getClasses(node3.class).includes("listings") && node3.lang !== void 0) {
@@ -304898,6 +304963,7 @@ var handlers3 = {
304898
304963
  state.closeBlock(node3);
304899
304964
  },
304900
304965
  list(node3, state) {
304966
+ addIndexEntries(node3, state);
304901
304967
  if (state.data.isInTable) {
304902
304968
  node3.children.forEach((child, i2) => {
304903
304969
  state.write(node3.ordered ? `${i2}.~~` : "\\textbullet~~");
@@ -304928,6 +304994,7 @@ var handlers3 = {
304928
304994
  state.renderChildren(node3, false);
304929
304995
  },
304930
304996
  div(node3, state) {
304997
+ addIndexEntries(node3, state);
304931
304998
  state.renderChildren(node3, false);
304932
304999
  },
304933
305000
  span(node3, state) {
@@ -305010,6 +305077,7 @@ var handlers3 = {
305010
305077
  state.write("}");
305011
305078
  },
305012
305079
  admonition(node3, state) {
305080
+ addIndexEntries(node3, state);
305013
305081
  state.usePackages("framed");
305014
305082
  state.renderEnvironment(node3, "framed");
305015
305083
  },
@@ -305019,6 +305087,7 @@ var handlers3 = {
305019
305087
  },
305020
305088
  table: renderNodeToLatex,
305021
305089
  image(node3, state) {
305090
+ addIndexEntries(node3, state);
305022
305091
  state.usePackages("graphicx");
305023
305092
  const { width: nodeWidth, url: nodeSrc, align: nodeAlign } = node3;
305024
305093
  const src = nodeSrc;
@@ -316107,7 +316176,7 @@ async function startServer(session, opts) {
316107
316176
  var _a6;
316108
316177
  await session.reload();
316109
316178
  warnOnHostEnvironmentVariable(session, opts);
316110
- const mystTemplate = await getMystTemplate(session, opts);
316179
+ const mystTemplate = await getSiteTemplate(session, opts);
316111
316180
  if (!opts.headless)
316112
316181
  await installSiteTemplate(session, mystTemplate);
316113
316182
  await buildSite(session, opts);
@@ -316236,7 +316305,7 @@ function get_baseurl(session) {
316236
316305
  }
316237
316306
  async function buildHtml(session, opts) {
316238
316307
  var _a6;
316239
- const template = await getMystTemplate(session, opts);
316308
+ const template = await getSiteTemplate(session, opts);
316240
316309
  const baseurl = get_baseurl(session);
316241
316310
  const htmlDir = import_node_path54.default.join(session.buildPath(), "html");
316242
316311
  import_fs_extra.default.rmSync(htmlDir, { recursive: true, force: true });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes