mystmd 1.3.20__py3-none-any.whl → 1.3.22__py3-none-any.whl

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.
mystmd_py/myst.cjs CHANGED
@@ -9403,7 +9403,7 @@ var require_es_regexp_constructor = __commonJS({
9403
9403
  var length = string2.length;
9404
9404
  var index5 = 0;
9405
9405
  var result = "";
9406
- var brackets2 = false;
9406
+ var brackets = false;
9407
9407
  var chr;
9408
9408
  for (; index5 <= length; index5++) {
9409
9409
  chr = charAt(string2, index5);
@@ -9411,13 +9411,13 @@ var require_es_regexp_constructor = __commonJS({
9411
9411
  result += chr + charAt(string2, ++index5);
9412
9412
  continue;
9413
9413
  }
9414
- if (!brackets2 && chr === ".") {
9414
+ if (!brackets && chr === ".") {
9415
9415
  result += "[\\s\\S]";
9416
9416
  } else {
9417
9417
  if (chr === "[") {
9418
- brackets2 = true;
9418
+ brackets = true;
9419
9419
  } else if (chr === "]") {
9420
- brackets2 = false;
9420
+ brackets = false;
9421
9421
  }
9422
9422
  result += chr;
9423
9423
  }
@@ -9430,7 +9430,7 @@ var require_es_regexp_constructor = __commonJS({
9430
9430
  var result = "";
9431
9431
  var named = [];
9432
9432
  var names = {};
9433
- var brackets2 = false;
9433
+ var brackets = false;
9434
9434
  var ncg = false;
9435
9435
  var groupid = 0;
9436
9436
  var groupname = "";
@@ -9440,11 +9440,11 @@ var require_es_regexp_constructor = __commonJS({
9440
9440
  if (chr === "\\") {
9441
9441
  chr = chr + charAt(string2, ++index5);
9442
9442
  } else if (chr === "]") {
9443
- brackets2 = false;
9444
- } else if (!brackets2)
9443
+ brackets = false;
9444
+ } else if (!brackets)
9445
9445
  switch (true) {
9446
9446
  case chr === "[":
9447
- brackets2 = true;
9447
+ brackets = true;
9448
9448
  break;
9449
9449
  case chr === "(":
9450
9450
  if (exec3(IS_NCG, stringSlice(string2, index5 + 1))) {
@@ -49636,18 +49636,18 @@ var require_parser3 = __commonJS({
49636
49636
  let last = false;
49637
49637
  let open2 = false;
49638
49638
  let params = [];
49639
- let brackets2 = [];
49639
+ let brackets = [];
49640
49640
  while (!this.tokenizer.endOfFile()) {
49641
49641
  token = this.tokenizer.nextToken();
49642
49642
  type2 = token[0];
49643
49643
  if (type2 === "(" || type2 === "[") {
49644
- brackets2.push(type2 === "(" ? ")" : "]");
49645
- } else if (type2 === "{" && brackets2.length > 0) {
49646
- brackets2.push("}");
49647
- } else if (type2 === brackets2[brackets2.length - 1]) {
49648
- brackets2.pop();
49644
+ brackets.push(type2 === "(" ? ")" : "]");
49645
+ } else if (type2 === "{" && brackets.length > 0) {
49646
+ brackets.push("}");
49647
+ } else if (type2 === brackets[brackets.length - 1]) {
49648
+ brackets.pop();
49649
49649
  }
49650
- if (brackets2.length === 0) {
49650
+ if (brackets.length === 0) {
49651
49651
  if (type2 === ";") {
49652
49652
  node3.source.end = this.getPosition(token[2]);
49653
49653
  node3.source.end.offset++;
@@ -49721,18 +49721,18 @@ var require_parser3 = __commonJS({
49721
49721
  );
49722
49722
  }
49723
49723
  colon(tokens) {
49724
- let brackets2 = 0;
49724
+ let brackets = 0;
49725
49725
  let prev, token, type2;
49726
49726
  for (let [i2, element5] of tokens.entries()) {
49727
49727
  token = element5;
49728
49728
  type2 = token[0];
49729
49729
  if (type2 === "(") {
49730
- brackets2 += 1;
49730
+ brackets += 1;
49731
49731
  }
49732
49732
  if (type2 === ")") {
49733
- brackets2 -= 1;
49733
+ brackets -= 1;
49734
49734
  }
49735
- if (brackets2 === 0 && type2 === ":") {
49735
+ if (brackets === 0 && type2 === ":") {
49736
49736
  if (!prev) {
49737
49737
  this.doubleColon(token);
49738
49738
  } else if (prev[0] === "word" && prev[1] === "progid") {
@@ -49930,7 +49930,7 @@ var require_parser3 = __commonJS({
49930
49930
  let type2 = null;
49931
49931
  let colon = false;
49932
49932
  let bracket = null;
49933
- let brackets2 = [];
49933
+ let brackets = [];
49934
49934
  let customProperty = start[1].startsWith("--");
49935
49935
  let tokens = [];
49936
49936
  let token = start;
@@ -49940,12 +49940,12 @@ var require_parser3 = __commonJS({
49940
49940
  if (type2 === "(" || type2 === "[") {
49941
49941
  if (!bracket)
49942
49942
  bracket = token;
49943
- brackets2.push(type2 === "(" ? ")" : "]");
49943
+ brackets.push(type2 === "(" ? ")" : "]");
49944
49944
  } else if (customProperty && colon && type2 === "{") {
49945
49945
  if (!bracket)
49946
49946
  bracket = token;
49947
- brackets2.push("}");
49948
- } else if (brackets2.length === 0) {
49947
+ brackets.push("}");
49948
+ } else if (brackets.length === 0) {
49949
49949
  if (type2 === ";") {
49950
49950
  if (colon) {
49951
49951
  this.decl(tokens, customProperty);
@@ -49963,16 +49963,16 @@ var require_parser3 = __commonJS({
49963
49963
  } else if (type2 === ":") {
49964
49964
  colon = true;
49965
49965
  }
49966
- } else if (type2 === brackets2[brackets2.length - 1]) {
49967
- brackets2.pop();
49968
- if (brackets2.length === 0)
49966
+ } else if (type2 === brackets[brackets.length - 1]) {
49967
+ brackets.pop();
49968
+ if (brackets.length === 0)
49969
49969
  bracket = null;
49970
49970
  }
49971
49971
  token = this.tokenizer.nextToken();
49972
49972
  }
49973
49973
  if (this.tokenizer.endOfFile())
49974
49974
  end = true;
49975
- if (brackets2.length > 0)
49975
+ if (brackets.length > 0)
49976
49976
  this.unclosedBracket(bracket);
49977
49977
  if (end && colon) {
49978
49978
  if (!customProperty) {
@@ -91757,7 +91757,7 @@ var require_lib15 = __commonJS({
91757
91757
  const prefix2 = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
91758
91758
  return prefix2 + join20(pathPart, cmd);
91759
91759
  };
91760
- var which7 = async (cmd, opt = {}) => {
91760
+ var which8 = async (cmd, opt = {}) => {
91761
91761
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
91762
91762
  const found2 = [];
91763
91763
  for (const envPart of pathEnv) {
@@ -91805,8 +91805,8 @@ var require_lib15 = __commonJS({
91805
91805
  }
91806
91806
  throw getNotFoundError(cmd);
91807
91807
  };
91808
- module2.exports = which7;
91809
- which7.sync = whichSync;
91808
+ module2.exports = which8;
91809
+ which8.sync = whichSync;
91810
91810
  }
91811
91811
  });
91812
91812
 
@@ -99095,7 +99095,7 @@ var require_p_limit = __commonJS({
99095
99095
  "../myst-cli/node_modules/p-limit/index.js"(exports2, module2) {
99096
99096
  "use strict";
99097
99097
  var Queue = require_yocto_queue();
99098
- var pLimit3 = (concurrency) => {
99098
+ var pLimit4 = (concurrency) => {
99099
99099
  if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
99100
99100
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
99101
99101
  }
@@ -99144,7 +99144,7 @@ var require_p_limit = __commonJS({
99144
99144
  });
99145
99145
  return generator;
99146
99146
  };
99147
- module2.exports = pLimit3;
99147
+ module2.exports = pLimit4;
99148
99148
  }
99149
99149
  });
99150
99150
 
@@ -99351,7 +99351,7 @@ var require_lib16 = __commonJS({
99351
99351
  const prefix2 = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
99352
99352
  return prefix2 + join20(pathPart, cmd);
99353
99353
  };
99354
- var which7 = async (cmd, opt = {}) => {
99354
+ var which8 = async (cmd, opt = {}) => {
99355
99355
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
99356
99356
  const found2 = [];
99357
99357
  for (const envPart of pathEnv) {
@@ -99399,8 +99399,8 @@ var require_lib16 = __commonJS({
99399
99399
  }
99400
99400
  throw getNotFoundError(cmd);
99401
99401
  };
99402
- module2.exports = which7;
99403
- which7.sync = whichSync;
99402
+ module2.exports = which8;
99403
+ which8.sync = whichSync;
99404
99404
  }
99405
99405
  });
99406
99406
 
@@ -102293,7 +102293,7 @@ var require_parse5 = __commonJS({
102293
102293
  const stack = [ast];
102294
102294
  let block5 = ast;
102295
102295
  let prev = ast;
102296
- let brackets2 = 0;
102296
+ let brackets = 0;
102297
102297
  const length = input3.length;
102298
102298
  let index4 = 0;
102299
102299
  let depth = 0;
@@ -102329,12 +102329,12 @@ var require_parse5 = __commonJS({
102329
102329
  continue;
102330
102330
  }
102331
102331
  if (value === CHAR_LEFT_SQUARE_BRACKET2) {
102332
- brackets2++;
102332
+ brackets++;
102333
102333
  let next;
102334
102334
  while (index4 < length && (next = advance())) {
102335
102335
  value += next;
102336
102336
  if (next === CHAR_LEFT_SQUARE_BRACKET2) {
102337
- brackets2++;
102337
+ brackets++;
102338
102338
  continue;
102339
102339
  }
102340
102340
  if (next === CHAR_BACKSLASH) {
@@ -102342,8 +102342,8 @@ var require_parse5 = __commonJS({
102342
102342
  continue;
102343
102343
  }
102344
102344
  if (next === CHAR_RIGHT_SQUARE_BRACKET2) {
102345
- brackets2--;
102346
- if (brackets2 === 0) {
102345
+ brackets--;
102346
+ if (brackets === 0) {
102347
102347
  break;
102348
102348
  }
102349
102349
  }
@@ -132021,7 +132021,7 @@ var require_stringify4 = __commonJS({
132021
132021
  var formats = require_formats();
132022
132022
  var has3 = Object.prototype.hasOwnProperty;
132023
132023
  var arrayPrefixGenerators = {
132024
- brackets: function brackets2(prefix2) {
132024
+ brackets: function brackets(prefix2) {
132025
132025
  return prefix2 + "[]";
132026
132026
  },
132027
132027
  comma: "comma",
@@ -132421,9 +132421,9 @@ var require_parse6 = __commonJS({
132421
132421
  return;
132422
132422
  }
132423
132423
  var key2 = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
132424
- var brackets2 = /(\[[^[\]]*])/;
132424
+ var brackets = /(\[[^[\]]*])/;
132425
132425
  var child = /(\[[^[\]]*])/g;
132426
- var segment = options.depth > 0 && brackets2.exec(key2);
132426
+ var segment = options.depth > 0 && brackets.exec(key2);
132427
132427
  var parent2 = segment ? key2.slice(0, segment.index) : key2;
132428
132428
  var keys2 = [];
132429
132429
  if (parent2) {
@@ -193891,7 +193891,7 @@ var {
193891
193891
  } = import_index.default;
193892
193892
 
193893
193893
  // src/version.ts
193894
- var version = "1.3.20";
193894
+ var version = "1.3.22";
193895
193895
  var version_default = version;
193896
193896
 
193897
193897
  // ../myst-cli/dist/build/build.js
@@ -194751,7 +194751,7 @@ function validateAndStashObject(input3, stash, kind, validateFn, opts) {
194751
194751
  }
194752
194752
 
194753
194753
  // ../../node_modules/doi-utils/dist/validatePart.js
194754
- var DOI_VALIDATION_PATTERN = /^10.\d{4,9}\/[-._;()/:A-Z0-9]+$/i;
194754
+ var DOI_VALIDATION_PATTERN = /^10\.\d{4,9}\/[-._;()/:A-Z0-9]+$/i;
194755
194755
  function validatePart(possibleDOI) {
194756
194756
  if (!possibleDOI)
194757
194757
  return false;
@@ -195576,6 +195576,7 @@ var PROJECT_AND_PAGE_FRONTMATTER_KEYS = [
195576
195576
  "downloads",
195577
195577
  "settings",
195578
195578
  // We maybe want to move this into site frontmatter in the future
195579
+ "edit_url",
195579
195580
  ...KNOWN_EXTERNAL_IDENTIFIERS,
195580
195581
  // Do not add any project specific keys here!
195581
195582
  ...SITE_FRONTMATTER_KEYS
@@ -195599,8 +195600,9 @@ var PAGE_FRONTMATTER_KEYS = [
195599
195600
  "kernelspec",
195600
195601
  "jupytext",
195601
195602
  "tags",
195602
- "content_includes_title",
195603
- "site"
195603
+ "site",
195604
+ "enumerator",
195605
+ "content_includes_title"
195604
195606
  ];
195605
195607
 
195606
195608
  // ../myst-frontmatter/dist/exports/types.js
@@ -198710,7 +198712,7 @@ function simplifyLicenses(licenses2) {
198710
198712
  }
198711
198713
 
198712
198714
  // ../myst-frontmatter/dist/numbering/validators.js
198713
- var NUMBERING_OPTIONS = ["enumerator", "all", "headings"];
198715
+ var NUMBERING_OPTIONS = ["enumerator", "all", "headings", "title"];
198714
198716
  var HEADING_KEYS = ["heading_1", "heading_2", "heading_3", "heading_4", "heading_5", "heading_6"];
198715
198717
  var NUMBERING_KEYS = [
198716
198718
  "figure",
@@ -198721,7 +198723,8 @@ var NUMBERING_KEYS = [
198721
198723
  "code",
198722
198724
  ...HEADING_KEYS
198723
198725
  ];
198724
- var NUMBERING_ITEM_KEYS = ["enabled", "start", "template"];
198726
+ var NUMBERING_ITEM_KEYS = ["enabled", "start", "enumerator", "template", "continue"];
198727
+ var CONTINUE_STRINGS = ["continue", "next"];
198725
198728
  var NUMBERING_ALIAS = {
198726
198729
  sections: "headings",
198727
198730
  h1: "heading_1",
@@ -198735,7 +198738,13 @@ var NUMBERING_ALIAS = {
198735
198738
  heading3: "heading_3",
198736
198739
  heading4: "heading_4",
198737
198740
  heading5: "heading_5",
198738
- heading6: "heading_6"
198741
+ heading6: "heading_6",
198742
+ figures: "figure",
198743
+ subfigures: "subfigure",
198744
+ equations: "equation",
198745
+ subequations: "subequation",
198746
+ tables: "table",
198747
+ titles: "title"
198739
198748
  };
198740
198749
  function isBoolean(input3) {
198741
198750
  if (typeof input3 === "string") {
@@ -198744,11 +198753,13 @@ function isBoolean(input3) {
198744
198753
  return typeof input3 === "boolean";
198745
198754
  }
198746
198755
  function validateNumberingItem(input3, opts) {
198747
- var _a6, _b;
198756
+ var _a6, _b, _c, _d2, _e;
198748
198757
  if (isBoolean(input3)) {
198749
198758
  input3 = { enabled: input3 };
198750
198759
  } else if (typeof input3 === "number") {
198751
198760
  input3 = { start: input3 };
198761
+ } else if (CONTINUE_STRINGS.includes(input3)) {
198762
+ input3 = { continue: true };
198752
198763
  } else if (typeof input3 === "string") {
198753
198764
  input3 = { template: input3 };
198754
198765
  }
@@ -198762,20 +198773,78 @@ function validateNumberingItem(input3, opts) {
198762
198773
  output2.enabled = enabled;
198763
198774
  }
198764
198775
  if (defined(value.start)) {
198765
- const start = validateNumber(value.start, {
198766
- ...incrementOptions("start", opts),
198767
- integer: true,
198768
- min: 1
198769
- });
198770
- if (start) {
198771
- output2.start = start;
198776
+ if (CONTINUE_STRINGS.includes(value.start) && !defined(value.continue)) {
198777
+ output2.continue = true;
198772
198778
  output2.enabled = (_a6 = output2.enabled) !== null && _a6 !== void 0 ? _a6 : true;
198779
+ } else {
198780
+ const start = validateNumber(value.start, {
198781
+ ...incrementOptions("start", opts),
198782
+ integer: true,
198783
+ min: 1
198784
+ });
198785
+ if (start) {
198786
+ output2.start = start;
198787
+ output2.enabled = (_b = output2.enabled) !== null && _b !== void 0 ? _b : true;
198788
+ }
198773
198789
  }
198774
198790
  }
198775
198791
  if (defined(value.template)) {
198776
198792
  const template = validateString(value.template, incrementOptions("template", opts));
198777
198793
  if (defined(template)) {
198778
198794
  output2.template = template;
198795
+ output2.enabled = (_c = output2.enabled) !== null && _c !== void 0 ? _c : true;
198796
+ }
198797
+ }
198798
+ if (defined(value.enumerator)) {
198799
+ const enumerator = validateString(value.enumerator, incrementOptions("enumerator", opts));
198800
+ if (defined(enumerator)) {
198801
+ output2.enumerator = enumerator;
198802
+ output2.enabled = (_d2 = output2.enabled) !== null && _d2 !== void 0 ? _d2 : true;
198803
+ }
198804
+ }
198805
+ if (defined(value.continue)) {
198806
+ const cont = validateBoolean(value.continue, incrementOptions("continue", opts));
198807
+ if (defined(cont)) {
198808
+ output2.continue = cont;
198809
+ output2.enabled = (_e = output2.enabled) !== null && _e !== void 0 ? _e : true;
198810
+ }
198811
+ }
198812
+ if (Object.keys(output2).length === 0)
198813
+ return void 0;
198814
+ return output2;
198815
+ }
198816
+ function validateTitleItem(input3, opts) {
198817
+ var _a6, _b;
198818
+ if (isBoolean(input3)) {
198819
+ input3 = { enabled: input3 };
198820
+ } else if (typeof input3 === "number") {
198821
+ input3 = { offset: input3 };
198822
+ }
198823
+ const value = validateObjectKeys(input3, { optional: ["enabled", "offset", "enumerator"] }, opts);
198824
+ if (value === void 0)
198825
+ return void 0;
198826
+ const output2 = {};
198827
+ if (defined(value.enabled)) {
198828
+ const enabled = validateBoolean(value.enabled, incrementOptions("enabled", opts));
198829
+ if (defined(enabled))
198830
+ output2.enabled = enabled;
198831
+ }
198832
+ if (defined(value.offset)) {
198833
+ const offset = validateNumber(value.offset, {
198834
+ integer: true,
198835
+ min: 0,
198836
+ max: 5,
198837
+ ...incrementOptions("offset", opts)
198838
+ });
198839
+ if (defined(offset)) {
198840
+ output2.offset = offset;
198841
+ output2.enabled = (_a6 = output2.enabled) !== null && _a6 !== void 0 ? _a6 : true;
198842
+ }
198843
+ }
198844
+ if (defined(value.enumerator)) {
198845
+ const enumerator = validateString(value.enumerator, incrementOptions("enumerator", opts));
198846
+ if (defined(enumerator)) {
198847
+ output2.enumerator = enumerator;
198779
198848
  output2.enabled = (_b = output2.enabled) !== null && _b !== void 0 ? _b : true;
198780
198849
  }
198781
198850
  }
@@ -198784,7 +198853,7 @@ function validateNumberingItem(input3, opts) {
198784
198853
  return output2;
198785
198854
  }
198786
198855
  function validateNumbering(input3, opts) {
198787
- var _a6, _b, _c, _d2;
198856
+ var _a6, _b, _c, _d2, _e;
198788
198857
  if (isBoolean(input3)) {
198789
198858
  input3 = { all: input3 };
198790
198859
  }
@@ -198795,6 +198864,9 @@ function validateNumbering(input3, opts) {
198795
198864
  let headings;
198796
198865
  if (defined(value.enumerator)) {
198797
198866
  const enumeratorOpts = incrementOptions("enumerator", opts);
198867
+ if (typeof value.enumerator === "string") {
198868
+ value.enumerator = { enumerator: value.enumerator };
198869
+ }
198798
198870
  output2.enumerator = validateNumberingItem(value.enumerator, enumeratorOpts);
198799
198871
  if (((_a6 = output2.enumerator) === null || _a6 === void 0 ? void 0 : _a6.enabled) != null) {
198800
198872
  if (output2.enumerator.enabled !== true) {
@@ -198806,18 +198878,31 @@ function validateNumbering(input3, opts) {
198806
198878
  validationWarning("value for 'start' is ignored", enumeratorOpts);
198807
198879
  delete output2.enumerator.start;
198808
198880
  }
198881
+ if (((_c = output2.enumerator) === null || _c === void 0 ? void 0 : _c.continue) != null) {
198882
+ validationWarning("value for 'continue' is ignored", enumeratorOpts);
198883
+ delete output2.enumerator.continue;
198884
+ }
198885
+ if (!output2.enumerator || Object.keys(output2.enumerator).length === 0) {
198886
+ delete output2.enumerator;
198887
+ }
198809
198888
  }
198810
198889
  if (defined(value.all)) {
198811
198890
  const allOpts = incrementOptions("all", opts);
198812
198891
  output2.all = validateNumberingItem(value.all, allOpts);
198813
- if (((_c = output2.all) === null || _c === void 0 ? void 0 : _c.template) != null) {
198892
+ if (((_d2 = output2.all) === null || _d2 === void 0 ? void 0 : _d2.template) != null) {
198814
198893
  validationWarning("value for 'template' is ignored", allOpts);
198815
198894
  delete output2.all.template;
198816
198895
  }
198817
- if (((_d2 = output2.all) === null || _d2 === void 0 ? void 0 : _d2.start) != null) {
198896
+ if (((_e = output2.all) === null || _e === void 0 ? void 0 : _e.start) != null) {
198818
198897
  validationWarning("value for 'start' is ignored", allOpts);
198819
198898
  delete output2.all.start;
198820
198899
  }
198900
+ if (!output2.all || Object.keys(output2.all).length === 0) {
198901
+ delete output2.all;
198902
+ }
198903
+ }
198904
+ if (defined(value.title)) {
198905
+ output2.title = validateTitleItem(value.title, incrementOptions("title", opts));
198821
198906
  }
198822
198907
  if (defined(value.headings)) {
198823
198908
  headings = validateNumberingItem(value.headings, incrementOptions("headings", opts));
@@ -198846,11 +198931,15 @@ function validateNumbering(input3, opts) {
198846
198931
  function fillNumbering(base5, filler) {
198847
198932
  const output2 = { ...filler, ...base5 };
198848
198933
  Object.entries(filler !== null && filler !== void 0 ? filler : {}).filter(([key2]) => !NUMBERING_OPTIONS.includes(key2)).forEach(([key2, val]) => {
198849
- var _a6, _b, _c;
198934
+ var _a6, _b, _c, _d2, _e;
198850
198935
  output2[key2] = fillMissingKeys(
198851
198936
  (_a6 = base5 === null || base5 === void 0 ? void 0 : base5[key2]) !== null && _a6 !== void 0 ? _a6 : {},
198852
198937
  // Enabling/disabling all in base overrides filler
198853
- { ...val, enabled: (_c = (_b = base5 === null || base5 === void 0 ? void 0 : base5.all) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : val.enabled },
198938
+ {
198939
+ ...val,
198940
+ enabled: (_c = (_b = base5 === null || base5 === void 0 ? void 0 : base5.all) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : val.enabled,
198941
+ continue: (_e = (_d2 = base5 === null || base5 === void 0 ? void 0 : base5.all) === null || _d2 === void 0 ? void 0 : _d2.continue) !== null && _e !== void 0 ? _e : val.continue
198942
+ },
198854
198943
  NUMBERING_ITEM_KEYS
198855
198944
  );
198856
198945
  });
@@ -199521,6 +199610,11 @@ function validateProjectAndPageFrontmatterKeys(value, opts) {
199521
199610
  if (settings)
199522
199611
  output2.settings = settings;
199523
199612
  }
199613
+ if (value.edit_url === null) {
199614
+ output2.edit_url = null;
199615
+ } else if (defined(value.edit_url)) {
199616
+ output2.edit_url = validateUrl(value.edit_url, incrementOptions("edit_url", opts));
199617
+ }
199524
199618
  return output2;
199525
199619
  }
199526
199620
  function validateProjectFrontmatterKeys(value, opts) {
@@ -199597,6 +199691,9 @@ function validatePageFrontmatterKeys(value, opts) {
199597
199691
  if (defined(value.jupytext)) {
199598
199692
  output2.jupytext = validateJupytext(value.jupytext, incrementOptions("jupytext", opts));
199599
199693
  }
199694
+ if (defined(value.enumerator)) {
199695
+ output2.enumerator = validateString(value.enumerator, incrementOptions("enumerator", opts));
199696
+ }
199600
199697
  if (defined(value.content_includes_title)) {
199601
199698
  output2.content_includes_title = validateBoolean(value.content_includes_title, incrementOptions("content_includes_title", opts));
199602
199699
  }
@@ -204555,7 +204652,14 @@ var visit = (
204555
204652
 
204556
204653
  // ../myst-common/dist/selectNodes.js
204557
204654
  function isTargetIdentifierNode(node3) {
204558
- const nonTargetTypes = ["crossReference", "cite", "footnoteDefinition", "footnoteReference"];
204655
+ const nonTargetTypes = [
204656
+ "crossReference",
204657
+ "cite",
204658
+ "footnoteDefinition",
204659
+ "footnoteReference",
204660
+ "captionNumber",
204661
+ "link"
204662
+ ];
204559
204663
  return !nonTargetTypes.includes(node3.type);
204560
204664
  }
204561
204665
  var hiddenNodes = /* @__PURE__ */ new Set(["comment", "mystComment"]);
@@ -238821,12 +238925,12 @@ var DEFAULT_NUMBERING = {
238821
238925
  subfigure: { enabled: true, template: "Figure\xA0%s" },
238822
238926
  table: { enabled: true, template: "Table\xA0%s" },
238823
238927
  code: { enabled: true, template: "Program\xA0%s" },
238824
- heading_1: { enabled: false, template: "Section\xA0%s" },
238825
- heading_2: { enabled: false, template: "Section\xA0%s" },
238826
- heading_3: { enabled: false, template: "Section\xA0%s" },
238827
- heading_4: { enabled: false, template: "Section\xA0%s" },
238828
- heading_5: { enabled: false, template: "Section\xA0%s" },
238829
- heading_6: { enabled: false, template: "Section\xA0%s" }
238928
+ heading_1: { template: "Section\xA0%s" },
238929
+ heading_2: { template: "Section\xA0%s" },
238930
+ heading_3: { template: "Section\xA0%s" },
238931
+ heading_4: { template: "Section\xA0%s" },
238932
+ heading_5: { template: "Section\xA0%s" },
238933
+ heading_6: { template: "Section\xA0%s" }
238830
238934
  };
238831
238935
  function getDefaultNumberedReferenceTemplate(kind) {
238832
238936
  if (kind === "code")
@@ -238847,17 +238951,17 @@ function getDefaultNamedReferenceTemplate(kind = "unknown", hasTitle) {
238847
238951
  return name3;
238848
238952
  }
238849
238953
  }
238850
- function getReferenceTemplate(target, numbering, numbered2, hasTitle) {
238851
- var _a6, _b, _c;
238954
+ function getReferenceTemplate(target, numbering, numbered2, hasTitle, offset) {
238955
+ var _a6, _b, _c, _d2;
238852
238956
  const { kind, node: node3 } = target;
238853
238957
  let template;
238854
238958
  if (numbered2) {
238855
238959
  if (kind === TargetKind.heading && node3.type === "heading") {
238856
- template = (_a6 = numbering[`heading_${node3.depth}`]) === null || _a6 === void 0 ? void 0 : _a6.template;
238960
+ template = (_b = numbering[`heading_${node3.depth - (((_a6 = numbering === null || numbering === void 0 ? void 0 : numbering.title) === null || _a6 === void 0 ? void 0 : _a6.enabled) ? 0 : 1) + (offset !== null && offset !== void 0 ? offset : 0)}`]) === null || _b === void 0 ? void 0 : _b.template;
238857
238961
  } else if (node3.subcontainer) {
238858
- template = (_b = numbering.subfigure) === null || _b === void 0 ? void 0 : _b.template;
238962
+ template = (_c = numbering.subfigure) === null || _c === void 0 ? void 0 : _c.template;
238859
238963
  } else {
238860
- template = (_c = numbering[kind]) === null || _c === void 0 ? void 0 : _c.template;
238964
+ template = (_d2 = numbering[kind]) === null || _d2 === void 0 ? void 0 : _d2.template;
238861
238965
  }
238862
238966
  return template !== null && template !== void 0 ? template : getDefaultNumberedReferenceTemplate(kind);
238863
238967
  }
@@ -238926,17 +239030,17 @@ function kindFromNode2(node3) {
238926
239030
  return `${node3.type}:${node3.kind}`;
238927
239031
  return node3.type;
238928
239032
  }
238929
- function shouldEnumerate(node3, kind, numbering) {
238930
- var _a6, _b, _c, _d2, _e, _f, _g, _h;
239033
+ function shouldEnumerateNode(node3, kind, numbering, offset) {
239034
+ var _a6, _b, _c, _d2, _e, _f, _g, _h, _j;
238931
239035
  if (node3.enumerated != null)
238932
239036
  return node3.enumerated;
238933
239037
  const enabledDefault = (_b = (_a6 = numbering.all) === null || _a6 === void 0 ? void 0 : _a6.enabled) !== null && _b !== void 0 ? _b : false;
238934
239038
  if (kind === "heading" && node3.type === "heading") {
238935
- return (_d2 = (_c = numbering[`heading_${node3.depth}`]) === null || _c === void 0 ? void 0 : _c.enabled) !== null && _d2 !== void 0 ? _d2 : enabledDefault;
239039
+ return (_e = (_d2 = numbering[`heading_${node3.depth - (((_c = numbering === null || numbering === void 0 ? void 0 : numbering.title) === null || _c === void 0 ? void 0 : _c.enabled) ? 0 : 1) + (offset !== null && offset !== void 0 ? offset : 0)}`]) === null || _d2 === void 0 ? void 0 : _d2.enabled) !== null && _e !== void 0 ? _e : enabledDefault;
238936
239040
  }
238937
239041
  if (node3.subcontainer)
238938
- return (_f = (_e = numbering.subfigure) === null || _e === void 0 ? void 0 : _e.enabled) !== null && _f !== void 0 ? _f : enabledDefault;
238939
- return (_h = (_g = numbering[kind]) === null || _g === void 0 ? void 0 : _g.enabled) !== null && _h !== void 0 ? _h : enabledDefault;
239042
+ return (_g = (_f = numbering.subfigure) === null || _f === void 0 ? void 0 : _f.enabled) !== null && _g !== void 0 ? _g : enabledDefault;
239043
+ return (_j = (_h = numbering[kind]) === null || _h === void 0 ? void 0 : _h.enabled) !== null && _j !== void 0 ? _j : enabledDefault;
238940
239044
  }
238941
239045
  function incrementHeadingCounts2(depth, counts) {
238942
239046
  const incrementIndex = depth - 1;
@@ -238957,19 +239061,28 @@ function formatHeadingEnumerator2(counts, prefix2) {
238957
239061
  const out = prefix2 ? prefix2.replace(/%s/g, String(enumerator)) : String(enumerator);
238958
239062
  return out;
238959
239063
  }
238960
- function initializeTargetCounts(numbering, initialCounts, tree) {
238961
- let heading6;
238962
- if (initialCounts === null || initialCounts === void 0 ? void 0 : initialCounts.heading) {
238963
- heading6 = [...initialCounts.heading];
238964
- } else if (tree) {
238965
- const headingNodes = selectAll("heading", tree).filter((node3) => node3.enumerated !== false);
238966
- const headingDepths = new Set(headingNodes.map((node3) => node3.depth));
238967
- heading6 = [1, 2, 3, 4, 5, 6].map((depth) => headingDepths.has(depth) ? 0 : null);
238968
- } else {
238969
- heading6 = [0, 0, 0, 0, 0, 0];
238970
- }
239064
+ function initializeTargetCounts(numbering, previousCounts, offset) {
239065
+ const heading6 = [1, 2, 3, 4, 5, 6].map((depth, ind) => {
239066
+ var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l;
239067
+ const cont = (_d2 = (_b = (_a6 = numbering[`heading_${depth}`]) === null || _a6 === void 0 ? void 0 : _a6.continue) !== null && _b !== void 0 ? _b : (_c = numbering.all) === null || _c === void 0 ? void 0 : _c.continue) !== null && _d2 !== void 0 ? _d2 : false;
239068
+ const enabled = (_h = (_f = (_e = numbering[`heading_${depth}`]) === null || _e === void 0 ? void 0 : _e.enabled) !== null && _f !== void 0 ? _f : (_g = numbering.all) === null || _g === void 0 ? void 0 : _g.enabled) !== null && _h !== void 0 ? _h : true;
239069
+ const prevCount = (_j = previousCounts === null || previousCounts === void 0 ? void 0 : previousCounts.heading) === null || _j === void 0 ? void 0 : _j[ind];
239070
+ if (cont && enabled && prevCount !== void 0) {
239071
+ return prevCount;
239072
+ }
239073
+ if (((_k = numbering.title) === null || _k === void 0 ? void 0 : _k.enabled) && depth - 1 <= (offset !== null && offset !== void 0 ? offset : 0) && prevCount != null) {
239074
+ return prevCount;
239075
+ }
239076
+ if (!((_l = numbering.title) === null || _l === void 0 ? void 0 : _l.enabled) && depth <= (offset !== null && offset !== void 0 ? offset : 0)) {
239077
+ return null;
239078
+ }
239079
+ return 0;
239080
+ });
238971
239081
  const targetCounts = { heading: heading6 };
238972
- Object.entries(initialCounts !== null && initialCounts !== void 0 ? initialCounts : {}).filter(([key2]) => key2 !== "heading").forEach(([key2, val]) => {
239082
+ Object.entries(previousCounts !== null && previousCounts !== void 0 ? previousCounts : {}).filter(([key2]) => key2 !== "heading").filter(([key2]) => {
239083
+ var _a6, _b;
239084
+ return !numbering[key2] || ((_a6 = numbering[key2]) === null || _a6 === void 0 ? void 0 : _a6.continue) || ((_b = numbering.all) === null || _b === void 0 ? void 0 : _b.continue);
239085
+ }).forEach(([key2, val]) => {
238973
239086
  targetCounts[key2] = { ...val };
238974
239087
  });
238975
239088
  Object.entries(numbering).forEach(([key2, val]) => {
@@ -238988,24 +239101,28 @@ function initializeTargetCounts(numbering, initialCounts, tree) {
238988
239101
  }
238989
239102
  var ReferenceState = class {
238990
239103
  constructor(filePath, opts) {
238991
- var _a6, _b;
238992
- this.numbering = fillNumbering(opts === null || opts === void 0 ? void 0 : opts.numbering, DEFAULT_NUMBERING);
238993
- this.initialCounts = opts === null || opts === void 0 ? void 0 : opts.targetCounts;
238994
- this.targetCounts = initializeTargetCounts(this.numbering, this.initialCounts);
238995
- this.identifiers = (_a6 = opts === null || opts === void 0 ? void 0 : opts.identifiers) !== null && _a6 !== void 0 ? _a6 : [];
239104
+ var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
239105
+ this.numbering = fillNumbering((_a6 = opts === null || opts === void 0 ? void 0 : opts.frontmatter) === null || _a6 === void 0 ? void 0 : _a6.numbering, DEFAULT_NUMBERING);
239106
+ this.offset = (_d2 = (_c = (_b = this.numbering) === null || _b === void 0 ? void 0 : _b.title) === null || _c === void 0 ? void 0 : _c.offset) !== null && _d2 !== void 0 ? _d2 : 0;
239107
+ this.targetCounts = initializeTargetCounts(this.numbering, opts === null || opts === void 0 ? void 0 : opts.previousCounts, this.offset);
239108
+ if ((((_e = this.numbering.title) === null || _e === void 0 ? void 0 : _e.enabled) || ((_f = this.numbering.all) === null || _f === void 0 ? void 0 : _f.enabled)) && !((_g = opts === null || opts === void 0 ? void 0 : opts.frontmatter) === null || _g === void 0 ? void 0 : _g.content_includes_title) && ((_h = this.numbering[`heading_${this.offset + 1}`]) === null || _h === void 0 ? void 0 : _h.enabled) !== false) {
239109
+ this.targetCounts.heading = incrementHeadingCounts2(this.offset + 1, this.targetCounts.heading);
239110
+ this.enumerator = formatHeadingEnumerator2(this.targetCounts.heading, (_k = (_j = this.numbering.title) === null || _j === void 0 ? void 0 : _j.enumerator) !== null && _k !== void 0 ? _k : (_l = this.numbering.enumerator) === null || _l === void 0 ? void 0 : _l.enumerator);
239111
+ }
239112
+ this.identifiers = (_m = opts === null || opts === void 0 ? void 0 : opts.identifiers) !== null && _m !== void 0 ? _m : [];
238996
239113
  this.targets = {};
238997
- this.vfile = (_b = opts === null || opts === void 0 ? void 0 : opts.vfile) !== null && _b !== void 0 ? _b : new VFile();
239114
+ this.vfile = (_o = opts === null || opts === void 0 ? void 0 : opts.vfile) !== null && _o !== void 0 ? _o : new VFile();
238998
239115
  this.filePath = filePath;
238999
239116
  this.url = opts === null || opts === void 0 ? void 0 : opts.url;
239000
239117
  this.dataUrl = opts === null || opts === void 0 ? void 0 : opts.dataUrl;
239001
- this.title = opts === null || opts === void 0 ? void 0 : opts.title;
239118
+ this.title = (_p = opts === null || opts === void 0 ? void 0 : opts.frontmatter) === null || _p === void 0 ? void 0 : _p.title;
239002
239119
  }
239003
239120
  addTarget(node3) {
239004
239121
  if (!isTargetIdentifierNode(node3))
239005
239122
  return;
239006
239123
  const kind = kindFromNode2(node3);
239007
- const numberNode = shouldEnumerate(node3, kind, this.numbering);
239008
- if (numberNode && !node3.enumerator) {
239124
+ const numberNode = shouldEnumerateNode(node3, kind, this.numbering, this.offset);
239125
+ if (numberNode) {
239009
239126
  this.incrementCount(node3, kind);
239010
239127
  }
239011
239128
  if (!node3.html_id) {
@@ -239030,8 +239147,10 @@ var ReferenceState = class {
239030
239147
  kind
239031
239148
  };
239032
239149
  }
239033
- initializeNumberedTargetCounts(tree) {
239034
- this.targetCounts = initializeTargetCounts(this.numbering, this.initialCounts, tree);
239150
+ resolveEnumerator(val, enumerator) {
239151
+ var _a6;
239152
+ const prefix2 = enumerator !== null && enumerator !== void 0 ? enumerator : (_a6 = this.numbering.enumerator) === null || _a6 === void 0 ? void 0 : _a6.enumerator;
239153
+ return prefix2 ? prefix2.replace(/%s/g, String(val)) : String(val);
239035
239154
  }
239036
239155
  /**
239037
239156
  * Increment target count state for container/equation nodes
@@ -239041,38 +239160,33 @@ var ReferenceState = class {
239041
239160
  * If node is subcontainer/subequation, a sub-count is incremented
239042
239161
  */
239043
239162
  incrementCount(node3, kind) {
239044
- var _a6, _b;
239045
- var _c;
239163
+ var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l;
239164
+ var _m;
239046
239165
  if (node3.enumerator) {
239047
239166
  return node3.enumerator;
239048
239167
  }
239049
239168
  let enumerator;
239050
239169
  if (kind === TargetKind.heading && node3.type === "heading") {
239051
- this.targetCounts.heading = incrementHeadingCounts2(node3.depth, this.targetCounts.heading);
239052
- enumerator = formatHeadingEnumerator2(this.targetCounts.heading, (_a6 = this.numbering.enumerator) === null || _a6 === void 0 ? void 0 : _a6.template);
239170
+ this.targetCounts.heading = incrementHeadingCounts2(node3.depth - (((_b = (_a6 = this.numbering) === null || _a6 === void 0 ? void 0 : _a6.title) === null || _b === void 0 ? void 0 : _b.enabled) ? 0 : 1) + this.offset, this.targetCounts.heading);
239171
+ enumerator = formatHeadingEnumerator2(this.targetCounts.heading, (_f = (_e = this.numbering[`heading_${node3.depth - (((_d2 = (_c = this.numbering) === null || _c === void 0 ? void 0 : _c.title) === null || _d2 === void 0 ? void 0 : _d2.enabled) ? 0 : 1) + this.offset}`]) === null || _e === void 0 ? void 0 : _e.enumerator) !== null && _f !== void 0 ? _f : (_g = this.numbering.enumerator) === null || _g === void 0 ? void 0 : _g.enumerator);
239053
239172
  node3.enumerator = enumerator;
239054
239173
  return enumerator;
239055
239174
  }
239056
- const resolveEnumerator = (val) => {
239057
- var _a7;
239058
- const prefix2 = (_a7 = this.numbering.enumerator) === null || _a7 === void 0 ? void 0 : _a7.template;
239059
- return prefix2 ? prefix2.replace(/%s/g, String(val)) : String(val);
239060
- };
239061
239175
  const countKind = kind === TargetKind.subequation ? TargetKind.equation : kind;
239062
- (_b = (_c = this.targetCounts)[countKind]) !== null && _b !== void 0 ? _b : _c[countKind] = { main: 0, sub: 0 };
239176
+ (_h = (_m = this.targetCounts)[countKind]) !== null && _h !== void 0 ? _h : _m[countKind] = { main: 0, sub: 0 };
239063
239177
  if (node3.subcontainer || kind === TargetKind.subequation) {
239064
239178
  this.targetCounts[countKind].sub += 1;
239065
239179
  const letter = String.fromCharCode((this.targetCounts[countKind].sub - 1) % 26 + "a".charCodeAt(0));
239066
239180
  if (node3.subcontainer) {
239067
- node3.parentEnumerator = resolveEnumerator(this.targetCounts[countKind].main);
239181
+ node3.parentEnumerator = this.resolveEnumerator(this.targetCounts[countKind].main, (_j = this.numbering[countKind]) === null || _j === void 0 ? void 0 : _j.enumerator);
239068
239182
  enumerator = letter;
239069
239183
  } else {
239070
- enumerator = resolveEnumerator(this.targetCounts[countKind].main + letter);
239184
+ enumerator = this.resolveEnumerator(this.targetCounts[countKind].main + letter, (_k = this.numbering[countKind]) === null || _k === void 0 ? void 0 : _k.enumerator);
239071
239185
  }
239072
239186
  } else {
239073
239187
  this.targetCounts[kind].main += 1;
239074
239188
  this.targetCounts[kind].sub = 0;
239075
- enumerator = resolveEnumerator(this.targetCounts[kind].main);
239189
+ enumerator = this.resolveEnumerator(this.targetCounts[kind].main, (_l = this.numbering[kind]) === null || _l === void 0 ? void 0 : _l.enumerator);
239076
239190
  }
239077
239191
  node3.enumerator = enumerator;
239078
239192
  return enumerator;
@@ -239121,17 +239235,17 @@ var ReferenceState = class {
239121
239235
  return;
239122
239236
  }
239123
239237
  node3.kind = target.kind;
239124
- addChildrenFromTargetNode(node3, target.node, this.numbering, this.vfile);
239238
+ addChildrenFromTargetNode(node3, target.node, this.numbering, this.vfile, this.offset);
239125
239239
  }
239126
239240
  };
239127
- function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
239241
+ function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2, offset) {
239128
239242
  var _a6, _b, _c, _d2, _e;
239129
239243
  numbering = fillNumbering(numbering, DEFAULT_NUMBERING);
239130
239244
  const kind = kindFromNode2(targetNode);
239131
239245
  const noNodeChildren = !((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length);
239132
239246
  if (kind === TargetKind.heading) {
239133
- const numberHeading = shouldEnumerate(targetNode, TargetKind.heading, numbering);
239134
- const template = getReferenceTemplate({ node: targetNode, kind }, numbering, numberHeading, true);
239247
+ const numberHeading = shouldEnumerateNode(targetNode, TargetKind.heading, numbering);
239248
+ const template = getReferenceTemplate({ node: targetNode, kind }, numbering, numberHeading, true, offset);
239135
239249
  fillReferenceEnumerators2(vfile2, node3, template, targetNode, copyNode(targetNode).children);
239136
239250
  } else {
239137
239251
  const caption3 = select("caption", targetNode) || select("admonitionTitle", targetNode) || select("definitionTerm", targetNode);
@@ -239140,7 +239254,7 @@ function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
239140
239254
  if (title && node3.kind === ReferenceKind2.ref && noNodeChildren) {
239141
239255
  node3.children = title;
239142
239256
  }
239143
- const template = getReferenceTemplate({ node: targetNode, kind }, numbering, !!targetNode.enumerator, !!title);
239257
+ const template = getReferenceTemplate({ node: targetNode, kind }, numbering, !!targetNode.enumerator, !!title, offset);
239144
239258
  fillReferenceEnumerators2(vfile2, node3, template, targetNode, title);
239145
239259
  }
239146
239260
  node3.resolved = true;
@@ -239202,8 +239316,9 @@ var MultiPageReferenceResolver = class {
239202
239316
  }
239203
239317
  };
239204
239318
  var enumerateTargetsTransform = (tree, opts) => {
239205
- opts.state.initializeNumberedTargetCounts(tree);
239206
239319
  visit(tree, (node3) => {
239320
+ if (!isTargetIdentifierNode(node3))
239321
+ return;
239207
239322
  if (node3.identifier || node3.enumerated || ["container", "mathGroup", "math", "heading", "proof"].includes(node3.type)) {
239208
239323
  opts.state.addTarget(node3);
239209
239324
  }
@@ -239223,9 +239338,6 @@ var enumerateTargetsTransform = (tree, opts) => {
239223
239338
  });
239224
239339
  return tree;
239225
239340
  };
239226
- var enumerateTargetsPlugin = (opts) => (tree) => {
239227
- enumerateTargetsTransform(tree, opts);
239228
- };
239229
239341
  function getCaptionLabel(kind, subcontainer) {
239230
239342
  if (subcontainer && (kind === "equation" || kind === "subequation"))
239231
239343
  return `(%s)`;
@@ -239248,7 +239360,10 @@ function addContainerCaptionNumbersTransform(tree, file, opts) {
239248
239360
  para = { type: "paragraph", children: [] };
239249
239361
  container4.children.push({ type: "caption", children: [para] });
239250
239362
  }
239251
- if (para && ((_b = para.children[0]) === null || _b === void 0 ? void 0 : _b.type) !== "captionNumber") {
239363
+ if (para && ((_b = para.children[0]) === null || _b === void 0 ? void 0 : _b.type) === "captionNumber") {
239364
+ para.children = para.children.slice(1);
239365
+ }
239366
+ if (para) {
239252
239367
  const captionNumber3 = {
239253
239368
  type: "captionNumber",
239254
239369
  kind: container4.kind,
@@ -242019,8 +242134,6 @@ function castSession(session) {
242019
242134
  cache.$citationRenderers = {};
242020
242135
  if (!cache.$doiRenderers)
242021
242136
  cache.$doiRenderers = {};
242022
- if (!cache.$internalReferences)
242023
- cache.$internalReferences = {};
242024
242137
  if (!cache.$externalReferences)
242025
242138
  cache.$externalReferences = {};
242026
242139
  if (!cache.$mdast)
@@ -289406,7 +289519,7 @@ var import_node_path16 = __toESM(require("path"), 1);
289406
289519
  var import_nbtx = __toESM(require_cjs2(), 1);
289407
289520
 
289408
289521
  // ../myst-cli/dist/version.js
289409
- var version2 = "1.3.20";
289522
+ var version2 = "1.3.22";
289410
289523
  var version_default2 = version2;
289411
289524
 
289412
289525
  // ../myst-cli/dist/utils/headers.js
@@ -289725,6 +289838,26 @@ function isWhiteLabelled() {
289725
289838
  return ["MYSTMD_READABLE_NAME", "MYSTMD_BINARY_NAME"].some((name3) => name3 in process.env);
289726
289839
  }
289727
289840
 
289841
+ // ../myst-cli/dist/utils/fetchWithRetry.js
289842
+ async function fetchWithRetry(session, url, options, maxRetries = 3, attempt = 1, backoff = 250) {
289843
+ try {
289844
+ const resp = await session.fetch(url, options);
289845
+ if (resp.ok) {
289846
+ return resp;
289847
+ } else {
289848
+ session.log.warn(`Fetch of ${url} failed with HTTP status ${resp.status} for URL: ${url} (Attempt #${attempt})`);
289849
+ }
289850
+ } catch (error) {
289851
+ session.log.warn(`Fetch of ${url} threw an error (Attempt #${attempt})`, error);
289852
+ }
289853
+ if (attempt < maxRetries) {
289854
+ session.log.debug(`Waiting ${backoff}ms before retry #${attempt + 1}...`);
289855
+ await new Promise((resolve9) => setTimeout(resolve9, backoff));
289856
+ return fetchWithRetry(session, url, options, maxRetries, attempt + 1, backoff * 2);
289857
+ }
289858
+ throw new Error(`Failed to fetch ${url} after ${maxRetries} attempts.`);
289859
+ }
289860
+
289728
289861
  // ../myst-cli/dist/utils/ffmpeg.js
289729
289862
  var ffmpeg_exports = {};
289730
289863
  __export(ffmpeg_exports, {
@@ -290574,6 +290707,9 @@ function findExpression(expressions, value) {
290574
290707
  function processLatex(value) {
290575
290708
  return value.trim().replace(/^\$(\\displaystyle)?/, "").replace(/\$$/, "").trim();
290576
290709
  }
290710
+ function processPlainText(content3) {
290711
+ return content3.replace(/^(["'])(.*)\1$/, "$2");
290712
+ }
290577
290713
  function renderExpression(node3, file) {
290578
290714
  const result = node3.result;
290579
290715
  if (!result)
@@ -290595,7 +290731,7 @@ function renderExpression(node3, file) {
290595
290731
  } else if (mimeType === "text/html") {
290596
290732
  content3 = [{ type: "html", value }];
290597
290733
  } else if (mimeType === "text/plain") {
290598
- content3 = [{ type: "text", value }];
290734
+ content3 = [{ type: "text", value: processPlainText(value) }];
290599
290735
  }
290600
290736
  });
290601
290737
  if (content3)
@@ -292513,10 +292649,10 @@ var Minimatch = class {
292513
292649
  let ai = 0;
292514
292650
  let bi = 0;
292515
292651
  let result = [];
292516
- let which7 = "";
292652
+ let which8 = "";
292517
292653
  while (ai < a2.length && bi < b.length) {
292518
292654
  if (a2[ai] === b[bi]) {
292519
- result.push(which7 === "b" ? b[bi] : a2[ai]);
292655
+ result.push(which8 === "b" ? b[bi] : a2[ai]);
292520
292656
  ai++;
292521
292657
  bi++;
292522
292658
  } else if (emptyGSMatch && a2[ai] === "**" && b[bi] === a2[ai + 1]) {
@@ -292526,16 +292662,16 @@ var Minimatch = class {
292526
292662
  result.push(b[bi]);
292527
292663
  bi++;
292528
292664
  } else if (a2[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
292529
- if (which7 === "b")
292665
+ if (which8 === "b")
292530
292666
  return false;
292531
- which7 = "a";
292667
+ which8 = "a";
292532
292668
  result.push(a2[ai]);
292533
292669
  ai++;
292534
292670
  bi++;
292535
292671
  } else if (b[bi] === "*" && a2[ai] && (this.options.dot || !a2[ai].startsWith(".")) && a2[ai] !== "**") {
292536
- if (which7 === "a")
292672
+ if (which8 === "a")
292537
292673
  return false;
292538
- which7 = "b";
292674
+ which8 = "b";
292539
292675
  result.push(b[bi]);
292540
292676
  ai++;
292541
292677
  bi++;
@@ -301308,6 +301444,7 @@ async function resolvePageDownloads(session, file, projectPath) {
301308
301444
  return resolvedDownloads;
301309
301445
  }
301310
301446
  async function localToManifestProject(session, projectPath, projectSlug) {
301447
+ var _a6, _b;
301311
301448
  if (!projectPath)
301312
301449
  return null;
301313
301450
  const state = session.store.getState();
@@ -301315,23 +301452,25 @@ async function localToManifestProject(session, projectPath, projectSlug) {
301315
301452
  const proj = selectors_exports.selectLocalProject(state, projectPath);
301316
301453
  if (!proj)
301317
301454
  return null;
301318
- const { index: index4 } = proj;
301455
+ const { index: index4, file: indexFile } = proj;
301319
301456
  const projectFileInfo = selectors_exports.selectFileInfo(state, proj.file);
301320
301457
  const projectTitle = (projConfig === null || projConfig === void 0 ? void 0 : projConfig.title) || projectFileInfo.title || proj.index;
301458
+ const cache = castSession(session);
301321
301459
  const pages = await Promise.all(proj.pages.map(async (page) => {
301322
- var _a6, _b, _c, _d2, _e, _f, _g, _h;
301460
+ var _a7, _b2, _c, _d2, _e, _f, _g, _h, _j, _k;
301323
301461
  if ("file" in page) {
301324
301462
  const fileInfo3 = selectors_exports.selectFileInfo(state, page.file);
301325
301463
  const title = fileInfo3.title || fileTitle(page.file);
301326
- const short_title = (_a6 = fileInfo3.short_title) !== null && _a6 !== void 0 ? _a6 : void 0;
301327
- const description = (_b = fileInfo3.description) !== null && _b !== void 0 ? _b : "";
301464
+ const short_title = (_a7 = fileInfo3.short_title) !== null && _a7 !== void 0 ? _a7 : void 0;
301465
+ const description = (_b2 = fileInfo3.description) !== null && _b2 !== void 0 ? _b2 : "";
301328
301466
  const thumbnail2 = (_c = fileInfo3.thumbnail) !== null && _c !== void 0 ? _c : "";
301329
301467
  const thumbnailOptimized = (_d2 = fileInfo3.thumbnailOptimized) !== null && _d2 !== void 0 ? _d2 : "";
301330
301468
  const banner2 = (_e = fileInfo3.banner) !== null && _e !== void 0 ? _e : "";
301331
301469
  const bannerOptimized = (_f = fileInfo3.bannerOptimized) !== null && _f !== void 0 ? _f : "";
301332
301470
  const date = (_g = fileInfo3.date) !== null && _g !== void 0 ? _g : "";
301333
301471
  const tags = (_h = fileInfo3.tags) !== null && _h !== void 0 ? _h : [];
301334
- const { slug, level } = page;
301472
+ const { slug, level, file } = page;
301473
+ const { frontmatter: frontmatter2 } = (_k = (_j = cache.$getMdast(file)) === null || _j === void 0 ? void 0 : _j.post) !== null && _k !== void 0 ? _k : {};
301335
301474
  const projectPage = {
301336
301475
  slug,
301337
301476
  title,
@@ -301343,7 +301482,8 @@ async function localToManifestProject(session, projectPath, projectSlug) {
301343
301482
  banner: banner2,
301344
301483
  bannerOptimized,
301345
301484
  tags,
301346
- level
301485
+ level,
301486
+ enumerator: frontmatter2 === null || frontmatter2 === void 0 ? void 0 : frontmatter2.enumerator
301347
301487
  };
301348
301488
  return projectPage;
301349
301489
  }
@@ -301356,6 +301496,7 @@ async function localToManifestProject(session, projectPath, projectSlug) {
301356
301496
  const parts = resolveFrontmatterParts(session, projFrontmatter);
301357
301497
  const banner = await transformBanner(session, import_node_path29.default.join(projectPath, "myst.yml"), projFrontmatter, session.publicPath(), { altOutputFolder: "/", webp: true });
301358
301498
  const thumbnail = await transformThumbnail(session, null, import_node_path29.default.join(projectPath, "myst.yml"), projFrontmatter, session.publicPath(), { altOutputFolder: "/", webp: true });
301499
+ const { frontmatter } = (_b = (_a6 = cache.$getMdast(indexFile)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
301359
301500
  return {
301360
301501
  ...projFrontmatter,
301361
301502
  // TODO: a null in the project frontmatter should not fall back to index page
@@ -301371,6 +301512,7 @@ async function localToManifestProject(session, projectPath, projectSlug) {
301371
301512
  title: projectTitle || "Untitled",
301372
301513
  slug: projectSlug,
301373
301514
  index: index4,
301515
+ enumerator: frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.enumerator,
301374
301516
  pages
301375
301517
  };
301376
301518
  }
@@ -301733,7 +301875,7 @@ async function transformMystXRefs(session, vfile2, mdast2, frontmatter) {
301733
301875
  let number2 = 0;
301734
301876
  await Promise.all([
301735
301877
  ...nodes.map(async (node3) => {
301736
- var _a6, _b, _c;
301878
+ var _a6, _b, _c, _d2, _e;
301737
301879
  if (!node3.identifier) {
301738
301880
  const data = await fetchMystLinkData(session, node3, vfile2);
301739
301881
  if (!data)
@@ -301748,7 +301890,7 @@ async function transformMystXRefs(session, vfile2, mdast2, frontmatter) {
301748
301890
  maxNodes: 1
301749
301891
  });
301750
301892
  if (targets === null || targets === void 0 ? void 0 : targets.length) {
301751
- addChildrenFromTargetNode(node3, targets[0], frontmatter.numbering, vfile2);
301893
+ addChildrenFromTargetNode(node3, targets[0], frontmatter.numbering, vfile2, (_e = (_d2 = frontmatter.numbering) === null || _d2 === void 0 ? void 0 : _d2.title) === null || _e === void 0 ? void 0 : _e.offset);
301752
301894
  }
301753
301895
  }
301754
301896
  number2 += 1;
@@ -304008,6 +304150,33 @@ async function rawDirectiveTransform(tree, vfile2) {
304008
304150
  });
304009
304151
  }
304010
304152
 
304153
+ // ../myst-cli/dist/utils/addEditUrl.js
304154
+ var import_which5 = __toESM(require_lib15(), 1);
304155
+ function gitCommandAvailable() {
304156
+ return !!import_which5.default.sync("git", { nothrow: true });
304157
+ }
304158
+ async function addEditUrl(session, frontmatter, file) {
304159
+ if (!frontmatter.github)
304160
+ return;
304161
+ if (frontmatter.edit_url || frontmatter.edit_url === null)
304162
+ return;
304163
+ if (!gitCommandAvailable())
304164
+ return;
304165
+ try {
304166
+ const gitLog = silentLogger();
304167
+ const getGitBranch = makeExecutable("git rev-parse --abbrev-ref HEAD", gitLog);
304168
+ const gitBranch = (await getGitBranch()).trim();
304169
+ const getGitRoot = makeExecutable("git rev-parse --show-toplevel", gitLog);
304170
+ const gitRoot = (await getGitRoot()).trim();
304171
+ if (gitBranch && gitRoot && file.startsWith(gitRoot)) {
304172
+ frontmatter.edit_url = `${frontmatter.github}/blob/${gitBranch}${file.replace(gitRoot, "")}`;
304173
+ session.log.debug(`Added edit URL ${frontmatter.edit_url} to ${file}`);
304174
+ }
304175
+ } catch {
304176
+ session.log.debug(`Unable to add edit URL to ${file}`);
304177
+ }
304178
+ }
304179
+
304011
304180
  // ../myst-cli/dist/process/mdast.js
304012
304181
  var LINKS_SELECTOR = "link,card,linkBlock";
304013
304182
  var pluginUtils = { select, selectAll };
@@ -304018,17 +304187,24 @@ var htmlHandlers = {
304018
304187
  return result;
304019
304188
  }
304020
304189
  };
304021
- function referenceFileFromPartFile(session, partFile) {
304022
- const state = session.store.getState();
304023
- const partDeps = selectors_exports.selectDependentFiles(state, partFile);
304024
- if (partDeps.length > 0)
304025
- return partDeps[0];
304026
- const file = selectors_exports.selectFileFromPart(state, partFile);
304027
- return file !== null && file !== void 0 ? file : partFile;
304028
- }
304029
304190
  async function transformMdast(session, opts) {
304030
304191
  var _a6, _b, _c, _d2;
304031
- const { file, projectPath, pageSlug, projectSlug, imageExtensions, extraTransforms, watchMode = false, minifyMaxCharacters, index: index4, titleDepth, execute } = opts;
304192
+ const {
304193
+ file,
304194
+ projectPath,
304195
+ pageSlug,
304196
+ projectSlug,
304197
+ imageExtensions,
304198
+ extraTransforms,
304199
+ watchMode = false,
304200
+ minifyMaxCharacters,
304201
+ index: index4,
304202
+ titleDepth,
304203
+ // Related to title set in markdown, rather than frontmatter
304204
+ offset,
304205
+ // Related to multi-page nesting
304206
+ execute
304207
+ } = opts;
304032
304208
  const toc = tic();
304033
304209
  const { store, log } = session;
304034
304210
  const cache = castSession(session);
@@ -304052,16 +304228,18 @@ async function transformMdast(session, opts) {
304052
304228
  fileWarn(vfile2, message, { ruleId: RuleId.validPageFrontmatter });
304053
304229
  }
304054
304230
  }, projectPath);
304231
+ if (offset) {
304232
+ if (!frontmatter.numbering)
304233
+ frontmatter.numbering = {};
304234
+ if (!frontmatter.numbering.title)
304235
+ frontmatter.numbering.title = {};
304236
+ if (frontmatter.numbering.title.offset == null)
304237
+ frontmatter.numbering.title.offset = offset;
304238
+ }
304239
+ await addEditUrl(session, frontmatter, file);
304055
304240
  const references = {
304056
304241
  cite: { order: [], data: {} }
304057
304242
  };
304058
- const refFile = kind === SourceFileKind.Part ? referenceFileFromPartFile(session, file) : file;
304059
- const state = new ReferenceState(refFile, {
304060
- numbering: frontmatter.numbering,
304061
- identifiers,
304062
- vfile: vfile2
304063
- });
304064
- cache.$internalReferences[file] = state;
304065
304243
  importMdastFromJson(session, file, mdast2);
304066
304244
  await includeFilesTransform(session, file, mdast2, frontmatter, vfile2);
304067
304245
  rawDirectiveTransform(mdast2, vfile2);
@@ -304069,12 +304247,13 @@ async function transformMdast(session, opts) {
304069
304247
  const pipe = unified().use(reconstructHtmlPlugin).use(htmlPlugin, { htmlHandlers }).use(basicTransformationsPlugin, {
304070
304248
  parser: (content3) => parseMyst(session, content3, file),
304071
304249
  firstDepth: (titleDepth !== null && titleDepth !== void 0 ? titleDepth : 1) + (frontmatter.content_includes_title ? 0 : 1)
304072
- }).use(inlineMathSimplificationPlugin).use(mathPlugin, { macros: frontmatter.math }).use(glossaryPlugin).use(abbreviationPlugin, { abbreviations: frontmatter.abbreviations }).use(indexIdentifierPlugin).use(enumerateTargetsPlugin, { state });
304250
+ }).use(inlineMathSimplificationPlugin).use(mathPlugin, { macros: frontmatter.math });
304073
304251
  (_c = session.plugins) === null || _c === void 0 ? void 0 : _c.transforms.forEach((t2) => {
304074
304252
  if (t2.stage !== "document")
304075
304253
  return;
304076
304254
  pipe.use(t2.plugin, void 0, pluginUtils);
304077
304255
  });
304256
+ pipe.use(glossaryPlugin).use(abbreviationPlugin, { abbreviations: frontmatter.abbreviations }).use(indexIdentifierPlugin);
304078
304257
  await pipe.run(mdast2, vfile2);
304079
304258
  propagateBlockDataToCode(session, vfile2, mdast2);
304080
304259
  cache.$citationRenderers[file] = await transformLinkedDOIs(session, vfile2, mdast2, cache.$doiRenderers, file);
@@ -304131,6 +304310,7 @@ async function transformMdast(session, opts) {
304131
304310
  frontmatter,
304132
304311
  mdast: mdast2,
304133
304312
  references,
304313
+ identifiers,
304134
304314
  widgets
304135
304315
  };
304136
304316
  const cachedMdast = cache.$getMdast(file);
@@ -304156,8 +304336,7 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
304156
304336
  const vfile2 = new VFile();
304157
304337
  vfile2.path = file;
304158
304338
  const { mdast: mdast2, dependencies, frontmatter } = mdastPost;
304159
- const fileState = cache.$internalReferences[file];
304160
- const state = pageReferenceStates ? new MultiPageReferenceResolver(pageReferenceStates, file, vfile2) : fileState;
304339
+ const state = new MultiPageReferenceResolver(pageReferenceStates, file, vfile2);
304161
304340
  const externalReferences = Object.values(cache.$externalReferences);
304162
304341
  const transformers = [
304163
304342
  ...extraLinkTransformers || [],
@@ -304173,12 +304352,12 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
304173
304352
  // Links static files and internally linked files
304174
304353
  ];
304175
304354
  resolveLinksAndCitationsTransform(mdast2, { state, transformers });
304176
- linksTransform(mdast2, state.vfile, {
304355
+ linksTransform(mdast2, vfile2, {
304177
304356
  transformers,
304178
304357
  selector: LINKS_SELECTOR
304179
304358
  });
304180
304359
  await transformLinkedRORs(session, vfile2, mdast2, file);
304181
- resolveReferencesTransform(mdast2, state.vfile, { state, transformers });
304360
+ resolveReferencesTransform(mdast2, vfile2, { state, transformers });
304182
304361
  await transformMystXRefs(session, vfile2, mdast2, frontmatter);
304183
304362
  await embedTransform(session, mdast2, file, dependencies, state);
304184
304363
  const pipe = unified();
@@ -304190,7 +304369,6 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
304190
304369
  await pipe.run(mdast2, vfile2);
304191
304370
  keysTransform(mdast2);
304192
304371
  checkLinkTextTransform(mdast2, externalReferences, vfile2);
304193
- logMessagesFromVFile(session, fileState.vfile);
304194
304372
  logMessagesFromVFile(session, vfile2);
304195
304373
  log.debug(toc(`Transformed mdast cross references and links for "${file}" in %s`));
304196
304374
  if (checkLinks)
@@ -304518,10 +304696,36 @@ function warnOnDuplicateIdentifiers(session, states) {
304518
304696
  });
304519
304697
  });
304520
304698
  }
304699
+ function referenceFileFromPartFile(session, partFile) {
304700
+ const state = session.store.getState();
304701
+ const partDeps = selectors_exports.selectDependentFiles(state, partFile);
304702
+ if (partDeps.length > 0)
304703
+ return partDeps[0];
304704
+ const file = selectors_exports.selectFileFromPart(state, partFile);
304705
+ return file !== null && file !== void 0 ? file : partFile;
304706
+ }
304521
304707
  function selectPageReferenceStates(session, pages, opts) {
304522
304708
  const cache = castSession(session);
304523
- const pageReferenceStates = pages.map((page) => {
304524
- const state = cache.$internalReferences[page.file];
304709
+ let previousCounts;
304710
+ const pageReferenceStates = pages.map(({ file }) => {
304711
+ var _a6, _b;
304712
+ const { frontmatter, identifiers, mdast: mdast2, kind } = (_b = (_a6 = cache.$getMdast(file)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
304713
+ const vfile2 = new VFile();
304714
+ vfile2.path = file;
304715
+ const refFile = kind === SourceFileKind.Part ? referenceFileFromPartFile(session, file) : file;
304716
+ const state = new ReferenceState(refFile, {
304717
+ frontmatter,
304718
+ identifiers,
304719
+ previousCounts,
304720
+ vfile: vfile2
304721
+ });
304722
+ if (frontmatter && !frontmatter.enumerator) {
304723
+ frontmatter.enumerator = state.enumerator;
304724
+ }
304725
+ if (mdast2)
304726
+ enumerateTargetsTransform(mdast2, { state });
304727
+ previousCounts = state.targetCounts;
304728
+ logMessagesFromVFile(session, vfile2);
304525
304729
  if (state) {
304526
304730
  const selectedFile = selectors_exports.selectFileInfo(session.store.getState(), state.filePath);
304527
304731
  if (selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.url)
@@ -304536,18 +304740,13 @@ function selectPageReferenceStates(session, pages, opts) {
304536
304740
  }).filter((state) => !!state);
304537
304741
  if (!(opts === null || opts === void 0 ? void 0 : opts.suppressWarnings))
304538
304742
  warnOnDuplicateIdentifiers(session, pageReferenceStates);
304539
- pages.forEach((page) => {
304743
+ pageReferenceStates.forEach((state) => {
304540
304744
  var _a6, _b;
304541
- const state = cache.$internalReferences[page.file];
304542
- if (!state)
304543
- return;
304544
- const { mdast: mdast2 } = (_b = (_a6 = cache.$getMdast(page.file)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
304745
+ const { mdast: mdast2 } = (_b = (_a6 = cache.$getMdast(state.filePath)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
304545
304746
  if (!mdast2)
304546
304747
  return;
304547
- const vfile2 = new VFile();
304548
- vfile2.path = page.file;
304549
- buildIndexTransform(mdast2, vfile2, state, new MultiPageReferenceResolver(pageReferenceStates, state.filePath));
304550
- logMessagesFromVFile(session, vfile2);
304748
+ buildIndexTransform(mdast2, state.vfile, state, new MultiPageReferenceResolver(pageReferenceStates, state.filePath));
304749
+ logMessagesFromVFile(session, state.vfile);
304551
304750
  });
304552
304751
  return pageReferenceStates;
304553
304752
  }
@@ -304598,6 +304797,8 @@ async function fastProcessFile(session, { file, pageSlug, projectPath, projectSl
304598
304797
  const fileParts = selectors_exports.selectFileParts(state, file);
304599
304798
  const projectParts = selectors_exports.selectProjectParts(state, projectPath);
304600
304799
  await Promise.all([file, ...fileParts].map(async (f3) => {
304800
+ var _a6;
304801
+ const level = (_a6 = pages.find((page) => page.file === file)) === null || _a6 === void 0 ? void 0 : _a6.level;
304601
304802
  return transformMdast(session, {
304602
304803
  file: f3,
304603
304804
  imageExtensions: imageExtensions !== null && imageExtensions !== void 0 ? imageExtensions : WEB_IMAGE_EXTENSIONS,
@@ -304607,7 +304808,8 @@ async function fastProcessFile(session, { file, pageSlug, projectPath, projectSl
304607
304808
  watchMode: true,
304608
304809
  extraTransforms,
304609
304810
  index: project.index,
304610
- execute
304811
+ execute,
304812
+ offset: level ? level - 1 : void 0
304611
304813
  });
304612
304814
  }));
304613
304815
  const pageReferenceStates = selectPageReferenceStates(session, [
@@ -304616,18 +304818,18 @@ async function fastProcessFile(session, { file, pageSlug, projectPath, projectSl
304616
304818
  return { file: part };
304617
304819
  })
304618
304820
  ]);
304619
- await Promise.all([file, ...fileParts].map(async (f3) => {
304821
+ await Promise.all([...pages.map((p5) => p5.file), ...fileParts].map(async (f3) => {
304620
304822
  return postProcessMdast(session, {
304621
304823
  file: f3,
304622
304824
  pageReferenceStates,
304623
304825
  extraLinkTransformers
304624
304826
  });
304625
304827
  }));
304626
- await Promise.all([file, ...fileParts].map(async (f3) => {
304828
+ await Promise.all([...pages.map((p5) => p5.file), ...fileParts].map(async (f3) => {
304627
304829
  var _a6, _b;
304628
304830
  const { mdast: mdast2, frontmatter } = (_b = (_a6 = castSession(session).$getMdast(f3)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
304629
- if (mdast2) {
304630
- await finalizeMdast(session, mdast2, frontmatter !== null && frontmatter !== void 0 ? frontmatter : {}, f3, {
304831
+ if (mdast2 && frontmatter) {
304832
+ await finalizeMdast(session, mdast2, frontmatter, f3, {
304631
304833
  imageWriteFolder: imageWriteFolder !== null && imageWriteFolder !== void 0 ? imageWriteFolder : session.publicPath(),
304632
304834
  imageAltOutputFolder: imageAltOutputFolder !== null && imageAltOutputFolder !== void 0 ? imageAltOutputFolder : "/",
304633
304835
  imageExtensions: imageExtensions !== null && imageExtensions !== void 0 ? imageExtensions : WEB_IMAGE_EXTENSIONS,
@@ -304637,9 +304839,14 @@ async function fastProcessFile(session, { file, pageSlug, projectPath, projectSl
304637
304839
  });
304638
304840
  }
304639
304841
  }));
304640
- if (pageSlug) {
304641
- await writeFile(session, { file, pageSlug, projectSlug, projectPath });
304642
- }
304842
+ await Promise.all(pages.map(async (page) => {
304843
+ return writeFile(session, {
304844
+ file: page.file,
304845
+ projectSlug,
304846
+ projectPath,
304847
+ pageSlug: page.slug
304848
+ });
304849
+ }));
304643
304850
  session.log.info(toc(`\u{1F4D6} Built ${file} in %s.`));
304644
304851
  await writeSiteManifest(session, { defaultTemplate });
304645
304852
  }
@@ -304673,7 +304880,10 @@ async function processProject(session, siteProject, opts) {
304673
304880
  const projectParts = selectors_exports.selectProjectParts(session.store.getState(), siteProject.path).map((part) => {
304674
304881
  return { file: part };
304675
304882
  });
304676
- const pagesToTransform = [...pages, ...projectParts];
304883
+ const pagesToTransform = [
304884
+ ...pages,
304885
+ ...projectParts
304886
+ ];
304677
304887
  const usedImageExtensions = imageExtensions !== null && imageExtensions !== void 0 ? imageExtensions : WEB_IMAGE_EXTENSIONS;
304678
304888
  await Promise.all(pagesToTransform.map((page) => transformMdast(session, {
304679
304889
  file: page.file,
@@ -304684,7 +304894,8 @@ async function processProject(session, siteProject, opts) {
304684
304894
  watchMode,
304685
304895
  execute,
304686
304896
  extraTransforms,
304687
- index: project.index
304897
+ index: project.index,
304898
+ offset: page.level ? page.level - 1 : void 0
304688
304899
  })));
304689
304900
  const pageReferenceStates = selectPageReferenceStates(session, pagesToTransform);
304690
304901
  await Promise.all(pagesToTransform.map((page) => postProcessMdast(session, {
@@ -306796,7 +307007,7 @@ function hasGlossary(mdast2) {
306796
307007
  var import_adm_zip3 = __toESM(require_adm_zip(), 1);
306797
307008
  var import_node_fs36 = __toESM(require("fs"), 1);
306798
307009
  var import_node_path46 = __toESM(require("path"), 1);
306799
- var import_which5 = __toESM(require_lib15(), 1);
307010
+ var import_which6 = __toESM(require_lib15(), 1);
306800
307011
 
306801
307012
  // ../myst-to-typst/dist/container.js
306802
307013
  var CaptionKind2;
@@ -306807,7 +307018,9 @@ var CaptionKind2;
306807
307018
  CaptionKind3["table"] = "table";
306808
307019
  })(CaptionKind2 || (CaptionKind2 = {}));
306809
307020
  function renderFigureChild(node3, state) {
306810
- const useBrackets = node3.type !== "image" && node3.type !== "table";
307021
+ var _a6;
307022
+ const bracketNode = node3.type === "div" && ((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length) === 1 ? node3.children[0] : node3;
307023
+ const useBrackets = bracketNode.type !== "image" && bracketNode.type !== "table";
306811
307024
  if (node3.type === "legend") {
306812
307025
  state.useMacro('#let legendStyle = (fill: black.lighten(20%), size: 8pt, style: "italic")');
306813
307026
  state.write("text(..legendStyle)");
@@ -307187,6 +307400,43 @@ function getLatexImageWidth2(width) {
307187
307400
  return `${lineWidth}%`;
307188
307401
  }
307189
307402
 
307403
+ // ../../node_modules/tex-to-typst/dist/utils.js
307404
+ var BRACKETS = {
307405
+ "[": "bracket.l",
307406
+ "]": "bracket.r",
307407
+ "{": "brace.l",
307408
+ "}": "brace.r",
307409
+ "(": "paren.l",
307410
+ ")": "paren.r",
307411
+ "|": "bar.v",
307412
+ lfloor: "floor.l",
307413
+ "\u230A": "floor.l",
307414
+ rfloor: "floor.r",
307415
+ "\u230B": "floor.r",
307416
+ rceil: "ceil.r",
307417
+ "\u2309": "ceil.r",
307418
+ lceil: "ceil.l",
307419
+ "\u2308": "ceil.l"
307420
+ };
307421
+ function areBracketsBalanced(input3) {
307422
+ const stack = [];
307423
+ const bracketMap = {
307424
+ ")": "(",
307425
+ "]": "[",
307426
+ "}": "{"
307427
+ };
307428
+ for (const char of input3) {
307429
+ if (char === "(" || char === "[" || char === "{") {
307430
+ stack.push(char);
307431
+ } else if (char === ")" || char === "]" || char === "}") {
307432
+ if (!stack.length || bracketMap[char] !== stack.pop()) {
307433
+ return false;
307434
+ }
307435
+ }
307436
+ }
307437
+ return stack.length === 0;
307438
+ }
307439
+
307190
307440
  // ../../node_modules/tex-to-typst/dist/macros.js
307191
307441
  function isEmptyNode(node3) {
307192
307442
  if (!(node3 === null || node3 === void 0 ? void 0 : node3.content) || node3.content.length === 0)
@@ -307201,22 +307451,13 @@ var typstStrings = {
307201
307451
  "~": "med",
307202
307452
  '"': '\\"'
307203
307453
  };
307204
- var brackets = {
307205
- "[": "bracket.l",
307206
- "]": "bracket.r",
307207
- "{": "brace.l",
307208
- "}": "brace.r",
307209
- "(": "paren.l",
307210
- ")": "paren.r",
307211
- "|": "bar.v"
307212
- };
307213
307454
  function createBrackets(scale) {
307214
307455
  return (state, node3) => {
307215
307456
  var _a6;
307216
307457
  const args = node3.args;
307217
307458
  node3.args = [];
307218
307459
  const b = ((_a6 = args === null || args === void 0 ? void 0 : args[0].content) === null || _a6 === void 0 ? void 0 : _a6[0]).content;
307219
- const typstB = brackets[b];
307460
+ const typstB = BRACKETS[b];
307220
307461
  if (!typstB)
307221
307462
  throw new Error(`Undefined left bracket: ${b}`);
307222
307463
  return `#scale(x: ${scale}, y: ${scale})[$${typstB}$]`;
@@ -307264,6 +307505,17 @@ var typstMacros = {
307264
307505
  mathrm: "upright",
307265
307506
  textrm: "upright",
307266
307507
  rm: "upright",
307508
+ mbox: (state, node3) => {
307509
+ var _a6;
307510
+ const arg2 = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6[0];
307511
+ node3.args = [];
307512
+ state.openFunction("upright");
307513
+ state.openFunction("text");
307514
+ state.writeChildren(arg2);
307515
+ state.closeFunction();
307516
+ state.closeFunction();
307517
+ return "";
307518
+ },
307267
307519
  mathcal: "cal",
307268
307520
  mathfrak: "frak",
307269
307521
  pm: "plus.minus",
@@ -307276,12 +307528,18 @@ var typstMacros = {
307276
307528
  splitStrings(node3);
307277
307529
  return "^";
307278
307530
  },
307531
+ big: createBrackets("120%"),
307279
307532
  bigl: createBrackets("120%"),
307280
307533
  bigr: createBrackets("120%"),
307281
- big: createBrackets("120%"),
307534
+ Big: createBrackets("180%"),
307282
307535
  Bigl: createBrackets("180%"),
307283
307536
  Bigr: createBrackets("180%"),
307284
- Big: createBrackets("180%"),
307537
+ bigg: createBrackets("240%"),
307538
+ biggr: createBrackets("240%"),
307539
+ biggl: createBrackets("240%"),
307540
+ Bigg: createBrackets("300%"),
307541
+ Biggl: createBrackets("300%"),
307542
+ Biggr: createBrackets("300%"),
307285
307543
  left: (state, node3) => {
307286
307544
  var _a6;
307287
307545
  const args = node3.args;
@@ -307393,9 +307651,9 @@ var typstMacros = {
307393
307651
  prod: "product",
307394
307652
  lfloor: "floor.l",
307395
307653
  rfloor: "floor.r",
307654
+ langle: "angle.l",
307655
+ rangle: "angle.r",
307396
307656
  implies: "arrow.r.double.long",
307397
- biggl: "",
307398
- biggr: "",
307399
307657
  " ": '" "',
307400
307658
  mathbb: (state, node3) => {
307401
307659
  var _a6, _b, _c, _d2, _e;
@@ -307486,12 +307744,18 @@ function parseLatex2(value) {
307486
307744
  boldsymbol: { signature: "m" },
307487
307745
  left: { signature: "m" },
307488
307746
  right: { signature: "m" },
307489
- Big: { signature: "m" },
307490
- Bigr: { signature: "m" },
307491
- Bigl: { signature: "m" },
307492
307747
  big: { signature: "m" },
307493
307748
  bigr: { signature: "m" },
307494
307749
  bigl: { signature: "m" },
307750
+ Big: { signature: "m" },
307751
+ Bigr: { signature: "m" },
307752
+ Bigl: { signature: "m" },
307753
+ bigg: { signature: "m" },
307754
+ biggr: { signature: "m" },
307755
+ biggl: { signature: "m" },
307756
+ Bigg: { signature: "m" },
307757
+ Biggr: { signature: "m" },
307758
+ Biggl: { signature: "m" },
307495
307759
  dot: { signature: "m" },
307496
307760
  ddot: { signature: "m" },
307497
307761
  hat: { signature: "m" },
@@ -307586,12 +307850,13 @@ function walkLatex2(node3) {
307586
307850
  return node3;
307587
307851
  }
307588
307852
  var State4 = class {
307589
- constructor() {
307853
+ constructor(opts) {
307854
+ var _a6;
307590
307855
  this._scriptsSimplified = false;
307591
307856
  this._closeToken = [];
307592
307857
  this._currentFunctions = [];
307593
307858
  this._value = "";
307594
- this.data = {};
307859
+ this.data = { writeOutBrackets: (_a6 = opts === null || opts === void 0 ? void 0 : opts.writeOutBrackets) !== null && _a6 !== void 0 ? _a6 : false };
307595
307860
  }
307596
307861
  get value() {
307597
307862
  return this._value;
@@ -307615,6 +307880,11 @@ var State4 = class {
307615
307880
  write(str2) {
307616
307881
  if (!str2)
307617
307882
  return;
307883
+ if (Object.keys(BRACKETS).includes(str2) && this.data.inFunction && this.data.writeOutBrackets) {
307884
+ this.addWhitespace();
307885
+ this._value += BRACKETS[str2];
307886
+ return;
307887
+ }
307618
307888
  if (this._scriptsSimplified && str2 === "(") {
307619
307889
  this.addWhitespace();
307620
307890
  } else if (str2.match(/^([})_^.,;!])$/) || str2 === '\\"') {
@@ -307726,11 +307996,15 @@ function writeTypst(node3, state = new State4()) {
307726
307996
  function postProcess(typst) {
307727
307997
  return typst.replace(/^(_|\^)/, '""$1').replace(/"([^"]*)"=/g, '"$1" =').replace(/(\d+)(?:\s+)(?=\d)/g, "$1");
307728
307998
  }
307729
- function texToTypst(value) {
307999
+ function texToTypst(value, options) {
307730
308000
  const tree = parseLatex2(value);
307731
308001
  walkLatex2(tree);
307732
- const state = writeTypst(tree);
307733
- return { value: postProcess(state.value), macros: state.data.macros };
308002
+ const state = writeTypst(tree, new State4({ writeOutBrackets: options === null || options === void 0 ? void 0 : options.writeOutBrackets }));
308003
+ const typstValue = postProcess(state.value);
308004
+ if ((options === null || options === void 0 ? void 0 : options.writeOutBrackets) || areBracketsBalanced(typstValue)) {
308005
+ return { value: typstValue, macros: state.data.macros };
308006
+ }
308007
+ return texToTypst(value, { writeOutBrackets: true });
307734
308008
  }
307735
308009
 
307736
308010
  // ../myst-to-typst/dist/math.js
@@ -307869,7 +308143,9 @@ var tableCellHandler = (node3, state) => {
307869
308143
  state.write(`align: ${node3.align}, `);
307870
308144
  }
307871
308145
  if ((_b = node3.style) === null || _b === void 0 ? void 0 : _b.backgroundColor) {
307872
- state.write(`fill: rgb("${node3.style.backgroundColor}"), `);
308146
+ const fill3 = node3.style.backgroundColor;
308147
+ const rgb = fill3.startsWith("#");
308148
+ state.write(`fill: ${rgb ? `rgb("${fill3}")` : fill3}, `);
307873
308149
  }
307874
308150
  state.write(")");
307875
308151
  }
@@ -308000,7 +308276,7 @@ function nextCharacterIsText(parent2, node3) {
308000
308276
  }
308001
308277
  var handlers4 = {
308002
308278
  text(node3, state) {
308003
- state.text(node3.value);
308279
+ state.text(node3.value.replaceAll("\n", " "));
308004
308280
  },
308005
308281
  paragraph(node3, state) {
308006
308282
  const { identifier } = node3;
@@ -308482,7 +308758,7 @@ var TYPST_IMAGE_EXTENSIONS = [
308482
308758
  ImageExtensions.jpeg
308483
308759
  ];
308484
308760
  function isTypstAvailable() {
308485
- return import_which5.default.sync("typst", { nothrow: true });
308761
+ return import_which6.default.sync("typst", { nothrow: true });
308486
308762
  }
308487
308763
  async function runTypstExecutable(session, typstFile) {
308488
308764
  if (!isTypstAvailable()) {
@@ -312136,12 +312412,12 @@ var import_node_path49 = __toESM(require("path"), 1);
312136
312412
  var import_util5 = __toESM(require("util"), 1);
312137
312413
 
312138
312414
  // ../myst-cli/dist/build/pdf/utils.js
312139
- var import_which6 = __toESM(require_lib15(), 1);
312415
+ var import_which7 = __toESM(require_lib15(), 1);
312140
312416
  function isLatexmkAvailable() {
312141
- return import_which6.default.sync("latexmk", { nothrow: true });
312417
+ return import_which7.default.sync("latexmk", { nothrow: true });
312142
312418
  }
312143
312419
  function isMakeglossariesAvailable() {
312144
- return import_which6.default.sync("makeglossaries", { nothrow: true });
312420
+ return import_which7.default.sync("makeglossaries", { nothrow: true });
312145
312421
  }
312146
312422
 
312147
312423
  // ../myst-cli/dist/build/pdf/create.js
@@ -317199,7 +317475,7 @@ function frontmatterToCFF(frontmatter, abstract) {
317199
317475
  let dateString;
317200
317476
  if (frontmatter.date) {
317201
317477
  const date = new Date(frontmatter.date);
317202
- dateString = new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1e3).toISOString().split("T")[0];
317478
+ dateString = new Date(date.getTime()).toISOString().split("T")[0];
317203
317479
  }
317204
317480
  const { title, authors } = frontmatter;
317205
317481
  if (!title) {
@@ -317858,6 +318134,8 @@ async function startServer(session, opts) {
317858
318134
  }
317859
318135
 
317860
318136
  // ../myst-cli/dist/build/html/index.js
318137
+ var import_p_limit2 = __toESM(require_p_limit(), 1);
318138
+ var limitConnections = (0, import_p_limit2.default)(5);
317861
318139
  async function currentSiteRoutes(session, host, baseurl, opts) {
317862
318140
  var _a6, _b;
317863
318141
  const manifest = await getSiteManifest(session, opts);
@@ -317947,8 +318225,8 @@ async function buildHtml(session, opts) {
317947
318225
  return;
317948
318226
  const host = `http://localhost:${appServer.port}`;
317949
318227
  const routes = await currentSiteRoutes(session, host, baseurl, opts);
317950
- await Promise.all(routes.map(async (route) => {
317951
- const resp = await session.fetch(route.url);
318228
+ await Promise.all(routes.map(async (route) => limitConnections(async () => {
318229
+ const resp = await fetchWithRetry(session, route.url);
317952
318230
  if (!resp.ok) {
317953
318231
  session.log.error(`Error fetching ${route.url}`);
317954
318232
  return;
@@ -317966,7 +318244,7 @@ async function buildHtml(session, opts) {
317966
318244
  const content3 = await resp.text();
317967
318245
  writeFileToFolder(import_node_path57.default.join(htmlDir, route.path), content3);
317968
318246
  }
317969
- }));
318247
+ })));
317970
318248
  appServer.stop();
317971
318249
  const templateBuildDir = import_node_path57.default.join(template.templatePath, "public");
317972
318250
  import_fs_extra.default.copySync(templateBuildDir, htmlDir);
@@ -320742,6 +321020,7 @@ async function checkAtGitRoot() {
320742
321020
  // ../myst-cli/dist/init/gh-actions/index.js
320743
321021
  function createGithubPagesAction({ defaultBranch = "main", username = "username", isGithubIO }) {
320744
321022
  return `# This file was created automatically with \`myst init --gh-pages\` \u{1FA84} \u{1F49A}
321023
+ # Ensure your GitHub Pages settings for this repository are set to deploy with **GitHub Actions**.
320745
321024
 
320746
321025
  name: MyST GitHub Pages Deploy
320747
321026
  on:
@@ -332472,7 +332751,7 @@ function boxen(text7, options) {
332472
332751
 
332473
332752
  // ../myst-cli/dist/session/session.js
332474
332753
  var import_https_proxy_agent = __toESM(require_dist5(), 1);
332475
- var import_p_limit2 = __toESM(require_p_limit(), 1);
332754
+ var import_p_limit3 = __toESM(require_p_limit(), 1);
332476
332755
  var import_services = __toESM(require_lib27(), 1);
332477
332756
  if (!globalThis.fetch) {
332478
332757
  globalThis.fetch = fetch2;
@@ -332485,13 +332764,23 @@ var API_URL = "https://api.mystmd.org";
332485
332764
  var NPM_COMMAND = "npm i -g mystmd@latest";
332486
332765
  var PIP_COMMAND = "pip install -U mystmd";
332487
332766
  var LOCALHOSTS = ["localhost", "127.0.0.1", "::1"];
332488
- function logUpdateAvailable({ current: current2, latest: latest2, upgradeCommand, twitter }) {
332767
+ function socialLink({ twitter, bsky }) {
332768
+ if (bsky) {
332769
+ return `Follow ${source_default.yellowBright(`@${bsky}`)} for updates!
332770
+ https://bsky.app/profile/${bsky}`;
332771
+ }
332772
+ if (twitter) {
332773
+ return `Follow ${source_default.yellowBright(`@${twitter}`)} for updates!
332774
+ https://x.com/${twitter}`;
332775
+ }
332776
+ return "";
332777
+ }
332778
+ function logUpdateAvailable({ current: current2, latest: latest2, upgradeCommand, twitter, bsky }) {
332489
332779
  return boxen(`Update available! ${source_default.dim(`v${current2}`)} \u226B ${source_default.green.bold(`v${latest2}`)}
332490
332780
 
332491
332781
  Run \`${source_default.cyanBright.bold(upgradeCommand)}\` to update.
332492
332782
 
332493
- Follow ${source_default.yellowBright(`@${twitter}`)} for updates!
332494
- https://twitter.com/${twitter}`, {
332783
+ ${socialLink({ bsky, twitter })}`, {
332495
332784
  padding: 1,
332496
332785
  margin: 1,
332497
332786
  borderColor: "green",
@@ -332510,7 +332799,7 @@ var Session = class {
332510
332799
  this.API_URL = API_URL;
332511
332800
  this.configFiles = CONFIG_FILES;
332512
332801
  this.$logger = (_a6 = opts.logger) !== null && _a6 !== void 0 ? _a6 : chalkLogger(LogLevel.info, process.cwd());
332513
- this.doiLimiter = (_b = opts.doiLimiter) !== null && _b !== void 0 ? _b : (0, import_p_limit2.default)(3);
332802
+ this.doiLimiter = (_b = opts.doiLimiter) !== null && _b !== void 0 ? _b : (0, import_p_limit3.default)(3);
332514
332803
  const proxyUrl = process.env.HTTPS_PROXY;
332515
332804
  if (proxyUrl)
332516
332805
  this.proxyAgent = new import_https_proxy_agent.HttpsProxyAgent(proxyUrl);
@@ -332526,7 +332815,7 @@ var Session = class {
332526
332815
  current: version_default2,
332527
332816
  latest: this._latestVersion,
332528
332817
  upgradeCommand: process.env.MYST_LANG === "PYTHON" ? PIP_COMMAND : NPM_COMMAND,
332529
- twitter: "MystMarkdown"
332818
+ bsky: "mystmd.org"
332530
332819
  }));
332531
332820
  this._shownUpgrade = true;
332532
332821
  }