mystmd 1.3.19__py3-none-any.whl → 1.3.21__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
@@ -1344,13 +1344,13 @@ var require_object_create = __commonJS({
1344
1344
  return temp;
1345
1345
  };
1346
1346
  var NullProtoObjectViaIFrame = function() {
1347
- var iframe3 = documentCreateElement("iframe");
1347
+ var iframe4 = documentCreateElement("iframe");
1348
1348
  var JS = "java" + SCRIPT + ":";
1349
1349
  var iframeDocument;
1350
- iframe3.style.display = "none";
1351
- html7.appendChild(iframe3);
1352
- iframe3.src = String(JS);
1353
- iframeDocument = iframe3.contentWindow.document;
1350
+ iframe4.style.display = "none";
1351
+ html7.appendChild(iframe4);
1352
+ iframe4.src = String(JS);
1353
+ iframeDocument = iframe4.contentWindow.document;
1354
1354
  iframeDocument.open();
1355
1355
  iframeDocument.write(scriptTag("document.F=Object"));
1356
1356
  iframeDocument.close();
@@ -45547,13 +45547,13 @@ var require_css_syntax_error = __commonJS({
45547
45547
  let css = this.source;
45548
45548
  if (color2 == null)
45549
45549
  color2 = pico.isColorSupported;
45550
- let aside = (text7) => text7;
45550
+ let aside2 = (text7) => text7;
45551
45551
  let mark2 = (text7) => text7;
45552
45552
  let highlight = (text7) => text7;
45553
45553
  if (color2) {
45554
45554
  let { bold, gray, red } = pico.createColors(true);
45555
45555
  mark2 = (text7) => bold(red(text7));
45556
- aside = (text7) => gray(text7);
45556
+ aside2 = (text7) => gray(text7);
45557
45557
  if (terminalHighlight) {
45558
45558
  highlight = (text7) => terminalHighlight(text7);
45559
45559
  }
@@ -45574,13 +45574,13 @@ var require_css_syntax_error = __commonJS({
45574
45574
  this.endColumn + padding2
45575
45575
  );
45576
45576
  let subLine = line2.slice(subLineStart, subLineEnd);
45577
- let spacing3 = aside(gutter.replace(/\d/g, " ")) + line2.slice(0, Math.min(this.column - 1, padding2 - 1)).replace(/[^\t]/g, " ");
45578
- return mark2(">") + aside(gutter) + highlight(subLine) + "\n " + spacing3 + mark2("^");
45577
+ let spacing3 = aside2(gutter.replace(/\d/g, " ")) + line2.slice(0, Math.min(this.column - 1, padding2 - 1)).replace(/[^\t]/g, " ");
45578
+ return mark2(">") + aside2(gutter) + highlight(subLine) + "\n " + spacing3 + mark2("^");
45579
45579
  }
45580
- let spacing2 = aside(gutter.replace(/\d/g, " ")) + line2.slice(0, this.column - 1).replace(/[^\t]/g, " ");
45581
- return mark2(">") + aside(gutter) + highlight(line2) + "\n " + spacing2 + mark2("^");
45580
+ let spacing2 = aside2(gutter.replace(/\d/g, " ")) + line2.slice(0, this.column - 1).replace(/[^\t]/g, " ");
45581
+ return mark2(">") + aside2(gutter) + highlight(line2) + "\n " + spacing2 + mark2("^");
45582
45582
  }
45583
- return " " + aside(gutter) + highlight(line2);
45583
+ return " " + aside2(gutter) + highlight(line2);
45584
45584
  }).join("\n");
45585
45585
  }
45586
45586
  toString() {
@@ -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
 
@@ -165994,7 +165994,7 @@ var require_bl = __commonJS({
165994
165994
  var require_ora = __commonJS({
165995
165995
  "../../node_modules/ora/index.js"(exports2, module2) {
165996
165996
  "use strict";
165997
- var readline3 = require("readline");
165997
+ var readline2 = require("readline");
165998
165998
  var chalk7 = require_source();
165999
165999
  var cliCursor3 = require_cli_cursor();
166000
166000
  var cliSpinners = require_cli_spinners();
@@ -166047,7 +166047,7 @@ var require_ora = __commonJS({
166047
166047
  if (process.platform === "win32") {
166048
166048
  return;
166049
166049
  }
166050
- this.rl = readline3.createInterface({
166050
+ this.rl = readline2.createInterface({
166051
166051
  input: process.stdin,
166052
166052
  output: this.mutedStream
166053
166053
  });
@@ -193891,7 +193891,7 @@ var {
193891
193891
  } = import_index.default;
193892
193892
 
193893
193893
  // src/version.ts
193894
- var version = "1.3.19";
193894
+ var version = "1.3.21";
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
@@ -196304,6 +196306,9 @@ var licenses = {
196304
196306
  "any-OSI": {
196305
196307
  name: "Any OSI License"
196306
196308
  },
196309
+ "any-OSI-perl-modules": {
196310
+ name: "Any OSI License - Perl Modules"
196311
+ },
196307
196312
  "Apache-1.0": {
196308
196313
  name: "Apache License 1.0",
196309
196314
  free: true
@@ -196409,6 +196414,9 @@ var licenses = {
196409
196414
  "Boehm-GC": {
196410
196415
  name: "Boehm-Demers-Weiser GC License"
196411
196416
  },
196417
+ "Boehm-GC-without-fee": {
196418
+ name: "Boehm-Demers-Weiser GC License (without fee)"
196419
+ },
196412
196420
  Borceux: {
196413
196421
  name: "Borceux license"
196414
196422
  },
@@ -196771,6 +196779,14 @@ var licenses = {
196771
196779
  name: "Creative Commons Public Domain Dedication and Certification",
196772
196780
  CC: true
196773
196781
  },
196782
+ "CC-PDM-1.0": {
196783
+ name: "Creative Commons Public Domain Mark 1.0 Universal",
196784
+ CC: true
196785
+ },
196786
+ "CC-SA-1.0": {
196787
+ name: "Creative Commons Share Alike 1.0 Generic",
196788
+ CC: true
196789
+ },
196774
196790
  "CC0-1.0": {
196775
196791
  name: "Creative Commons Zero v1.0 Universal",
196776
196792
  free: true,
@@ -196943,6 +196959,9 @@ var licenses = {
196943
196959
  "DocBook-Schema": {
196944
196960
  name: "DocBook Schema License"
196945
196961
  },
196962
+ "DocBook-Stylesheet": {
196963
+ name: "DocBook Stylesheet License"
196964
+ },
196946
196965
  "DocBook-XML": {
196947
196966
  name: "DocBook XML License"
196948
196967
  },
@@ -197087,6 +197106,9 @@ var licenses = {
197087
197106
  GD: {
197088
197107
  name: "GD License"
197089
197108
  },
197109
+ "generic-xts": {
197110
+ name: "Generic XTS License"
197111
+ },
197090
197112
  "GFDL-1.1-invariants-only": {
197091
197113
  name: "GNU Free Documentation License v1.1 only - invariants"
197092
197114
  },
@@ -197333,6 +197355,9 @@ var licenses = {
197333
197355
  "Inner-Net-2.0": {
197334
197356
  name: "Inner Net License v2.0"
197335
197357
  },
197358
+ InnoSetup: {
197359
+ name: "Inno Setup License"
197360
+ },
197336
197361
  Intel: {
197337
197362
  name: "Intel Open Source License",
197338
197363
  osi: true,
@@ -197547,6 +197572,9 @@ var licenses = {
197547
197572
  Minpack: {
197548
197573
  name: "Minpack License"
197549
197574
  },
197575
+ MIPS: {
197576
+ name: "MIPS License"
197577
+ },
197550
197578
  MirOS: {
197551
197579
  name: "The MirOS Licence",
197552
197580
  osi: true
@@ -197563,6 +197591,9 @@ var licenses = {
197563
197591
  "MIT-advertising": {
197564
197592
  name: "Enlightenment License (e16)"
197565
197593
  },
197594
+ "MIT-Click": {
197595
+ name: "MIT Click License"
197596
+ },
197566
197597
  "MIT-CMU": {
197567
197598
  name: "CMU License"
197568
197599
  },
@@ -198064,6 +198095,9 @@ var licenses = {
198064
198095
  "Sendmail-8.23": {
198065
198096
  name: "Sendmail License 8.23"
198066
198097
  },
198098
+ "Sendmail-Open-Source-1.1": {
198099
+ name: "Sendmail Open Source License v1.1"
198100
+ },
198067
198101
  "SGI-B-1.0": {
198068
198102
  name: "SGI Free Software License B v1.0"
198069
198103
  },
@@ -198106,6 +198140,9 @@ var licenses = {
198106
198140
  osi: true,
198107
198141
  free: true
198108
198142
  },
198143
+ "SMAIL-GPL": {
198144
+ name: "SMAIL General Public License"
198145
+ },
198109
198146
  SMLNJ: {
198110
198147
  name: "Standard ML of New Jersey License",
198111
198148
  free: true
@@ -198190,6 +198227,9 @@ var licenses = {
198190
198227
  "TGPPL-1.0": {
198191
198228
  name: "Transitive Grace Period Public Licence 1.0"
198192
198229
  },
198230
+ ThirdEye: {
198231
+ name: "ThirdEye License"
198232
+ },
198193
198233
  threeparttable: {
198194
198234
  name: "threeparttable License"
198195
198235
  },
@@ -198208,6 +198248,9 @@ var licenses = {
198208
198248
  "TPL-1.0": {
198209
198249
  name: "THOR Public License 1.0"
198210
198250
  },
198251
+ TrustedQSL: {
198252
+ name: "TrustedQSL License"
198253
+ },
198211
198254
  TTWL: {
198212
198255
  name: "Text-Tabs+Wrap License"
198213
198256
  },
@@ -198306,6 +198349,9 @@ var licenses = {
198306
198349
  name: "Do What The F*ck You Want To Public License",
198307
198350
  free: true
198308
198351
  },
198352
+ wwl: {
198353
+ name: "WWL License"
198354
+ },
198309
198355
  X11: {
198310
198356
  name: "X11 License",
198311
198357
  free: true
@@ -198415,7 +198461,7 @@ function correctLicense(license) {
198415
198461
  function createURL(id, cc, osi) {
198416
198462
  var _a6, _b;
198417
198463
  if (cc) {
198418
- const match3 = /^([CBYSAND0ZEROPD-]+)(?:(?:-)([0-9].[0-9]))?(?:(?:-)([A-Z]{2,3}))?$/.exec(id);
198464
+ const match3 = /^([CBYSAND0ZEROPDM-]+)(?:(?:-)([0-9].[0-9]))?(?:(?:-)([A-Z]{2,3}))?$/.exec(id);
198419
198465
  if (!match3) {
198420
198466
  throw new Error("Creative Commons license not found");
198421
198467
  }
@@ -198450,6 +198496,9 @@ function createURL(id, cc, osi) {
198450
198496
  case "CC-PDDC":
198451
198497
  link4 = "/publicdomain/";
198452
198498
  break;
198499
+ case "CC-PDM":
198500
+ link4 = "/publicdomain/mark/1.0/";
198501
+ break;
198453
198502
  default:
198454
198503
  break;
198455
198504
  }
@@ -198663,7 +198712,7 @@ function simplifyLicenses(licenses2) {
198663
198712
  }
198664
198713
 
198665
198714
  // ../myst-frontmatter/dist/numbering/validators.js
198666
- var NUMBERING_OPTIONS = ["enumerator", "all", "headings"];
198715
+ var NUMBERING_OPTIONS = ["enumerator", "all", "headings", "title"];
198667
198716
  var HEADING_KEYS = ["heading_1", "heading_2", "heading_3", "heading_4", "heading_5", "heading_6"];
198668
198717
  var NUMBERING_KEYS = [
198669
198718
  "figure",
@@ -198674,7 +198723,8 @@ var NUMBERING_KEYS = [
198674
198723
  "code",
198675
198724
  ...HEADING_KEYS
198676
198725
  ];
198677
- var NUMBERING_ITEM_KEYS = ["enabled", "start", "template"];
198726
+ var NUMBERING_ITEM_KEYS = ["enabled", "start", "enumerator", "template", "continue"];
198727
+ var CONTINUE_STRINGS = ["continue", "next"];
198678
198728
  var NUMBERING_ALIAS = {
198679
198729
  sections: "headings",
198680
198730
  h1: "heading_1",
@@ -198688,7 +198738,13 @@ var NUMBERING_ALIAS = {
198688
198738
  heading3: "heading_3",
198689
198739
  heading4: "heading_4",
198690
198740
  heading5: "heading_5",
198691
- 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"
198692
198748
  };
198693
198749
  function isBoolean(input3) {
198694
198750
  if (typeof input3 === "string") {
@@ -198697,11 +198753,13 @@ function isBoolean(input3) {
198697
198753
  return typeof input3 === "boolean";
198698
198754
  }
198699
198755
  function validateNumberingItem(input3, opts) {
198700
- var _a6, _b;
198756
+ var _a6, _b, _c, _d2, _e;
198701
198757
  if (isBoolean(input3)) {
198702
198758
  input3 = { enabled: input3 };
198703
198759
  } else if (typeof input3 === "number") {
198704
198760
  input3 = { start: input3 };
198761
+ } else if (CONTINUE_STRINGS.includes(input3)) {
198762
+ input3 = { continue: true };
198705
198763
  } else if (typeof input3 === "string") {
198706
198764
  input3 = { template: input3 };
198707
198765
  }
@@ -198715,20 +198773,78 @@ function validateNumberingItem(input3, opts) {
198715
198773
  output2.enabled = enabled;
198716
198774
  }
198717
198775
  if (defined(value.start)) {
198718
- const start = validateNumber(value.start, {
198719
- ...incrementOptions("start", opts),
198720
- integer: true,
198721
- min: 1
198722
- });
198723
- if (start) {
198724
- output2.start = start;
198776
+ if (CONTINUE_STRINGS.includes(value.start) && !defined(value.continue)) {
198777
+ output2.continue = true;
198725
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
+ }
198726
198789
  }
198727
198790
  }
198728
198791
  if (defined(value.template)) {
198729
198792
  const template = validateString(value.template, incrementOptions("template", opts));
198730
198793
  if (defined(template)) {
198731
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;
198732
198848
  output2.enabled = (_b = output2.enabled) !== null && _b !== void 0 ? _b : true;
198733
198849
  }
198734
198850
  }
@@ -198737,7 +198853,7 @@ function validateNumberingItem(input3, opts) {
198737
198853
  return output2;
198738
198854
  }
198739
198855
  function validateNumbering(input3, opts) {
198740
- var _a6, _b, _c, _d2;
198856
+ var _a6, _b, _c, _d2, _e;
198741
198857
  if (isBoolean(input3)) {
198742
198858
  input3 = { all: input3 };
198743
198859
  }
@@ -198748,6 +198864,9 @@ function validateNumbering(input3, opts) {
198748
198864
  let headings;
198749
198865
  if (defined(value.enumerator)) {
198750
198866
  const enumeratorOpts = incrementOptions("enumerator", opts);
198867
+ if (typeof value.enumerator === "string") {
198868
+ value.enumerator = { enumerator: value.enumerator };
198869
+ }
198751
198870
  output2.enumerator = validateNumberingItem(value.enumerator, enumeratorOpts);
198752
198871
  if (((_a6 = output2.enumerator) === null || _a6 === void 0 ? void 0 : _a6.enabled) != null) {
198753
198872
  if (output2.enumerator.enabled !== true) {
@@ -198759,18 +198878,31 @@ function validateNumbering(input3, opts) {
198759
198878
  validationWarning("value for 'start' is ignored", enumeratorOpts);
198760
198879
  delete output2.enumerator.start;
198761
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
+ }
198762
198888
  }
198763
198889
  if (defined(value.all)) {
198764
198890
  const allOpts = incrementOptions("all", opts);
198765
198891
  output2.all = validateNumberingItem(value.all, allOpts);
198766
- 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) {
198767
198893
  validationWarning("value for 'template' is ignored", allOpts);
198768
198894
  delete output2.all.template;
198769
198895
  }
198770
- 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) {
198771
198897
  validationWarning("value for 'start' is ignored", allOpts);
198772
198898
  delete output2.all.start;
198773
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));
198774
198906
  }
198775
198907
  if (defined(value.headings)) {
198776
198908
  headings = validateNumberingItem(value.headings, incrementOptions("headings", opts));
@@ -198799,11 +198931,15 @@ function validateNumbering(input3, opts) {
198799
198931
  function fillNumbering(base5, filler) {
198800
198932
  const output2 = { ...filler, ...base5 };
198801
198933
  Object.entries(filler !== null && filler !== void 0 ? filler : {}).filter(([key2]) => !NUMBERING_OPTIONS.includes(key2)).forEach(([key2, val]) => {
198802
- var _a6, _b, _c;
198934
+ var _a6, _b, _c, _d2, _e;
198803
198935
  output2[key2] = fillMissingKeys(
198804
198936
  (_a6 = base5 === null || base5 === void 0 ? void 0 : base5[key2]) !== null && _a6 !== void 0 ? _a6 : {},
198805
198937
  // Enabling/disabling all in base overrides filler
198806
- { ...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
+ },
198807
198943
  NUMBERING_ITEM_KEYS
198808
198944
  );
198809
198945
  });
@@ -199474,6 +199610,11 @@ function validateProjectAndPageFrontmatterKeys(value, opts) {
199474
199610
  if (settings)
199475
199611
  output2.settings = settings;
199476
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
+ }
199477
199618
  return output2;
199478
199619
  }
199479
199620
  function validateProjectFrontmatterKeys(value, opts) {
@@ -199550,6 +199691,9 @@ function validatePageFrontmatterKeys(value, opts) {
199550
199691
  if (defined(value.jupytext)) {
199551
199692
  output2.jupytext = validateJupytext(value.jupytext, incrementOptions("jupytext", opts));
199552
199693
  }
199694
+ if (defined(value.enumerator)) {
199695
+ output2.enumerator = validateString(value.enumerator, incrementOptions("enumerator", opts));
199696
+ }
199553
199697
  if (defined(value.content_includes_title)) {
199554
199698
  output2.content_includes_title = validateBoolean(value.content_includes_title, incrementOptions("content_includes_title", opts));
199555
199699
  }
@@ -203271,11 +203415,16 @@ function createHtmlId(identifier) {
203271
203415
  }
203272
203416
  function transferTargetAttrs(sourceNode, destNode, vfile2) {
203273
203417
  if (sourceNode.label) {
203274
- if (destNode.label && vfile2) {
203418
+ if (destNode.label && vfile2 && destNode.label !== sourceNode.label) {
203275
203419
  fileWarn(vfile2, `label "${destNode.label}" replaced with "${sourceNode.label}"`, {
203276
203420
  node: destNode
203277
203421
  });
203278
203422
  }
203423
+ if (destNode.label && vfile2 && destNode.label === sourceNode.label) {
203424
+ fileWarn(vfile2, `duplicate label "${destNode.label}" replacement`, {
203425
+ node: destNode
203426
+ });
203427
+ }
203279
203428
  destNode.label = sourceNode.label;
203280
203429
  delete sourceNode.label;
203281
203430
  }
@@ -204503,7 +204652,14 @@ var visit = (
204503
204652
 
204504
204653
  // ../myst-common/dist/selectNodes.js
204505
204654
  function isTargetIdentifierNode(node3) {
204506
- const nonTargetTypes = ["crossReference", "cite", "footnoteDefinition", "footnoteReference"];
204655
+ const nonTargetTypes = [
204656
+ "crossReference",
204657
+ "cite",
204658
+ "footnoteDefinition",
204659
+ "footnoteReference",
204660
+ "captionNumber",
204661
+ "link"
204662
+ ];
204507
204663
  return !nonTargetTypes.includes(node3.type);
204508
204664
  }
204509
204665
  var hiddenNodes = /* @__PURE__ */ new Set(["comment", "mystComment"]);
@@ -204602,6 +204758,8 @@ var NotebookCellTags;
204602
204758
  NotebookCellTags2["removeCell"] = "remove-cell";
204603
204759
  NotebookCellTags2["removeInput"] = "remove-input";
204604
204760
  NotebookCellTags2["removeOutput"] = "remove-output";
204761
+ NotebookCellTags2["skipExecution"] = "skip-execution";
204762
+ NotebookCellTags2["raisesException"] = "raises-exception";
204605
204763
  })(NotebookCellTags || (NotebookCellTags = {}));
204606
204764
  var ParseTypesEnum;
204607
204765
  (function(ParseTypesEnum2) {
@@ -222168,6 +222326,12 @@ var defaultHtmlToMdastOptions = {
222168
222326
  attrs.alt = node3.properties.alt;
222169
222327
  return h4(node3, "image", attrs);
222170
222328
  },
222329
+ iframe(h4, node3) {
222330
+ const attrs = addClassAndIdentifier(node3);
222331
+ attrs.src = String(node3.properties.src || "");
222332
+ attrs.width = "100%";
222333
+ return h4(node3, "iframe", attrs);
222334
+ },
222171
222335
  figure(h4, node3) {
222172
222336
  const attrs = addClassAndIdentifier(node3);
222173
222337
  return h4(node3, "container", attrs, all5(h4, node3));
@@ -236886,6 +237050,8 @@ function tryRender(file, node3, value, opts) {
236886
237050
  output: (opts === null || opts === void 0 ? void 0 : opts.mathML) ? "mathml" : void 0,
236887
237051
  macros: { ...builtInMacros, ...simplifiedMacros },
236888
237052
  strict: (f3, m2) => {
237053
+ if (f3 === "newLineInDisplayMode")
237054
+ return;
236889
237055
  warnings2.push(`${f3}, ${m2}`);
236890
237056
  }
236891
237057
  });
@@ -237262,7 +237428,7 @@ function blockToFigureTransform(mdast2, opts) {
237262
237428
  const caption3 = (_d2 = (_b = (_a7 = block5.data) === null || _a7 === void 0 ? void 0 : _a7.caption) !== null && _b !== void 0 ? _b : (_c = block5.data) === null || _c === void 0 ? void 0 : _c["fig-cap"]) !== null && _d2 !== void 0 ? _d2 : (_e = block5.data) === null || _e === void 0 ? void 0 : _e["tbl-cap"];
237263
237429
  if (caption3) {
237264
237430
  const kind = (_g = (_f = block5.data) === null || _f === void 0 ? void 0 : _f.kind) !== null && _g !== void 0 ? _g : ((_h = block5.data) === null || _h === void 0 ? void 0 : _h["tbl-cap"]) ? "table" : "figure";
237265
- const children = (_j = parser3(caption3).children) !== null && _j !== void 0 ? _j : [];
237431
+ const children = typeof caption3 === "string" ? (_j = parser3(caption3).children) !== null && _j !== void 0 ? _j : [] : caption3;
237266
237432
  children.push(...block5.children);
237267
237433
  const container4 = {
237268
237434
  type: "container",
@@ -238278,9 +238444,6 @@ function joinGatesTransform(tree, file) {
238278
238444
  return node3;
238279
238445
  });
238280
238446
  }
238281
- var joinGatesPlugin = () => (tree, file) => {
238282
- joinGatesTransform(tree, file);
238283
- };
238284
238447
 
238285
238448
  // ../myst-transforms/dist/glossary.js
238286
238449
  function glossaryTransform(mdast2, file) {
@@ -238762,12 +238925,12 @@ var DEFAULT_NUMBERING = {
238762
238925
  subfigure: { enabled: true, template: "Figure\xA0%s" },
238763
238926
  table: { enabled: true, template: "Table\xA0%s" },
238764
238927
  code: { enabled: true, template: "Program\xA0%s" },
238765
- heading_1: { enabled: false, template: "Section\xA0%s" },
238766
- heading_2: { enabled: false, template: "Section\xA0%s" },
238767
- heading_3: { enabled: false, template: "Section\xA0%s" },
238768
- heading_4: { enabled: false, template: "Section\xA0%s" },
238769
- heading_5: { enabled: false, template: "Section\xA0%s" },
238770
- 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" }
238771
238934
  };
238772
238935
  function getDefaultNumberedReferenceTemplate(kind) {
238773
238936
  if (kind === "code")
@@ -238788,17 +238951,17 @@ function getDefaultNamedReferenceTemplate(kind = "unknown", hasTitle) {
238788
238951
  return name3;
238789
238952
  }
238790
238953
  }
238791
- function getReferenceTemplate(target, numbering, numbered2, hasTitle) {
238792
- var _a6, _b, _c;
238954
+ function getReferenceTemplate(target, numbering, numbered2, hasTitle, offset) {
238955
+ var _a6, _b, _c, _d2;
238793
238956
  const { kind, node: node3 } = target;
238794
238957
  let template;
238795
238958
  if (numbered2) {
238796
238959
  if (kind === TargetKind.heading && node3.type === "heading") {
238797
- 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;
238798
238961
  } else if (node3.subcontainer) {
238799
- 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;
238800
238963
  } else {
238801
- 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;
238802
238965
  }
238803
238966
  return template !== null && template !== void 0 ? template : getDefaultNumberedReferenceTemplate(kind);
238804
238967
  }
@@ -238867,17 +239030,17 @@ function kindFromNode2(node3) {
238867
239030
  return `${node3.type}:${node3.kind}`;
238868
239031
  return node3.type;
238869
239032
  }
238870
- function shouldEnumerate(node3, kind, numbering) {
238871
- 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;
238872
239035
  if (node3.enumerated != null)
238873
239036
  return node3.enumerated;
238874
239037
  const enabledDefault = (_b = (_a6 = numbering.all) === null || _a6 === void 0 ? void 0 : _a6.enabled) !== null && _b !== void 0 ? _b : false;
238875
239038
  if (kind === "heading" && node3.type === "heading") {
238876
- 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;
238877
239040
  }
238878
239041
  if (node3.subcontainer)
238879
- return (_f = (_e = numbering.subfigure) === null || _e === void 0 ? void 0 : _e.enabled) !== null && _f !== void 0 ? _f : enabledDefault;
238880
- 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;
238881
239044
  }
238882
239045
  function incrementHeadingCounts2(depth, counts) {
238883
239046
  const incrementIndex = depth - 1;
@@ -238898,19 +239061,28 @@ function formatHeadingEnumerator2(counts, prefix2) {
238898
239061
  const out = prefix2 ? prefix2.replace(/%s/g, String(enumerator)) : String(enumerator);
238899
239062
  return out;
238900
239063
  }
238901
- function initializeTargetCounts(numbering, initialCounts, tree) {
238902
- let heading6;
238903
- if (initialCounts === null || initialCounts === void 0 ? void 0 : initialCounts.heading) {
238904
- heading6 = [...initialCounts.heading];
238905
- } else if (tree) {
238906
- const headingNodes = selectAll("heading", tree).filter((node3) => node3.enumerated !== false);
238907
- const headingDepths = new Set(headingNodes.map((node3) => node3.depth));
238908
- heading6 = [1, 2, 3, 4, 5, 6].map((depth) => headingDepths.has(depth) ? 0 : null);
238909
- } else {
238910
- heading6 = [0, 0, 0, 0, 0, 0];
238911
- }
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
+ });
238912
239081
  const targetCounts = { heading: heading6 };
238913
- 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]) => {
238914
239086
  targetCounts[key2] = { ...val };
238915
239087
  });
238916
239088
  Object.entries(numbering).forEach(([key2, val]) => {
@@ -238929,24 +239101,28 @@ function initializeTargetCounts(numbering, initialCounts, tree) {
238929
239101
  }
238930
239102
  var ReferenceState = class {
238931
239103
  constructor(filePath, opts) {
238932
- var _a6, _b;
238933
- this.numbering = fillNumbering(opts === null || opts === void 0 ? void 0 : opts.numbering, DEFAULT_NUMBERING);
238934
- this.initialCounts = opts === null || opts === void 0 ? void 0 : opts.targetCounts;
238935
- this.targetCounts = initializeTargetCounts(this.numbering, this.initialCounts);
238936
- 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 : [];
238937
239113
  this.targets = {};
238938
- 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();
238939
239115
  this.filePath = filePath;
238940
239116
  this.url = opts === null || opts === void 0 ? void 0 : opts.url;
238941
239117
  this.dataUrl = opts === null || opts === void 0 ? void 0 : opts.dataUrl;
238942
- 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;
238943
239119
  }
238944
239120
  addTarget(node3) {
238945
239121
  if (!isTargetIdentifierNode(node3))
238946
239122
  return;
238947
239123
  const kind = kindFromNode2(node3);
238948
- const numberNode = shouldEnumerate(node3, kind, this.numbering);
238949
- if (numberNode && !node3.enumerator) {
239124
+ const numberNode = shouldEnumerateNode(node3, kind, this.numbering, this.offset);
239125
+ if (numberNode) {
238950
239126
  this.incrementCount(node3, kind);
238951
239127
  }
238952
239128
  if (!node3.html_id) {
@@ -238971,8 +239147,10 @@ var ReferenceState = class {
238971
239147
  kind
238972
239148
  };
238973
239149
  }
238974
- initializeNumberedTargetCounts(tree) {
238975
- 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);
238976
239154
  }
238977
239155
  /**
238978
239156
  * Increment target count state for container/equation nodes
@@ -238982,38 +239160,33 @@ var ReferenceState = class {
238982
239160
  * If node is subcontainer/subequation, a sub-count is incremented
238983
239161
  */
238984
239162
  incrementCount(node3, kind) {
238985
- var _a6, _b;
238986
- var _c;
239163
+ var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l;
239164
+ var _m;
238987
239165
  if (node3.enumerator) {
238988
239166
  return node3.enumerator;
238989
239167
  }
238990
239168
  let enumerator;
238991
239169
  if (kind === TargetKind.heading && node3.type === "heading") {
238992
- this.targetCounts.heading = incrementHeadingCounts2(node3.depth, this.targetCounts.heading);
238993
- 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);
238994
239172
  node3.enumerator = enumerator;
238995
239173
  return enumerator;
238996
239174
  }
238997
- const resolveEnumerator = (val) => {
238998
- var _a7;
238999
- const prefix2 = (_a7 = this.numbering.enumerator) === null || _a7 === void 0 ? void 0 : _a7.template;
239000
- return prefix2 ? prefix2.replace(/%s/g, String(val)) : String(val);
239001
- };
239002
239175
  const countKind = kind === TargetKind.subequation ? TargetKind.equation : kind;
239003
- (_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 };
239004
239177
  if (node3.subcontainer || kind === TargetKind.subequation) {
239005
239178
  this.targetCounts[countKind].sub += 1;
239006
239179
  const letter = String.fromCharCode((this.targetCounts[countKind].sub - 1) % 26 + "a".charCodeAt(0));
239007
239180
  if (node3.subcontainer) {
239008
- 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);
239009
239182
  enumerator = letter;
239010
239183
  } else {
239011
- 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);
239012
239185
  }
239013
239186
  } else {
239014
239187
  this.targetCounts[kind].main += 1;
239015
239188
  this.targetCounts[kind].sub = 0;
239016
- 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);
239017
239190
  }
239018
239191
  node3.enumerator = enumerator;
239019
239192
  return enumerator;
@@ -239062,17 +239235,17 @@ var ReferenceState = class {
239062
239235
  return;
239063
239236
  }
239064
239237
  node3.kind = target.kind;
239065
- addChildrenFromTargetNode(node3, target.node, this.numbering, this.vfile);
239238
+ addChildrenFromTargetNode(node3, target.node, this.numbering, this.vfile, this.offset);
239066
239239
  }
239067
239240
  };
239068
- function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
239241
+ function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2, offset) {
239069
239242
  var _a6, _b, _c, _d2, _e;
239070
239243
  numbering = fillNumbering(numbering, DEFAULT_NUMBERING);
239071
239244
  const kind = kindFromNode2(targetNode);
239072
239245
  const noNodeChildren = !((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length);
239073
239246
  if (kind === TargetKind.heading) {
239074
- const numberHeading = shouldEnumerate(targetNode, TargetKind.heading, numbering);
239075
- 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);
239076
239249
  fillReferenceEnumerators2(vfile2, node3, template, targetNode, copyNode(targetNode).children);
239077
239250
  } else {
239078
239251
  const caption3 = select("caption", targetNode) || select("admonitionTitle", targetNode) || select("definitionTerm", targetNode);
@@ -239081,7 +239254,7 @@ function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
239081
239254
  if (title && node3.kind === ReferenceKind2.ref && noNodeChildren) {
239082
239255
  node3.children = title;
239083
239256
  }
239084
- const template = getReferenceTemplate({ node: targetNode, kind }, numbering, !!targetNode.enumerator, !!title);
239257
+ const template = getReferenceTemplate({ node: targetNode, kind }, numbering, !!targetNode.enumerator, !!title, offset);
239085
239258
  fillReferenceEnumerators2(vfile2, node3, template, targetNode, title);
239086
239259
  }
239087
239260
  node3.resolved = true;
@@ -239143,8 +239316,9 @@ var MultiPageReferenceResolver = class {
239143
239316
  }
239144
239317
  };
239145
239318
  var enumerateTargetsTransform = (tree, opts) => {
239146
- opts.state.initializeNumberedTargetCounts(tree);
239147
239319
  visit(tree, (node3) => {
239320
+ if (!isTargetIdentifierNode(node3))
239321
+ return;
239148
239322
  if (node3.identifier || node3.enumerated || ["container", "mathGroup", "math", "heading", "proof"].includes(node3.type)) {
239149
239323
  opts.state.addTarget(node3);
239150
239324
  }
@@ -239164,9 +239338,6 @@ var enumerateTargetsTransform = (tree, opts) => {
239164
239338
  });
239165
239339
  return tree;
239166
239340
  };
239167
- var enumerateTargetsPlugin = (opts) => (tree) => {
239168
- enumerateTargetsTransform(tree, opts);
239169
- };
239170
239341
  function getCaptionLabel(kind, subcontainer) {
239171
239342
  if (subcontainer && (kind === "equation" || kind === "subequation"))
239172
239343
  return `(%s)`;
@@ -239189,7 +239360,10 @@ function addContainerCaptionNumbersTransform(tree, file, opts) {
239189
239360
  para = { type: "paragraph", children: [] };
239190
239361
  container4.children.push({ type: "caption", children: [para] });
239191
239362
  }
239192
- 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) {
239193
239367
  const captionNumber3 = {
239194
239368
  type: "captionNumber",
239195
239369
  kind: container4.kind,
@@ -239346,6 +239520,7 @@ function basicTransformations(tree, file, opts) {
239346
239520
  headingLabelTransform(tree);
239347
239521
  admonitionBlockquoteTransform(tree);
239348
239522
  admonitionHeadersTransform(tree);
239523
+ joinGatesTransform(tree, file);
239349
239524
  blockNestingTransform(tree);
239350
239525
  blockMetadataTransform(tree, file);
239351
239526
  blockToFigureTransform(tree, opts);
@@ -241959,8 +242134,6 @@ function castSession(session) {
241959
242134
  cache.$citationRenderers = {};
241960
242135
  if (!cache.$doiRenderers)
241961
242136
  cache.$doiRenderers = {};
241962
- if (!cache.$internalReferences)
241963
- cache.$internalReferences = {};
241964
242137
  if (!cache.$externalReferences)
241965
242138
  cache.$externalReferences = {};
241966
242139
  if (!cache.$mdast)
@@ -281868,6 +282041,10 @@ var codeCellDirective = {
281868
282041
  },
281869
282042
  options: {
281870
282043
  ...commonDirectiveOptions("code-cell"),
282044
+ caption: {
282045
+ type: "myst",
282046
+ doc: "A parsed caption for the code output."
282047
+ },
281871
282048
  tags: {
281872
282049
  type: String,
281873
282050
  alias: ["tag"],
@@ -281879,7 +282056,7 @@ var codeCellDirective = {
281879
282056
  doc: "The code to be executed and displayed."
281880
282057
  },
281881
282058
  run(data, vfile2) {
281882
- var _a6, _b;
282059
+ var _a6, _b, _c;
281883
282060
  const code7 = {
281884
282061
  type: "code",
281885
282062
  lang: data.arg,
@@ -281898,7 +282075,10 @@ var codeCellDirective = {
281898
282075
  data: {}
281899
282076
  };
281900
282077
  addCommonDirectiveOptions(data, block5);
281901
- const tags = parseTags((_b = data.options) === null || _b === void 0 ? void 0 : _b.tags, vfile2, data.node);
282078
+ if ((_b = data.options) === null || _b === void 0 ? void 0 : _b.caption) {
282079
+ block5.data.caption = [{ type: "paragraph", children: data.options.caption }];
282080
+ }
282081
+ const tags = parseTags((_c = data.options) === null || _c === void 0 ? void 0 : _c.tags, vfile2, data.node);
281902
282082
  if (tags)
281903
282083
  block5.data.tags = tags;
281904
282084
  return [block5];
@@ -282127,14 +282307,14 @@ var iframeDirective = {
282127
282307
  body: { type: "myst", doc: "If provided, this will be the iframe caption." },
282128
282308
  run(data) {
282129
282309
  var _a6, _b, _c, _d2, _e, _f, _g;
282130
- const iframe3 = {
282310
+ const iframe4 = {
282131
282311
  type: "iframe",
282132
282312
  src: data.arg,
282133
282313
  width: (_a6 = data.options) === null || _a6 === void 0 ? void 0 : _a6.width,
282134
282314
  align: (_b = data.options) === null || _b === void 0 ? void 0 : _b.align
282135
282315
  };
282136
282316
  if ((_c = data.options) === null || _c === void 0 ? void 0 : _c.placeholder) {
282137
- iframe3.children = [
282317
+ iframe4.children = [
282138
282318
  {
282139
282319
  type: "image",
282140
282320
  placeholder: true,
@@ -282147,13 +282327,13 @@ var iframeDirective = {
282147
282327
  ];
282148
282328
  }
282149
282329
  if (!data.body) {
282150
- addCommonDirectiveOptions(data, iframe3);
282151
- return [iframe3];
282330
+ addCommonDirectiveOptions(data, iframe4);
282331
+ return [iframe4];
282152
282332
  }
282153
282333
  const container4 = {
282154
282334
  type: "container",
282155
282335
  kind: "figure",
282156
- children: [iframe3, { type: "caption", children: data.body }]
282336
+ children: [iframe4, { type: "caption", children: data.body }]
282157
282337
  };
282158
282338
  addCommonDirectiveOptions(data, container4);
282159
282339
  return [container4];
@@ -285701,13 +285881,13 @@ var asideDirective = {
285701
285881
  children: data.arg
285702
285882
  });
285703
285883
  }
285704
- const aside = {
285884
+ const aside2 = {
285705
285885
  type: "aside",
285706
285886
  kind: data.name == "aside" || data.name == "margin" ? void 0 : data.name,
285707
285887
  children
285708
285888
  };
285709
- addCommonDirectiveOptions(data, aside);
285710
- return [aside];
285889
+ addCommonDirectiveOptions(data, aside2);
285890
+ return [aside2];
285711
285891
  }
285712
285892
  };
285713
285893
 
@@ -287777,7 +287957,7 @@ var MARKDOWN_IT_CONFIG = {
287777
287957
  }
287778
287958
  }
287779
287959
  };
287780
- var EXCLUDE_TLDS = ["py", "md", "dot", "next", "so"];
287960
+ var EXCLUDE_TLDS = ["py", "md", "dot", "next", "so", "es"];
287781
287961
 
287782
287962
  // ../myst-parser/dist/tokensToMyst.js
287783
287963
  var import_he = __toESM(require_he(), 1);
@@ -288161,10 +288341,11 @@ var defaultMdast = {
288161
288341
  math_inline_double: {
288162
288342
  type: "math",
288163
288343
  noCloseToken: true,
288164
- isText: true,
288344
+ isLeaf: true,
288165
288345
  getAttrs(t2) {
288166
288346
  var _a6;
288167
288347
  return {
288348
+ value: t2.content.trim(),
288168
288349
  enumerated: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.enumerated
288169
288350
  };
288170
288351
  }
@@ -288172,11 +288353,12 @@ var defaultMdast = {
288172
288353
  math_block: {
288173
288354
  type: "math",
288174
288355
  noCloseToken: true,
288175
- isText: true,
288356
+ isLeaf: true,
288176
288357
  getAttrs(t2) {
288177
288358
  var _a6;
288178
288359
  const name3 = t2.info || void 0;
288179
288360
  return {
288361
+ value: t2.content.trim(),
288180
288362
  ...normalizeLabel(name3),
288181
288363
  enumerated: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.enumerated
288182
288364
  };
@@ -288185,11 +288367,12 @@ var defaultMdast = {
288185
288367
  math_block_label: {
288186
288368
  type: "math",
288187
288369
  noCloseToken: true,
288188
- isText: true,
288370
+ isLeaf: true,
288189
288371
  getAttrs(t2) {
288190
288372
  var _a6;
288191
288373
  const name3 = t2.info || void 0;
288192
288374
  return {
288375
+ value: t2.content.trim(),
288193
288376
  ...normalizeLabel(name3),
288194
288377
  enumerated: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.enumerated
288195
288378
  };
@@ -288198,11 +288381,12 @@ var defaultMdast = {
288198
288381
  amsmath: {
288199
288382
  type: "math",
288200
288383
  noCloseToken: true,
288201
- isText: true,
288384
+ isLeaf: true,
288202
288385
  getAttrs(t2, tokens, index4, state) {
288203
288386
  var _a6;
288204
288387
  const tight = computeAmsmathTightness(state.src, t2.map);
288205
288388
  const attrs = {
288389
+ value: t2.content.trim(),
288206
288390
  enumerated: (_a6 = t2.meta) === null || _a6 === void 0 ? void 0 : _a6.enumerated
288207
288391
  };
288208
288392
  if (tight)
@@ -289247,63 +289431,6 @@ var exerciseDirectives = [
289247
289431
  solutionEndDirective
289248
289432
  ];
289249
289433
 
289250
- // ../myst-ext-reactive/dist/index.js
289251
- var reactiveRole = {
289252
- name: "r:range",
289253
- alias: ["r:dynamic", "r:display"],
289254
- body: {
289255
- type: String,
289256
- required: true
289257
- },
289258
- run(data) {
289259
- const parsedContent = Object.fromEntries(data.body.split('", ').map((part) => {
289260
- const [name3, value] = part.replace(/",?\s?$/, "").split('="');
289261
- if (name3.startsWith("r")) {
289262
- const transformed = `${name3.slice(1).toLowerCase()}Function`;
289263
- return [transformed, value];
289264
- }
289265
- return [name3, value];
289266
- }));
289267
- return [
289268
- {
289269
- type: data.name,
289270
- ...parsedContent
289271
- }
289272
- ];
289273
- }
289274
- };
289275
- var reactiveDirective = {
289276
- name: "r:var",
289277
- options: {
289278
- name: {
289279
- type: String,
289280
- required: true
289281
- },
289282
- value: {
289283
- type: String
289284
- },
289285
- rValue: {
289286
- type: String
289287
- },
289288
- format: {
289289
- type: String
289290
- }
289291
- },
289292
- run(data) {
289293
- var _a6;
289294
- const { name: name3, value, rValue, format } = (_a6 = data.options) !== null && _a6 !== void 0 ? _a6 : {};
289295
- return [
289296
- {
289297
- type: "r:var",
289298
- name: name3,
289299
- value,
289300
- valueFunction: rValue,
289301
- format
289302
- }
289303
- ];
289304
- }
289305
- };
289306
-
289307
289434
  // ../myst-ext-tabs/dist/index.js
289308
289435
  var tabSetDirective = {
289309
289436
  name: "tab-set",
@@ -289367,7 +289494,6 @@ function parseMyst(session, content3, file, opts) {
289367
289494
  directives: [
289368
289495
  cardDirective,
289369
289496
  ...gridDirectives,
289370
- reactiveDirective,
289371
289497
  proofDirective,
289372
289498
  ...exerciseDirectives,
289373
289499
  ...tabDirectives,
@@ -289376,7 +289502,7 @@ function parseMyst(session, content3, file, opts) {
289376
289502
  extensions: {
289377
289503
  frontmatter: !(opts === null || opts === void 0 ? void 0 : opts.ignoreFrontmatter)
289378
289504
  },
289379
- roles: [reactiveRole, ...(_d2 = (_c = session.plugins) === null || _c === void 0 ? void 0 : _c.roles) !== null && _d2 !== void 0 ? _d2 : []],
289505
+ roles: [...(_d2 = (_c = session.plugins) === null || _c === void 0 ? void 0 : _c.roles) !== null && _d2 !== void 0 ? _d2 : []],
289380
289506
  vfile: vfile2
289381
289507
  });
289382
289508
  logMessagesFromVFile(session, vfile2);
@@ -289393,7 +289519,7 @@ var import_node_path16 = __toESM(require("path"), 1);
289393
289519
  var import_nbtx = __toESM(require_cjs2(), 1);
289394
289520
 
289395
289521
  // ../myst-cli/dist/version.js
289396
- var version2 = "1.3.19";
289522
+ var version2 = "1.3.21";
289397
289523
  var version_default2 = version2;
289398
289524
 
289399
289525
  // ../myst-cli/dist/utils/headers.js
@@ -289712,6 +289838,26 @@ function isWhiteLabelled() {
289712
289838
  return ["MYSTMD_READABLE_NAME", "MYSTMD_BINARY_NAME"].some((name3) => name3 in process.env);
289713
289839
  }
289714
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
+
289715
289861
  // ../myst-cli/dist/utils/ffmpeg.js
289716
289862
  var ffmpeg_exports = {};
289717
289863
  __export(ffmpeg_exports, {
@@ -292500,10 +292646,10 @@ var Minimatch = class {
292500
292646
  let ai = 0;
292501
292647
  let bi = 0;
292502
292648
  let result = [];
292503
- let which7 = "";
292649
+ let which8 = "";
292504
292650
  while (ai < a2.length && bi < b.length) {
292505
292651
  if (a2[ai] === b[bi]) {
292506
- result.push(which7 === "b" ? b[bi] : a2[ai]);
292652
+ result.push(which8 === "b" ? b[bi] : a2[ai]);
292507
292653
  ai++;
292508
292654
  bi++;
292509
292655
  } else if (emptyGSMatch && a2[ai] === "**" && b[bi] === a2[ai + 1]) {
@@ -292513,16 +292659,16 @@ var Minimatch = class {
292513
292659
  result.push(b[bi]);
292514
292660
  bi++;
292515
292661
  } else if (a2[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
292516
- if (which7 === "b")
292662
+ if (which8 === "b")
292517
292663
  return false;
292518
- which7 = "a";
292664
+ which8 = "a";
292519
292665
  result.push(a2[ai]);
292520
292666
  ai++;
292521
292667
  bi++;
292522
292668
  } else if (b[bi] === "*" && a2[ai] && (this.options.dot || !a2[ai].startsWith(".")) && a2[ai] !== "**") {
292523
- if (which7 === "a")
292669
+ if (which8 === "a")
292524
292670
  return false;
292525
- which7 = "b";
292671
+ which8 = "b";
292526
292672
  result.push(b[bi]);
292527
292673
  ai++;
292528
292674
  bi++;
@@ -301295,6 +301441,7 @@ async function resolvePageDownloads(session, file, projectPath) {
301295
301441
  return resolvedDownloads;
301296
301442
  }
301297
301443
  async function localToManifestProject(session, projectPath, projectSlug) {
301444
+ var _a6, _b;
301298
301445
  if (!projectPath)
301299
301446
  return null;
301300
301447
  const state = session.store.getState();
@@ -301302,23 +301449,25 @@ async function localToManifestProject(session, projectPath, projectSlug) {
301302
301449
  const proj = selectors_exports.selectLocalProject(state, projectPath);
301303
301450
  if (!proj)
301304
301451
  return null;
301305
- const { index: index4 } = proj;
301452
+ const { index: index4, file: indexFile } = proj;
301306
301453
  const projectFileInfo = selectors_exports.selectFileInfo(state, proj.file);
301307
301454
  const projectTitle = (projConfig === null || projConfig === void 0 ? void 0 : projConfig.title) || projectFileInfo.title || proj.index;
301455
+ const cache = castSession(session);
301308
301456
  const pages = await Promise.all(proj.pages.map(async (page) => {
301309
- var _a6, _b, _c, _d2, _e, _f, _g, _h;
301457
+ var _a7, _b2, _c, _d2, _e, _f, _g, _h, _j, _k;
301310
301458
  if ("file" in page) {
301311
301459
  const fileInfo3 = selectors_exports.selectFileInfo(state, page.file);
301312
301460
  const title = fileInfo3.title || fileTitle(page.file);
301313
- const short_title = (_a6 = fileInfo3.short_title) !== null && _a6 !== void 0 ? _a6 : void 0;
301314
- const description = (_b = fileInfo3.description) !== null && _b !== void 0 ? _b : "";
301461
+ const short_title = (_a7 = fileInfo3.short_title) !== null && _a7 !== void 0 ? _a7 : void 0;
301462
+ const description = (_b2 = fileInfo3.description) !== null && _b2 !== void 0 ? _b2 : "";
301315
301463
  const thumbnail2 = (_c = fileInfo3.thumbnail) !== null && _c !== void 0 ? _c : "";
301316
301464
  const thumbnailOptimized = (_d2 = fileInfo3.thumbnailOptimized) !== null && _d2 !== void 0 ? _d2 : "";
301317
301465
  const banner2 = (_e = fileInfo3.banner) !== null && _e !== void 0 ? _e : "";
301318
301466
  const bannerOptimized = (_f = fileInfo3.bannerOptimized) !== null && _f !== void 0 ? _f : "";
301319
301467
  const date = (_g = fileInfo3.date) !== null && _g !== void 0 ? _g : "";
301320
301468
  const tags = (_h = fileInfo3.tags) !== null && _h !== void 0 ? _h : [];
301321
- const { slug, level } = page;
301469
+ const { slug, level, file } = page;
301470
+ const { frontmatter: frontmatter2 } = (_k = (_j = cache.$getMdast(file)) === null || _j === void 0 ? void 0 : _j.post) !== null && _k !== void 0 ? _k : {};
301322
301471
  const projectPage = {
301323
301472
  slug,
301324
301473
  title,
@@ -301330,7 +301479,8 @@ async function localToManifestProject(session, projectPath, projectSlug) {
301330
301479
  banner: banner2,
301331
301480
  bannerOptimized,
301332
301481
  tags,
301333
- level
301482
+ level,
301483
+ enumerator: frontmatter2 === null || frontmatter2 === void 0 ? void 0 : frontmatter2.enumerator
301334
301484
  };
301335
301485
  return projectPage;
301336
301486
  }
@@ -301343,6 +301493,7 @@ async function localToManifestProject(session, projectPath, projectSlug) {
301343
301493
  const parts = resolveFrontmatterParts(session, projFrontmatter);
301344
301494
  const banner = await transformBanner(session, import_node_path29.default.join(projectPath, "myst.yml"), projFrontmatter, session.publicPath(), { altOutputFolder: "/", webp: true });
301345
301495
  const thumbnail = await transformThumbnail(session, null, import_node_path29.default.join(projectPath, "myst.yml"), projFrontmatter, session.publicPath(), { altOutputFolder: "/", webp: true });
301496
+ const { frontmatter } = (_b = (_a6 = cache.$getMdast(indexFile)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
301346
301497
  return {
301347
301498
  ...projFrontmatter,
301348
301499
  // TODO: a null in the project frontmatter should not fall back to index page
@@ -301358,6 +301509,7 @@ async function localToManifestProject(session, projectPath, projectSlug) {
301358
301509
  title: projectTitle || "Untitled",
301359
301510
  slug: projectSlug,
301360
301511
  index: index4,
301512
+ enumerator: frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.enumerator,
301361
301513
  pages
301362
301514
  };
301363
301515
  }
@@ -301720,7 +301872,7 @@ async function transformMystXRefs(session, vfile2, mdast2, frontmatter) {
301720
301872
  let number2 = 0;
301721
301873
  await Promise.all([
301722
301874
  ...nodes.map(async (node3) => {
301723
- var _a6, _b, _c;
301875
+ var _a6, _b, _c, _d2, _e;
301724
301876
  if (!node3.identifier) {
301725
301877
  const data = await fetchMystLinkData(session, node3, vfile2);
301726
301878
  if (!data)
@@ -301735,7 +301887,7 @@ async function transformMystXRefs(session, vfile2, mdast2, frontmatter) {
301735
301887
  maxNodes: 1
301736
301888
  });
301737
301889
  if (targets === null || targets === void 0 ? void 0 : targets.length) {
301738
- addChildrenFromTargetNode(node3, targets[0], frontmatter.numbering, vfile2);
301890
+ 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);
301739
301891
  }
301740
301892
  }
301741
301893
  number2 += 1;
@@ -303127,6 +303279,10 @@ function reduceOutputs(session, mdast2, file, writeFolder, opts) {
303127
303279
  const cache = castSession(session);
303128
303280
  outputs.forEach((node3) => {
303129
303281
  var _a6, _b, _c;
303282
+ if (node3.visibility === "remove" || node3.visibility === "hide") {
303283
+ node3.type = "__delete__";
303284
+ return;
303285
+ }
303130
303286
  if (!((_a6 = node3.data) === null || _a6 === void 0 ? void 0 : _a6.length) && !((_b = node3.children) === null || _b === void 0 ? void 0 : _b.length)) {
303131
303287
  node3.type = "__delete__";
303132
303288
  return;
@@ -303169,6 +303325,9 @@ function reduceOutputs(session, mdast2, file, writeFolder, opts) {
303169
303325
  ]
303170
303326
  };
303171
303327
  htmlTransform(htmlTree);
303328
+ if (selectAll("image", htmlTree).find((htmlImage) => !htmlImage.url)) {
303329
+ return void 0;
303330
+ }
303172
303331
  return htmlTree.children;
303173
303332
  } else if (content_type.startsWith("image/")) {
303174
303333
  const path44 = writeCachedOutputToFile(session, hash, cache.$outputs[hash], writeFolder, {
@@ -303287,11 +303446,11 @@ function isCellBlock(node3) {
303287
303446
  }
303288
303447
  function codeBlockRaisesException(node3) {
303289
303448
  var _a6, _b, _c;
303290
- 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"));
303449
+ 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, NotebookCellTags.raisesException));
303291
303450
  }
303292
303451
  function codeBlockSkipsExecution(node3) {
303293
303452
  var _a6, _b, _c;
303294
- 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"));
303453
+ 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, NotebookCellTags.skipExecution));
303295
303454
  }
303296
303455
  function isInlineExpression(node3) {
303297
303456
  return node3.type === "inlineExpression";
@@ -303402,7 +303561,6 @@ async function kernelExecutionTransform(tree, vfile2, opts) {
303402
303561
  // ../myst-execute/dist/manager.js
303403
303562
  var import_which4 = __toESM(require_lib16(), 1);
303404
303563
  var import_node_child_process = require("child_process");
303405
- var readline = __toESM(require("readline"), 1);
303406
303564
 
303407
303565
  // ../myst-execute/node_modules/chalk/source/vendor/ansi-styles/index.js
303408
303566
  var ANSI_BACKGROUND_OFFSET3 = 10;
@@ -303894,36 +304052,6 @@ var chalkStderr3 = createChalk3({ level: stderrColor3 ? stderrColor3.level : 0 }
303894
304052
  var source_default3 = chalk3;
303895
304053
 
303896
304054
  // ../myst-execute/dist/manager.js
303897
- async function findExistingJupyterServer(session) {
303898
- const pythonPath = import_which4.default.sync("python");
303899
- const listProc = (0, import_node_child_process.spawn)(pythonPath, ["-m", "jupyter_server", "list", "--json"]);
303900
- const reader = readline.createInterface({ input: listProc.stdout });
303901
- const servers = [];
303902
- for await (const line2 of reader) {
303903
- let server;
303904
- try {
303905
- server = JSON.parse(line2);
303906
- } catch {
303907
- }
303908
- if ((server === null || server === void 0 ? void 0 : server.base_url) !== void 0) {
303909
- servers.push(server);
303910
- }
303911
- }
303912
- if (!servers.length) {
303913
- return void 0;
303914
- }
303915
- servers.sort((a2, b) => a2.pid - b.pid);
303916
- for (const entry of servers) {
303917
- const response = await session.fetch(`${entry.url}?token=${entry.token}`);
303918
- if (response.ok) {
303919
- return {
303920
- baseUrl: entry.url,
303921
- token: entry.token
303922
- };
303923
- }
303924
- }
303925
- return void 0;
303926
- }
303927
304055
  async function launchJupyterServer(contentPath, log) {
303928
304056
  log.info(`\u{1F680} ${source_default3.yellowBright("Starting new Jupyter server")}`);
303929
304057
  const pythonPath = import_which4.default.sync("python");
@@ -304019,6 +304147,33 @@ async function rawDirectiveTransform(tree, vfile2) {
304019
304147
  });
304020
304148
  }
304021
304149
 
304150
+ // ../myst-cli/dist/utils/addEditUrl.js
304151
+ var import_which5 = __toESM(require_lib15(), 1);
304152
+ function gitCommandAvailable() {
304153
+ return !!import_which5.default.sync("git", { nothrow: true });
304154
+ }
304155
+ async function addEditUrl(session, frontmatter, file) {
304156
+ if (!frontmatter.github)
304157
+ return;
304158
+ if (frontmatter.edit_url || frontmatter.edit_url === null)
304159
+ return;
304160
+ if (!gitCommandAvailable())
304161
+ return;
304162
+ try {
304163
+ const gitLog = silentLogger();
304164
+ const getGitBranch = makeExecutable("git rev-parse --abbrev-ref HEAD", gitLog);
304165
+ const gitBranch = (await getGitBranch()).trim();
304166
+ const getGitRoot = makeExecutable("git rev-parse --show-toplevel", gitLog);
304167
+ const gitRoot = (await getGitRoot()).trim();
304168
+ if (gitBranch && gitRoot && file.startsWith(gitRoot)) {
304169
+ frontmatter.edit_url = `${frontmatter.github}/blob/${gitBranch}${file.replace(gitRoot, "")}`;
304170
+ session.log.debug(`Added edit URL ${frontmatter.edit_url} to ${file}`);
304171
+ }
304172
+ } catch {
304173
+ session.log.debug(`Unable to add edit URL to ${file}`);
304174
+ }
304175
+ }
304176
+
304022
304177
  // ../myst-cli/dist/process/mdast.js
304023
304178
  var LINKS_SELECTOR = "link,card,linkBlock";
304024
304179
  var pluginUtils = { select, selectAll };
@@ -304029,17 +304184,24 @@ var htmlHandlers = {
304029
304184
  return result;
304030
304185
  }
304031
304186
  };
304032
- function referenceFileFromPartFile(session, partFile) {
304033
- const state = session.store.getState();
304034
- const partDeps = selectors_exports.selectDependentFiles(state, partFile);
304035
- if (partDeps.length > 0)
304036
- return partDeps[0];
304037
- const file = selectors_exports.selectFileFromPart(state, partFile);
304038
- return file !== null && file !== void 0 ? file : partFile;
304039
- }
304040
304187
  async function transformMdast(session, opts) {
304041
304188
  var _a6, _b, _c, _d2;
304042
- const { file, projectPath, pageSlug, projectSlug, imageExtensions, extraTransforms, watchMode = false, minifyMaxCharacters, index: index4, titleDepth, execute } = opts;
304189
+ const {
304190
+ file,
304191
+ projectPath,
304192
+ pageSlug,
304193
+ projectSlug,
304194
+ imageExtensions,
304195
+ extraTransforms,
304196
+ watchMode = false,
304197
+ minifyMaxCharacters,
304198
+ index: index4,
304199
+ titleDepth,
304200
+ // Related to title set in markdown, rather than frontmatter
304201
+ offset,
304202
+ // Related to multi-page nesting
304203
+ execute
304204
+ } = opts;
304043
304205
  const toc = tic();
304044
304206
  const { store, log } = session;
304045
304207
  const cache = castSession(session);
@@ -304063,16 +304225,18 @@ async function transformMdast(session, opts) {
304063
304225
  fileWarn(vfile2, message, { ruleId: RuleId.validPageFrontmatter });
304064
304226
  }
304065
304227
  }, projectPath);
304228
+ if (offset) {
304229
+ if (!frontmatter.numbering)
304230
+ frontmatter.numbering = {};
304231
+ if (!frontmatter.numbering.title)
304232
+ frontmatter.numbering.title = {};
304233
+ if (frontmatter.numbering.title.offset == null)
304234
+ frontmatter.numbering.title.offset = offset;
304235
+ }
304236
+ await addEditUrl(session, frontmatter, file);
304066
304237
  const references = {
304067
304238
  cite: { order: [], data: {} }
304068
304239
  };
304069
- const refFile = kind === SourceFileKind.Part ? referenceFileFromPartFile(session, file) : file;
304070
- const state = new ReferenceState(refFile, {
304071
- numbering: frontmatter.numbering,
304072
- identifiers,
304073
- vfile: vfile2
304074
- });
304075
- cache.$internalReferences[file] = state;
304076
304240
  importMdastFromJson(session, file, mdast2);
304077
304241
  await includeFilesTransform(session, file, mdast2, frontmatter, vfile2);
304078
304242
  rawDirectiveTransform(mdast2, vfile2);
@@ -304080,12 +304244,13 @@ async function transformMdast(session, opts) {
304080
304244
  const pipe = unified().use(reconstructHtmlPlugin).use(htmlPlugin, { htmlHandlers }).use(basicTransformationsPlugin, {
304081
304245
  parser: (content3) => parseMyst(session, content3, file),
304082
304246
  firstDepth: (titleDepth !== null && titleDepth !== void 0 ? titleDepth : 1) + (frontmatter.content_includes_title ? 0 : 1)
304083
- }).use(inlineMathSimplificationPlugin).use(mathPlugin, { macros: frontmatter.math }).use(glossaryPlugin).use(abbreviationPlugin, { abbreviations: frontmatter.abbreviations }).use(indexIdentifierPlugin).use(enumerateTargetsPlugin, { state }).use(joinGatesPlugin);
304247
+ }).use(inlineMathSimplificationPlugin).use(mathPlugin, { macros: frontmatter.math });
304084
304248
  (_c = session.plugins) === null || _c === void 0 ? void 0 : _c.transforms.forEach((t2) => {
304085
304249
  if (t2.stage !== "document")
304086
304250
  return;
304087
304251
  pipe.use(t2.plugin, void 0, pluginUtils);
304088
304252
  });
304253
+ pipe.use(glossaryPlugin).use(abbreviationPlugin, { abbreviations: frontmatter.abbreviations }).use(indexIdentifierPlugin);
304089
304254
  await pipe.run(mdast2, vfile2);
304090
304255
  propagateBlockDataToCode(session, vfile2, mdast2);
304091
304256
  cache.$citationRenderers[file] = await transformLinkedDOIs(session, vfile2, mdast2, cache.$doiRenderers, file);
@@ -304142,6 +304307,7 @@ async function transformMdast(session, opts) {
304142
304307
  frontmatter,
304143
304308
  mdast: mdast2,
304144
304309
  references,
304310
+ identifiers,
304145
304311
  widgets
304146
304312
  };
304147
304313
  const cachedMdast = cache.$getMdast(file);
@@ -304167,8 +304333,7 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
304167
304333
  const vfile2 = new VFile();
304168
304334
  vfile2.path = file;
304169
304335
  const { mdast: mdast2, dependencies, frontmatter } = mdastPost;
304170
- const fileState = cache.$internalReferences[file];
304171
- const state = pageReferenceStates ? new MultiPageReferenceResolver(pageReferenceStates, file, vfile2) : fileState;
304336
+ const state = new MultiPageReferenceResolver(pageReferenceStates, file, vfile2);
304172
304337
  const externalReferences = Object.values(cache.$externalReferences);
304173
304338
  const transformers = [
304174
304339
  ...extraLinkTransformers || [],
@@ -304184,12 +304349,12 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
304184
304349
  // Links static files and internally linked files
304185
304350
  ];
304186
304351
  resolveLinksAndCitationsTransform(mdast2, { state, transformers });
304187
- linksTransform(mdast2, state.vfile, {
304352
+ linksTransform(mdast2, vfile2, {
304188
304353
  transformers,
304189
304354
  selector: LINKS_SELECTOR
304190
304355
  });
304191
304356
  await transformLinkedRORs(session, vfile2, mdast2, file);
304192
- resolveReferencesTransform(mdast2, state.vfile, { state, transformers });
304357
+ resolveReferencesTransform(mdast2, vfile2, { state, transformers });
304193
304358
  await transformMystXRefs(session, vfile2, mdast2, frontmatter);
304194
304359
  await embedTransform(session, mdast2, file, dependencies, state);
304195
304360
  const pipe = unified();
@@ -304201,7 +304366,6 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
304201
304366
  await pipe.run(mdast2, vfile2);
304202
304367
  keysTransform(mdast2);
304203
304368
  checkLinkTextTransform(mdast2, externalReferences, vfile2);
304204
- logMessagesFromVFile(session, fileState.vfile);
304205
304369
  logMessagesFromVFile(session, vfile2);
304206
304370
  log.debug(toc(`Transformed mdast cross references and links for "${file}" in %s`));
304207
304371
  if (checkLinks)
@@ -304529,10 +304693,36 @@ function warnOnDuplicateIdentifiers(session, states) {
304529
304693
  });
304530
304694
  });
304531
304695
  }
304696
+ function referenceFileFromPartFile(session, partFile) {
304697
+ const state = session.store.getState();
304698
+ const partDeps = selectors_exports.selectDependentFiles(state, partFile);
304699
+ if (partDeps.length > 0)
304700
+ return partDeps[0];
304701
+ const file = selectors_exports.selectFileFromPart(state, partFile);
304702
+ return file !== null && file !== void 0 ? file : partFile;
304703
+ }
304532
304704
  function selectPageReferenceStates(session, pages, opts) {
304533
304705
  const cache = castSession(session);
304534
- const pageReferenceStates = pages.map((page) => {
304535
- const state = cache.$internalReferences[page.file];
304706
+ let previousCounts;
304707
+ const pageReferenceStates = pages.map(({ file }) => {
304708
+ var _a6, _b;
304709
+ const { frontmatter, identifiers, mdast: mdast2, kind } = (_b = (_a6 = cache.$getMdast(file)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
304710
+ const vfile2 = new VFile();
304711
+ vfile2.path = file;
304712
+ const refFile = kind === SourceFileKind.Part ? referenceFileFromPartFile(session, file) : file;
304713
+ const state = new ReferenceState(refFile, {
304714
+ frontmatter,
304715
+ identifiers,
304716
+ previousCounts,
304717
+ vfile: vfile2
304718
+ });
304719
+ if (frontmatter && !frontmatter.enumerator) {
304720
+ frontmatter.enumerator = state.enumerator;
304721
+ }
304722
+ if (mdast2)
304723
+ enumerateTargetsTransform(mdast2, { state });
304724
+ previousCounts = state.targetCounts;
304725
+ logMessagesFromVFile(session, vfile2);
304536
304726
  if (state) {
304537
304727
  const selectedFile = selectors_exports.selectFileInfo(session.store.getState(), state.filePath);
304538
304728
  if (selectedFile === null || selectedFile === void 0 ? void 0 : selectedFile.url)
@@ -304547,18 +304737,13 @@ function selectPageReferenceStates(session, pages, opts) {
304547
304737
  }).filter((state) => !!state);
304548
304738
  if (!(opts === null || opts === void 0 ? void 0 : opts.suppressWarnings))
304549
304739
  warnOnDuplicateIdentifiers(session, pageReferenceStates);
304550
- pages.forEach((page) => {
304740
+ pageReferenceStates.forEach((state) => {
304551
304741
  var _a6, _b;
304552
- const state = cache.$internalReferences[page.file];
304553
- if (!state)
304554
- return;
304555
- const { mdast: mdast2 } = (_b = (_a6 = cache.$getMdast(page.file)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
304742
+ const { mdast: mdast2 } = (_b = (_a6 = cache.$getMdast(state.filePath)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
304556
304743
  if (!mdast2)
304557
304744
  return;
304558
- const vfile2 = new VFile();
304559
- vfile2.path = page.file;
304560
- buildIndexTransform(mdast2, vfile2, state, new MultiPageReferenceResolver(pageReferenceStates, state.filePath));
304561
- logMessagesFromVFile(session, vfile2);
304745
+ buildIndexTransform(mdast2, state.vfile, state, new MultiPageReferenceResolver(pageReferenceStates, state.filePath));
304746
+ logMessagesFromVFile(session, state.vfile);
304562
304747
  });
304563
304748
  return pageReferenceStates;
304564
304749
  }
@@ -304609,6 +304794,8 @@ async function fastProcessFile(session, { file, pageSlug, projectPath, projectSl
304609
304794
  const fileParts = selectors_exports.selectFileParts(state, file);
304610
304795
  const projectParts = selectors_exports.selectProjectParts(state, projectPath);
304611
304796
  await Promise.all([file, ...fileParts].map(async (f3) => {
304797
+ var _a6;
304798
+ const level = (_a6 = pages.find((page) => page.file === file)) === null || _a6 === void 0 ? void 0 : _a6.level;
304612
304799
  return transformMdast(session, {
304613
304800
  file: f3,
304614
304801
  imageExtensions: imageExtensions !== null && imageExtensions !== void 0 ? imageExtensions : WEB_IMAGE_EXTENSIONS,
@@ -304618,7 +304805,8 @@ async function fastProcessFile(session, { file, pageSlug, projectPath, projectSl
304618
304805
  watchMode: true,
304619
304806
  extraTransforms,
304620
304807
  index: project.index,
304621
- execute
304808
+ execute,
304809
+ offset: level ? level - 1 : void 0
304622
304810
  });
304623
304811
  }));
304624
304812
  const pageReferenceStates = selectPageReferenceStates(session, [
@@ -304627,18 +304815,18 @@ async function fastProcessFile(session, { file, pageSlug, projectPath, projectSl
304627
304815
  return { file: part };
304628
304816
  })
304629
304817
  ]);
304630
- await Promise.all([file, ...fileParts].map(async (f3) => {
304818
+ await Promise.all([...pages.map((p5) => p5.file), ...fileParts].map(async (f3) => {
304631
304819
  return postProcessMdast(session, {
304632
304820
  file: f3,
304633
304821
  pageReferenceStates,
304634
304822
  extraLinkTransformers
304635
304823
  });
304636
304824
  }));
304637
- await Promise.all([file, ...fileParts].map(async (f3) => {
304825
+ await Promise.all([...pages.map((p5) => p5.file), ...fileParts].map(async (f3) => {
304638
304826
  var _a6, _b;
304639
304827
  const { mdast: mdast2, frontmatter } = (_b = (_a6 = castSession(session).$getMdast(f3)) === null || _a6 === void 0 ? void 0 : _a6.post) !== null && _b !== void 0 ? _b : {};
304640
- if (mdast2) {
304641
- await finalizeMdast(session, mdast2, frontmatter !== null && frontmatter !== void 0 ? frontmatter : {}, f3, {
304828
+ if (mdast2 && frontmatter) {
304829
+ await finalizeMdast(session, mdast2, frontmatter, f3, {
304642
304830
  imageWriteFolder: imageWriteFolder !== null && imageWriteFolder !== void 0 ? imageWriteFolder : session.publicPath(),
304643
304831
  imageAltOutputFolder: imageAltOutputFolder !== null && imageAltOutputFolder !== void 0 ? imageAltOutputFolder : "/",
304644
304832
  imageExtensions: imageExtensions !== null && imageExtensions !== void 0 ? imageExtensions : WEB_IMAGE_EXTENSIONS,
@@ -304648,9 +304836,14 @@ async function fastProcessFile(session, { file, pageSlug, projectPath, projectSl
304648
304836
  });
304649
304837
  }
304650
304838
  }));
304651
- if (pageSlug) {
304652
- await writeFile(session, { file, pageSlug, projectSlug, projectPath });
304653
- }
304839
+ await Promise.all(pages.map(async (page) => {
304840
+ return writeFile(session, {
304841
+ file: page.file,
304842
+ projectSlug,
304843
+ projectPath,
304844
+ pageSlug: page.slug
304845
+ });
304846
+ }));
304654
304847
  session.log.info(toc(`\u{1F4D6} Built ${file} in %s.`));
304655
304848
  await writeSiteManifest(session, { defaultTemplate });
304656
304849
  }
@@ -304684,7 +304877,10 @@ async function processProject(session, siteProject, opts) {
304684
304877
  const projectParts = selectors_exports.selectProjectParts(session.store.getState(), siteProject.path).map((part) => {
304685
304878
  return { file: part };
304686
304879
  });
304687
- const pagesToTransform = [...pages, ...projectParts];
304880
+ const pagesToTransform = [
304881
+ ...pages,
304882
+ ...projectParts
304883
+ ];
304688
304884
  const usedImageExtensions = imageExtensions !== null && imageExtensions !== void 0 ? imageExtensions : WEB_IMAGE_EXTENSIONS;
304689
304885
  await Promise.all(pagesToTransform.map((page) => transformMdast(session, {
304690
304886
  file: page.file,
@@ -304695,7 +304891,8 @@ async function processProject(session, siteProject, opts) {
304695
304891
  watchMode,
304696
304892
  execute,
304697
304893
  extraTransforms,
304698
- index: project.index
304894
+ index: project.index,
304895
+ offset: page.level ? page.level - 1 : void 0
304699
304896
  })));
304700
304897
  const pageReferenceStates = selectPageReferenceStates(session, pagesToTransform);
304701
304898
  await Promise.all(pagesToTransform.map((page) => postProcessMdast(session, {
@@ -306058,7 +306255,7 @@ var handlers3 = {
306058
306255
  state.write("\\end{frame}\n\n");
306059
306256
  return;
306060
306257
  }
306061
- if (node3.visibility === "remove")
306258
+ if (node3.visibility === "remove" || node3.visibility === "hide")
306062
306259
  return;
306063
306260
  if (metadataTags.includes("no-tex"))
306064
306261
  return;
@@ -306100,9 +306297,8 @@ var handlers3 = {
306100
306297
  },
306101
306298
  code(node3, state) {
306102
306299
  var _a6;
306103
- if (node3.visibility === "remove") {
306300
+ if (node3.visibility === "remove" || node3.visibility === "hide")
306104
306301
  return;
306105
- }
306106
306302
  addIndexEntries(node3, state);
306107
306303
  let start = "\\begin{verbatim}\n";
306108
306304
  let end = "\n\\end{verbatim}";
@@ -306808,7 +307004,7 @@ function hasGlossary(mdast2) {
306808
307004
  var import_adm_zip3 = __toESM(require_adm_zip(), 1);
306809
307005
  var import_node_fs36 = __toESM(require("fs"), 1);
306810
307006
  var import_node_path46 = __toESM(require("path"), 1);
306811
- var import_which5 = __toESM(require_lib15(), 1);
307007
+ var import_which6 = __toESM(require_lib15(), 1);
306812
307008
 
306813
307009
  // ../myst-to-typst/dist/container.js
306814
307010
  var CaptionKind2;
@@ -306819,7 +307015,9 @@ var CaptionKind2;
306819
307015
  CaptionKind3["table"] = "table";
306820
307016
  })(CaptionKind2 || (CaptionKind2 = {}));
306821
307017
  function renderFigureChild(node3, state) {
306822
- const useBrackets = node3.type !== "image" && node3.type !== "table";
307018
+ var _a6;
307019
+ const bracketNode = node3.type === "div" && ((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length) === 1 ? node3.children[0] : node3;
307020
+ const useBrackets = bracketNode.type !== "image" && bracketNode.type !== "table";
306823
307021
  if (node3.type === "legend") {
306824
307022
  state.useMacro('#let legendStyle = (fill: black.lighten(20%), size: 8pt, style: "italic")');
306825
307023
  state.write("text(..legendStyle)");
@@ -306840,7 +307038,7 @@ function getDefaultCaptionSupplement(kind) {
306840
307038
  return `${domain.slice(0, 1).toUpperCase()}${domain.slice(1)}`;
306841
307039
  }
306842
307040
  var containerHandler2 = (node3, state) => {
306843
- var _a6, _b;
307041
+ var _a6, _b, _c;
306844
307042
  if (state.data.isInTable) {
306845
307043
  fileError(state.file, "Unable to render typst figure inside table", {
306846
307044
  node: node3,
@@ -306887,6 +307085,13 @@ var containerHandler2 = (node3, state) => {
306887
307085
  state.data.isInBlockquote = prevIsInBlockquote;
306888
307086
  return;
306889
307087
  }
307088
+ if ((_c = node3.enumerator) === null || _c === void 0 ? void 0 : _c.endsWith(".1")) {
307089
+ state.write(`#set figure(numbering: "${node3.enumerator}")
307090
+ `);
307091
+ state.write(`#counter(figure.where(kind: "${kind}")).update(0)
307092
+
307093
+ `);
307094
+ }
306890
307095
  if (nonCaptions && nonCaptions.length > 1) {
306891
307096
  const allSubFigs = nonCaptions.filter((item) => item.type === "container").length === nonCaptions.length;
306892
307097
  state.useMacro('#import "@preview/subpar:0.1.1"');
@@ -306998,8 +307203,8 @@ var textOnlyReplacements3 = {
306998
307203
  "\xA9": "#emoji.copyright ",
306999
307204
  "\xAE": "#emoji.reg ",
307000
307205
  "\u2122": "#emoji.tm ",
307001
- "<": "\\< ",
307002
- ">": "\\> ",
307206
+ "<": "\\<",
307207
+ ">": "\\>",
307003
307208
  "\xA0": "~",
307004
307209
  "\u202F": "~"
307005
307210
  // eslint-disable-next-line no-irregular-whitespace
@@ -307055,9 +307260,11 @@ var mathReplacements2 = {
307055
307260
  "\xD7": "times",
307056
307261
  \u0391: "A",
307057
307262
  \u03B1: "alpha",
307263
+ "\u{1D736}": "alpha",
307058
307264
  \u0392: "B",
307059
307265
  \u03B2: "beta",
307060
307266
  \u00DF: "beta",
307267
+ "\u{1D737}": "beta",
307061
307268
  \u0393: "Gamma",
307062
307269
  \u03B3: "gamma",
307063
307270
  \u0394: "Delta",
@@ -307065,6 +307272,7 @@ var mathReplacements2 = {
307065
307272
  \u03B4: "delta",
307066
307273
  \u0395: "E",
307067
307274
  \u03B5: "epsilon",
307275
+ "\u{1D774}": "epsilon",
307068
307276
  \u0396: "Z",
307069
307277
  \u03B6: "zeta",
307070
307278
  \u0397: "H",
@@ -307189,6 +307397,43 @@ function getLatexImageWidth2(width) {
307189
307397
  return `${lineWidth}%`;
307190
307398
  }
307191
307399
 
307400
+ // ../../node_modules/tex-to-typst/dist/utils.js
307401
+ var BRACKETS = {
307402
+ "[": "bracket.l",
307403
+ "]": "bracket.r",
307404
+ "{": "brace.l",
307405
+ "}": "brace.r",
307406
+ "(": "paren.l",
307407
+ ")": "paren.r",
307408
+ "|": "bar.v",
307409
+ lfloor: "floor.l",
307410
+ "\u230A": "floor.l",
307411
+ rfloor: "floor.r",
307412
+ "\u230B": "floor.r",
307413
+ rceil: "ceil.r",
307414
+ "\u2309": "ceil.r",
307415
+ lceil: "ceil.l",
307416
+ "\u2308": "ceil.l"
307417
+ };
307418
+ function areBracketsBalanced(input3) {
307419
+ const stack = [];
307420
+ const bracketMap = {
307421
+ ")": "(",
307422
+ "]": "[",
307423
+ "}": "{"
307424
+ };
307425
+ for (const char of input3) {
307426
+ if (char === "(" || char === "[" || char === "{") {
307427
+ stack.push(char);
307428
+ } else if (char === ")" || char === "]" || char === "}") {
307429
+ if (!stack.length || bracketMap[char] !== stack.pop()) {
307430
+ return false;
307431
+ }
307432
+ }
307433
+ }
307434
+ return stack.length === 0;
307435
+ }
307436
+
307192
307437
  // ../../node_modules/tex-to-typst/dist/macros.js
307193
307438
  function isEmptyNode(node3) {
307194
307439
  if (!(node3 === null || node3 === void 0 ? void 0 : node3.content) || node3.content.length === 0)
@@ -307196,12 +307441,25 @@ function isEmptyNode(node3) {
307196
307441
  return false;
307197
307442
  }
307198
307443
  var typstStrings = {
307199
- ",": (state) => state.data.inFunction ? "comma" : ",",
307444
+ ",": (state) => state.data.inFunction && state._currentFunctions.slice(-1)[0] !== "text" ? "comma" : ",",
307200
307445
  "&": (state) => state.data.inArray ? "," : "&",
307201
307446
  "/": "\\/",
307202
307447
  ";": "\\;",
307203
- "~": "med"
307448
+ "~": "med",
307449
+ '"': '\\"'
307204
307450
  };
307451
+ function createBrackets(scale) {
307452
+ return (state, node3) => {
307453
+ var _a6;
307454
+ const args = node3.args;
307455
+ node3.args = [];
307456
+ const b = ((_a6 = args === null || args === void 0 ? void 0 : args[0].content) === null || _a6 === void 0 ? void 0 : _a6[0]).content;
307457
+ const typstB = BRACKETS[b];
307458
+ if (!typstB)
307459
+ throw new Error(`Undefined left bracket: ${b}`);
307460
+ return `#scale(x: ${scale}, y: ${scale})[$${typstB}$]`;
307461
+ };
307462
+ }
307205
307463
  function splitStrings(node3) {
307206
307464
  var _a6, _b, _c;
307207
307465
  if (((_b = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6[0].content) === null || _b === void 0 ? void 0 : _b.length) === 1 && ((_c = node3.args) === null || _c === void 0 ? void 0 : _c[0].content)[0].type === "string") {
@@ -307209,14 +307467,23 @@ function splitStrings(node3) {
307209
307467
  }
307210
307468
  }
307211
307469
  var typstMacros = {
307470
+ $: "\\$",
307212
307471
  cdot: "dot.op",
307213
307472
  to: "arrow.r",
307214
307473
  rightarrow: "arrow.r",
307474
+ Rightarrow: "arrow.r.double",
307215
307475
  leftarrow: "arrow.l",
307476
+ Leftarrow: "arrow.l.double",
307216
307477
  leftrightarrow: "arrow.l.r",
307217
307478
  gets: "arrow.l",
307479
+ rightharpoonup: "harpoon.rt",
307480
+ rightharpoondown: "harpoon.rb",
307481
+ leftharpoonup: "harpoon.lt",
307482
+ leftharpoondown: "harpoon.lb",
307218
307483
  infin: "infinity",
307484
+ // This is a mathjax only thing, https://docs.mathjax.org/en/v2.7-latest/tex.html#i
307219
307485
  infty: "infinity",
307486
+ // oo
307220
307487
  nonumber: "",
307221
307488
  int: "integral",
307222
307489
  iint: "integral.double",
@@ -307227,11 +307494,25 @@ var typstMacros = {
307227
307494
  return "root";
307228
307495
  },
307229
307496
  vec: "arrow",
307497
+ check: "caron",
307498
+ bar: "macron",
307230
307499
  mathbf: "bold",
307231
307500
  boldsymbol: "bold",
307501
+ bf: "bold",
307232
307502
  mathrm: "upright",
307233
307503
  textrm: "upright",
307234
307504
  rm: "upright",
307505
+ mbox: (state, node3) => {
307506
+ var _a6;
307507
+ const arg2 = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6[0];
307508
+ node3.args = [];
307509
+ state.openFunction("upright");
307510
+ state.openFunction("text");
307511
+ state.writeChildren(arg2);
307512
+ state.closeFunction();
307513
+ state.closeFunction();
307514
+ return "";
307515
+ },
307235
307516
  mathcal: "cal",
307236
307517
  mathfrak: "frak",
307237
307518
  pm: "plus.minus",
@@ -307244,6 +307525,18 @@ var typstMacros = {
307244
307525
  splitStrings(node3);
307245
307526
  return "^";
307246
307527
  },
307528
+ big: createBrackets("120%"),
307529
+ bigl: createBrackets("120%"),
307530
+ bigr: createBrackets("120%"),
307531
+ Big: createBrackets("180%"),
307532
+ Bigl: createBrackets("180%"),
307533
+ Bigr: createBrackets("180%"),
307534
+ bigg: createBrackets("240%"),
307535
+ biggr: createBrackets("240%"),
307536
+ biggl: createBrackets("240%"),
307537
+ Bigg: createBrackets("300%"),
307538
+ Biggl: createBrackets("300%"),
307539
+ Biggr: createBrackets("300%"),
307247
307540
  left: (state, node3) => {
307248
307541
  var _a6;
307249
307542
  const args = node3.args;
@@ -307259,8 +307552,11 @@ var typstMacros = {
307259
307552
  return "|";
307260
307553
  if (left2 === ".")
307261
307554
  return "";
307555
+ if (left2 === "lbrack")
307556
+ return "[";
307262
307557
  throw new Error(`Undefined left bracket: ${left2}`);
307263
307558
  },
307559
+ lbrack: "[",
307264
307560
  right: (state, node3) => {
307265
307561
  var _a6;
307266
307562
  const args = node3.args;
@@ -307276,18 +307572,38 @@ var typstMacros = {
307276
307572
  return "|";
307277
307573
  if (right2 === ".")
307278
307574
  return "";
307575
+ if (right2 === "rbrack")
307576
+ return "]";
307279
307577
  throw new Error(`Undefined right bracket: ${right2}`);
307280
307578
  },
307579
+ rbrack: "]",
307281
307580
  operatorname: (state, node3) => {
307282
307581
  var _a6;
307283
307582
  const text7 = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6.slice(-1)[0];
307284
307583
  node3.args = [{ type: "macro", content: "text", args: [text7] }];
307285
307584
  return "op";
307286
307585
  },
307586
+ mathop: "op",
307287
307587
  "\\": (state, node3) => {
307588
+ var _a6;
307288
307589
  node3.args = [];
307289
- if (state.data.inArray)
307590
+ if (state.data.inArray) {
307591
+ state.data.previousMatRows = ((_a6 = state.data.previousMatRows) !== null && _a6 !== void 0 ? _a6 : 0) + 1;
307592
+ if (state._value.slice(-1) === "]")
307593
+ state.addWhitespace();
307290
307594
  return ";";
307595
+ }
307596
+ return "\\\n";
307597
+ },
307598
+ cr: (state, node3) => {
307599
+ var _a6;
307600
+ node3.args = [];
307601
+ if (state.data.inArray) {
307602
+ state.data.previousMatRows = ((_a6 = state.data.previousMatRows) !== null && _a6 !== void 0 ? _a6 : 0) + 1;
307603
+ if (state._value.slice(-1) === "]")
307604
+ state.addWhitespace();
307605
+ return ";";
307606
+ }
307291
307607
  return "\\\n";
307292
307608
  },
307293
307609
  sim: "tilde",
@@ -307295,15 +307611,20 @@ var typstMacros = {
307295
307611
  simeq: "tilde.eq",
307296
307612
  ne: "!=",
307297
307613
  phi: "phi.alt",
307614
+ varphi: "phi.alt",
307298
307615
  varepsilon: "epsilon",
307299
307616
  propto: "prop",
307300
307617
  doteq: "dot(eq)",
307301
307618
  ge: "gt.eq",
307302
307619
  geq: "gt.eq",
307620
+ gg: "gt.double",
307303
307621
  le: "lt.eq",
307304
307622
  leq: "lt.eq",
307623
+ ll: "lt.double",
307305
307624
  neq: "eq.not",
307306
307625
  otimes: "times.circle",
307626
+ circ: "compose",
307627
+ vert: "bar.v",
307307
307628
  dot: "dot",
307308
307629
  ddot: "dot.double",
307309
307630
  dots: "dots.h",
@@ -307315,6 +307636,7 @@ var typstMacros = {
307315
307636
  cap: "sect",
307316
307637
  cup: "union",
307317
307638
  widehat: "hat",
307639
+ widetilde: "tilde",
307318
307640
  // Spaces
307319
307641
  ",": "thin",
307320
307642
  ":": "med",
@@ -307322,9 +307644,14 @@ var typstMacros = {
307322
307644
  "!": "#h(-1em)",
307323
307645
  quad: "quad",
307324
307646
  qquad: "wide",
307647
+ wedge: "and",
307325
307648
  prod: "product",
307326
- biggl: "",
307327
- biggr: "",
307649
+ lfloor: "floor.l",
307650
+ rfloor: "floor.r",
307651
+ langle: "angle.l",
307652
+ rangle: "angle.r",
307653
+ implies: "arrow.r.double.long",
307654
+ " ": '" "',
307328
307655
  mathbb: (state, node3) => {
307329
307656
  var _a6, _b, _c, _d2, _e;
307330
307657
  const text7 = (_e = (_d2 = (_c = (_b = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6.slice(-1)[0]) === null || _b === void 0 ? void 0 : _b.content) === null || _c === void 0 ? void 0 : _c[0]) === null || _d2 === void 0 ? void 0 : _d2.content) !== null && _e !== void 0 ? _e : "";
@@ -307347,16 +307674,62 @@ var typstMacros = {
307347
307674
  state.useMacro('#import "@preview/ouset:0.2.0": *');
307348
307675
  node3.args = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6.reverse();
307349
307676
  return "underset";
307677
+ },
307678
+ overrightarrow: (state, node3) => {
307679
+ var _a6;
307680
+ (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6.push({ type: "argument", content: [{ type: "macro", content: "arrow" }] });
307681
+ return "accent";
307682
+ },
307683
+ overleftarrow: (state, node3) => {
307684
+ var _a6;
307685
+ (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6.push({ type: "argument", content: [{ type: "macro", content: "arrow.l" }] });
307686
+ return "accent";
307687
+ },
307688
+ middle: (state) => {
307689
+ var _a6;
307690
+ return `mat(delim: #("|", none), ${";".repeat((_a6 = state.data.previousMatRows) !== null && _a6 !== void 0 ? _a6 : 1)})`;
307691
+ },
307692
+ stackrel: (state, node3) => {
307693
+ var _a6;
307694
+ const args = (_a6 = node3.args) === null || _a6 === void 0 ? void 0 : _a6.reverse();
307695
+ node3.args = [];
307696
+ state.writeChildren(args === null || args === void 0 ? void 0 : args[0]);
307697
+ state.write("^");
307698
+ state.writeChildren(args === null || args === void 0 ? void 0 : args[1]);
307699
+ return "";
307700
+ },
307701
+ color: (state, node3) => {
307702
+ var _a6, _b, _c;
307703
+ const [fill3, children] = (_a6 = node3.args) !== null && _a6 !== void 0 ? _a6 : [];
307704
+ const color2 = (_c = (_b = fill3.content) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.content;
307705
+ node3.args = [];
307706
+ state.openFunction(`#text(fill: ${color2})`, { openToken: "[$", closeToken: "$]" });
307707
+ state.writeChildren(children);
307708
+ state.closeFunction();
307709
+ return "";
307350
307710
  }
307351
307711
  };
307712
+ var matrixEnv = (delim) => (state, node3) => {
307713
+ state.data.inArray = true;
307714
+ state.data.previousMatRows = 0;
307715
+ state.openFunction("mat");
307716
+ state.write(`delim: ${delim ? `"${delim}"` : "#none"},`);
307717
+ state.writeChildren(node3);
307718
+ state.closeFunction();
307719
+ state.data.inArray = false;
307720
+ };
307352
307721
  var typstEnvs = {
307353
- array: (state, node3) => {
307354
- state.data.inArray = true;
307355
- state.openFunction("mat");
307356
- state.write("delim: #none,");
307722
+ array: matrixEnv(),
307723
+ matrix: matrixEnv(),
307724
+ pmatrix: matrixEnv("("),
307725
+ bmatrix: matrixEnv("["),
307726
+ Bmatrix: matrixEnv("{"),
307727
+ vmatrix: matrixEnv("|"),
307728
+ aligned(state, node3) {
307729
+ state.writeChildren(node3);
307730
+ },
307731
+ ["aligned*"](state, node3) {
307357
307732
  state.writeChildren(node3);
307358
- state.closeFunction();
307359
- state.data.inArray = false;
307360
307733
  }
307361
307734
  };
307362
307735
 
@@ -307368,11 +307741,26 @@ function parseLatex2(value) {
307368
307741
  boldsymbol: { signature: "m" },
307369
307742
  left: { signature: "m" },
307370
307743
  right: { signature: "m" },
307744
+ big: { signature: "m" },
307745
+ bigr: { signature: "m" },
307746
+ bigl: { signature: "m" },
307747
+ Big: { signature: "m" },
307748
+ Bigr: { signature: "m" },
307749
+ Bigl: { signature: "m" },
307750
+ bigg: { signature: "m" },
307751
+ biggr: { signature: "m" },
307752
+ biggl: { signature: "m" },
307753
+ Bigg: { signature: "m" },
307754
+ Biggr: { signature: "m" },
307755
+ Biggl: { signature: "m" },
307371
307756
  dot: { signature: "m" },
307372
307757
  ddot: { signature: "m" },
307373
307758
  hat: { signature: "m" },
307374
307759
  tilde: { signature: "m" },
307760
+ check: { signature: "m" },
307761
+ bar: { signature: "m" },
307375
307762
  widehat: { signature: "m" },
307763
+ widetilde: { signature: "m" },
307376
307764
  overset: { signature: "m m" },
307377
307765
  underset: { signature: "m m" },
307378
307766
  overbrace: { signature: "m" },
@@ -307380,7 +307768,14 @@ function parseLatex2(value) {
307380
307768
  overparen: { signature: "m" },
307381
307769
  underbrace: { signature: "m" },
307382
307770
  underline: { signature: "m" },
307383
- underparen: { signature: "m" }
307771
+ underparen: { signature: "m" },
307772
+ overrightarrow: { signature: "m" },
307773
+ overleftarrow: { signature: "m" },
307774
+ stackrel: { signature: "m m" },
307775
+ mathop: { signature: "m" },
307776
+ bf: { signature: "m" },
307777
+ textstyle: { signature: "m" }
307778
+ // color: { signature: 'm m' }, // This doesn't work, changing it below manually
307384
307779
  }
307385
307780
  }).processSync({ value });
307386
307781
  const content3 = file.result.content;
@@ -307393,7 +307788,7 @@ function walkLatex2(node3) {
307393
307788
  const content3 = node3.content.map((n) => walkLatex2(n));
307394
307789
  let skip = 0;
307395
307790
  const parsed = content3.reduce((list6, next, i2, array) => {
307396
- var _a6;
307791
+ var _a6, _b, _c, _d2, _e, _f, _g;
307397
307792
  if (skip > 0) {
307398
307793
  skip -= 1;
307399
307794
  return list6;
@@ -307404,12 +307799,39 @@ function walkLatex2(node3) {
307404
307799
  next.args = args;
307405
307800
  skip += nodesRemoved;
307406
307801
  }
307802
+ if (next.type === "macro" && next.content === "color") {
307803
+ const { args, nodesRemoved } = gobbleArguments(array.slice(i2 + 1), "m");
307804
+ next.type = "macro";
307805
+ next.args = [...(_b = (_a6 = next.args) === null || _a6 === void 0 ? void 0 : _a6.slice(1)) !== null && _b !== void 0 ? _b : [], ...args];
307806
+ skip += nodesRemoved;
307807
+ }
307808
+ if (next.type === "macro" && next.content === "textstyle") {
307809
+ next.content = "text";
307810
+ }
307407
307811
  if (next.type === "macro" && (next.content === "overbrace" || next.content === "underbrace")) {
307408
307812
  const { args, nodesRemoved } = gobbleArguments(array.slice(i2 + 1), "m");
307409
307813
  if (args[0].content.length === 1 && args[0].content[0].type === "macro" && (args[0].content[0].content === "^" && next.content === "overbrace" || args[0].content[0].content === "_" && next.content === "underbrace")) {
307410
- next.args = [...(_a6 = next.args) !== null && _a6 !== void 0 ? _a6 : [], ...args[0].content[0].args];
307814
+ next.args = [...(_c = next.args) !== null && _c !== void 0 ? _c : [], ...args[0].content[0].args];
307411
307815
  skip += nodesRemoved;
307412
307816
  }
307817
+ if (args[0].content.length === 1 && args[0].content[0].type === "string" && (args[0].content[0].content === "^" && next.content === "overbrace" || args[0].content[0].content === "_" && next.content === "underbrace")) {
307818
+ const { args: doubleArgs, nodesRemoved: doubleNodesRemoved } = gobbleArguments(array.slice(i2 + 1), "m m");
307819
+ next.args = [...(_d2 = next.args) !== null && _d2 !== void 0 ? _d2 : [], doubleArgs[1]];
307820
+ skip += doubleNodesRemoved;
307821
+ }
307822
+ }
307823
+ if (next.type === "macro" && next.content === "middle" && ((_e = array[i2 + 1]) === null || _e === void 0 ? void 0 : _e.content) === "|") {
307824
+ skip += 1;
307825
+ }
307826
+ if (next.type === "group" && ((_g = (_f = next.content) === null || _f === void 0 ? void 0 : _f.find) === null || _g === void 0 ? void 0 : _g.call(_f, (n) => n.type === "macro" && n.content === "over"))) {
307827
+ const children = next.content;
307828
+ next.type = "macro";
307829
+ next.content = "frac";
307830
+ const index4 = children.findIndex((n) => n.type === "macro" && n.content === "over");
307831
+ next.args = [
307832
+ { type: "argument", content: children.slice(0, index4) },
307833
+ { type: "argument", content: children.slice(index4 + 1) }
307834
+ ];
307413
307835
  }
307414
307836
  list6.push(next);
307415
307837
  return list6;
@@ -307425,12 +307847,13 @@ function walkLatex2(node3) {
307425
307847
  return node3;
307426
307848
  }
307427
307849
  var State4 = class {
307428
- constructor() {
307850
+ constructor(opts) {
307851
+ var _a6;
307429
307852
  this._scriptsSimplified = false;
307430
307853
  this._closeToken = [];
307431
307854
  this._currentFunctions = [];
307432
307855
  this._value = "";
307433
- this.data = {};
307856
+ this.data = { writeOutBrackets: (_a6 = opts === null || opts === void 0 ? void 0 : opts.writeOutBrackets) !== null && _a6 !== void 0 ? _a6 : false };
307434
307857
  }
307435
307858
  get value() {
307436
307859
  return this._value;
@@ -307442,16 +307865,26 @@ var State4 = class {
307442
307865
  }
307443
307866
  addWhitespace() {
307444
307867
  const lastChar = this.value.slice(-1);
307445
- if (!this._value || lastChar.match(/^(["\s_^{(-])$/))
307868
+ if (!this._value)
307869
+ return;
307870
+ if (lastChar.match(/^(["\s_^{(-])$/))
307871
+ return;
307872
+ const lastTwoChar = this.value.slice(-2);
307873
+ if (!this._value || lastTwoChar === ")[" || lastTwoChar === "[$")
307446
307874
  return;
307447
307875
  this._value += " ";
307448
307876
  }
307449
307877
  write(str2) {
307450
307878
  if (!str2)
307451
307879
  return;
307880
+ if (Object.keys(BRACKETS).includes(str2) && this.data.inFunction && this.data.writeOutBrackets) {
307881
+ this.addWhitespace();
307882
+ this._value += BRACKETS[str2];
307883
+ return;
307884
+ }
307452
307885
  if (this._scriptsSimplified && str2 === "(") {
307453
307886
  this.addWhitespace();
307454
- } else if (str2.match(/^([}()_^,;!])$/)) {
307887
+ } else if (str2.match(/^([})_^.,;!])$/) || str2 === '\\"') {
307455
307888
  } else {
307456
307889
  this.addWhitespace();
307457
307890
  }
@@ -307472,7 +307905,7 @@ var State4 = class {
307472
307905
  get _functionCount() {
307473
307906
  return this._currentFunctions.length;
307474
307907
  }
307475
- openFunction(command) {
307908
+ openFunction(command, { openToken, closeToken } = {}) {
307476
307909
  if (command === "text") {
307477
307910
  this.addWhitespace();
307478
307911
  } else {
@@ -307482,8 +307915,8 @@ var State4 = class {
307482
307915
  this.data.inFunction = true;
307483
307916
  this._simplify = command === "_" || command === "^";
307484
307917
  this._lastFunction = this._value.length;
307485
- this._value += command === "text" ? '"' : "(";
307486
- this._closeToken.push(command === "text" ? '"' : ")");
307918
+ this._value += openToken !== null && openToken !== void 0 ? openToken : command === "text" ? '"' : "(";
307919
+ this._closeToken.push(closeToken !== null && closeToken !== void 0 ? closeToken : command === "text" ? '"' : ")");
307487
307920
  }
307488
307921
  closeFunction() {
307489
307922
  this._value += this._closeToken.pop() || ")";
@@ -307560,11 +307993,15 @@ function writeTypst(node3, state = new State4()) {
307560
307993
  function postProcess(typst) {
307561
307994
  return typst.replace(/^(_|\^)/, '""$1').replace(/"([^"]*)"=/g, '"$1" =').replace(/(\d+)(?:\s+)(?=\d)/g, "$1");
307562
307995
  }
307563
- function texToTypst(value) {
307996
+ function texToTypst(value, options) {
307564
307997
  const tree = parseLatex2(value);
307565
307998
  walkLatex2(tree);
307566
- const state = writeTypst(tree);
307567
- return { value: postProcess(state.value), macros: state.data.macros };
307999
+ const state = writeTypst(tree, new State4({ writeOutBrackets: options === null || options === void 0 ? void 0 : options.writeOutBrackets }));
308000
+ const typstValue = postProcess(state.value);
308001
+ if ((options === null || options === void 0 ? void 0 : options.writeOutBrackets) || areBracketsBalanced(typstValue)) {
308002
+ return { value: typstValue, macros: state.data.macros };
308003
+ }
308004
+ return texToTypst(value, { writeOutBrackets: true });
307568
308005
  }
307569
308006
 
307570
308007
  // ../myst-to-typst/dist/math.js
@@ -307613,7 +308050,7 @@ function resolveRecursiveCommands(plugins3) {
307613
308050
  return newPlugins;
307614
308051
  }
307615
308052
  var math5 = (node3, state) => {
307616
- var _a6;
308053
+ var _a6, _b;
307617
308054
  const { value, macros: macros18 } = texToTypst(node3.value);
307618
308055
  macros18 === null || macros18 === void 0 ? void 0 : macros18.forEach((macro2) => {
307619
308056
  state.useMacro(macro2);
@@ -307621,6 +308058,13 @@ var math5 = (node3, state) => {
307621
308058
  const { identifier: label } = (_a6 = normalizeLabel(node3.label)) !== null && _a6 !== void 0 ? _a6 : {};
307622
308059
  addMacrosToState2(value, state);
307623
308060
  state.ensureNewLine();
308061
+ if ((_b = node3.enumerator) === null || _b === void 0 ? void 0 : _b.endsWith(".1")) {
308062
+ state.write(`#set math.equation(numbering: "(${node3.enumerator})")
308063
+ `);
308064
+ state.write(`#counter(math.equation).update(0)
308065
+
308066
+ `);
308067
+ }
307624
308068
  state.write(`$ ${value} $${label ? ` <${label}>` : ""}
307625
308069
 
307626
308070
  `);
@@ -307696,7 +308140,9 @@ var tableCellHandler = (node3, state) => {
307696
308140
  state.write(`align: ${node3.align}, `);
307697
308141
  }
307698
308142
  if ((_b = node3.style) === null || _b === void 0 ? void 0 : _b.backgroundColor) {
307699
- state.write(`fill: rgb("${node3.style.backgroundColor}"), `);
308143
+ const fill3 = node3.style.backgroundColor;
308144
+ const rgb = fill3.startsWith("#");
308145
+ state.write(`fill: ${rgb ? `rgb("${fill3}")` : fill3}, `);
307700
308146
  }
307701
308147
  state.write(")");
307702
308148
  }
@@ -307705,6 +308151,54 @@ var tableCellHandler = (node3, state) => {
307705
308151
  state.write("],\n");
307706
308152
  };
307707
308153
 
308154
+ // ../myst-to-typst/dist/proofs.js
308155
+ var proof = `
308156
+ #let proof(body, heading: [], kind: "proof", supplement: "Proof", labelName: none, color: blue, float: true) = {
308157
+ let stroke = 1pt + color.lighten(90%)
308158
+ let fill = color.lighten(90%)
308159
+ let title
308160
+ set figure.caption(position: top)
308161
+ set figure(placement: none)
308162
+ show figure.caption.where(body: heading): (it) => {
308163
+ block(width: 100%, stroke: stroke, fill: fill, inset: 8pt, it)
308164
+ }
308165
+ place(auto, float: float, block(width: 100%, [
308166
+ #figure(kind: kind, supplement: supplement, gap: 0pt, [
308167
+ #set align(left);
308168
+ #set figure.caption(position: bottom)
308169
+ #block(width: 100%, fill: luma(253), stroke: stroke, inset: 8pt)[#body]
308170
+ ], caption: heading)
308171
+ #if(labelName != none){label(labelName)}
308172
+ ]))
308173
+ }`;
308174
+ function writeProof(node3, state, kind) {
308175
+ state.useMacro(proof);
308176
+ const title = select("admonitionTitle", node3);
308177
+ const supplement = getDefaultCaptionSupplement(kind);
308178
+ state.write(`#proof(kind: "${kind}", supplement: "${supplement}", labelName: ${node3.identifier ? `"${node3.identifier}"` : "none"}`);
308179
+ if (title) {
308180
+ state.write(", heading: [");
308181
+ state.renderChildren(title);
308182
+ state.write("])[\n");
308183
+ } else {
308184
+ state.write(")[\n");
308185
+ }
308186
+ state.renderChildren(node3);
308187
+ state.write("]");
308188
+ state.ensureNewLine();
308189
+ }
308190
+ var proofHandlers = {
308191
+ proof(node3, state) {
308192
+ writeProof(node3, state, node3.kind || "proof");
308193
+ },
308194
+ exercise(node3, state) {
308195
+ writeProof(node3, state, "exercise");
308196
+ },
308197
+ solution(node3, state) {
308198
+ writeProof(node3, state, "solution");
308199
+ }
308200
+ };
308201
+
307708
308202
  // ../myst-to-typst/dist/index.js
307709
308203
  var admonition2 = `#let admonition(body, heading: none, color: blue) = {
307710
308204
  let stroke = (left: 2pt + color.darken(20%))
@@ -307745,25 +308239,6 @@ var tabItem = `
307745
308239
  #block(width: 100%, inset: (x: 8pt, bottom: 8pt))[#body]
307746
308240
  ])
307747
308241
  }`;
307748
- var proof = `
307749
- #let proof(body, heading: [], kind: "proof", supplement: "Proof", labelName: none, color: blue, float: true) = {
307750
- let stroke = 1pt + color.lighten(90%)
307751
- let fill = color.lighten(90%)
307752
- let title
307753
- set figure.caption(position: top)
307754
- set figure(placement: none)
307755
- show figure.caption.where(body: heading): (it) => {
307756
- block(width: 100%, stroke: stroke, fill: fill, inset: 8pt, it)
307757
- }
307758
- place(auto, float: float, block(width: 100%, [
307759
- #figure(kind: kind, supplement: supplement, gap: 0pt, [
307760
- #set align(left);
307761
- #set figure.caption(position: bottom)
307762
- #block(width: 100%, fill: luma(253), stroke: stroke, inset: 8pt)[#body]
307763
- ], caption: heading)
307764
- #if(labelName != none){label(labelName)}
307765
- ]))
307766
- }`;
307767
308242
  var INDENT = " ";
307768
308243
  var linkHandler = (node3, state) => {
307769
308244
  const href = node3.url;
@@ -307776,6 +308251,16 @@ var linkHandler = (node3, state) => {
307776
308251
  state.write("]");
307777
308252
  }
307778
308253
  };
308254
+ function prevCharacterIsText(parent2, node3) {
308255
+ var _a6, _b;
308256
+ const ind = (_a6 = parent2 === null || parent2 === void 0 ? void 0 : parent2.children) === null || _a6 === void 0 ? void 0 : _a6.findIndex((n) => n === node3);
308257
+ if (!ind)
308258
+ return false;
308259
+ const prev = (_b = parent2 === null || parent2 === void 0 ? void 0 : parent2.children) === null || _b === void 0 ? void 0 : _b[ind - 1];
308260
+ if (!(prev === null || prev === void 0 ? void 0 : prev.value))
308261
+ return false;
308262
+ return (prev === null || prev === void 0 ? void 0 : prev.type) === "text" && !!prev.value.match(/[a-zA-Z0-9\-_]$/) || false;
308263
+ }
307779
308264
  function nextCharacterIsText(parent2, node3) {
307780
308265
  var _a6, _b;
307781
308266
  const ind = (_a6 = parent2 === null || parent2 === void 0 ? void 0 : parent2.children) === null || _a6 === void 0 ? void 0 : _a6.findIndex((n) => n === node3);
@@ -307788,16 +308273,18 @@ function nextCharacterIsText(parent2, node3) {
307788
308273
  }
307789
308274
  var handlers4 = {
307790
308275
  text(node3, state) {
307791
- state.text(node3.value);
308276
+ state.text(node3.value.replaceAll("\n", " "));
307792
308277
  },
307793
308278
  paragraph(node3, state) {
307794
- state.renderChildren(node3, 2);
308279
+ const { identifier } = node3;
308280
+ const after = identifier ? ` <${identifier}>` : void 0;
308281
+ state.renderChildren(node3, 2, { after });
307795
308282
  },
307796
308283
  heading(node3, state) {
307797
- const { depth, identifier, enumerated } = node3;
308284
+ const { depth, identifier, enumerated, implicit } = node3;
307798
308285
  state.write(`${Array(depth).fill("=").join("")} `);
307799
308286
  state.renderChildren(node3);
307800
- if (enumerated !== false && identifier) {
308287
+ if (enumerated !== false && identifier && !implicit) {
307801
308288
  state.write(` <${identifier}>`);
307802
308289
  }
307803
308290
  state.write("\n\n");
@@ -307808,7 +308295,7 @@ var handlers4 = {
307808
308295
  return;
307809
308296
  if (metadataTags.includes("no-pdf"))
307810
308297
  return;
307811
- if (node3.visibility === "remove")
308298
+ if (node3.visibility === "remove" || node3.visibility === "hide")
307812
308299
  return;
307813
308300
  if (metadataTags.includes("page-break") || metadataTags.includes("new-page")) {
307814
308301
  state.write("#pagebreak(weak: true)\n");
@@ -307850,9 +308337,8 @@ var handlers4 = {
307850
308337
  },
307851
308338
  code(node3, state) {
307852
308339
  var _a6;
307853
- if (node3.visibility === "remove") {
308340
+ if (node3.visibility === "remove" || node3.visibility === "hide")
307854
308341
  return;
307855
- }
307856
308342
  let ticks = "```";
307857
308343
  while (node3.value.includes(ticks)) {
307858
308344
  ticks += "`";
@@ -307917,8 +308403,9 @@ ${node3.value}
307917
308403
  }
307918
308404
  },
307919
308405
  strong(node3, state, parent2) {
308406
+ const prev = prevCharacterIsText(parent2, node3);
307920
308407
  const next = nextCharacterIsText(parent2, node3);
307921
- if (nodeOnlyHasTextChildren(node3) && !next) {
308408
+ if (nodeOnlyHasTextChildren(node3) && !(prev || next)) {
307922
308409
  state.write("*");
307923
308410
  state.renderChildren(node3);
307924
308411
  state.write("*");
@@ -307927,8 +308414,9 @@ ${node3.value}
307927
308414
  }
307928
308415
  },
307929
308416
  emphasis(node3, state, parent2) {
308417
+ const prev = prevCharacterIsText(parent2, node3);
307930
308418
  const next = nextCharacterIsText(parent2, node3);
307931
- if (nodeOnlyHasTextChildren(node3) && !next) {
308419
+ if (nodeOnlyHasTextChildren(node3) && !prev && !next) {
307932
308420
  state.write("_");
307933
308421
  state.renderChildren(node3);
307934
308422
  state.write("_");
@@ -308038,9 +308526,9 @@ ${node3.value}
308038
308526
  legend: captionHandler2,
308039
308527
  captionNumber: () => void 0,
308040
308528
  crossReference(node3, state, parent2) {
308041
- var _a6, _b;
308042
- if (node3.remote) {
308043
- const url = ((_a6 = node3.remoteBaseUrl) !== null && _a6 !== void 0 ? _a6 : "") + (node3.url === "/" ? "" : (_b = node3.url) !== null && _b !== void 0 ? _b : "") + (node3.html_id ? `#${node3.html_id}` : "");
308529
+ var _a6;
308530
+ if (node3.remoteBaseUrl) {
308531
+ const url = node3.remoteBaseUrl + (node3.url === "/" ? "" : (_a6 = node3.url) !== null && _a6 !== void 0 ? _a6 : "") + (node3.html_id ? `#${node3.html_id}` : "");
308044
308532
  linkHandler({ ...node3, url }, state);
308045
308533
  return;
308046
308534
  }
@@ -308129,23 +308617,6 @@ ${node3.value}
308129
308617
  state.renderChildren(node3);
308130
308618
  state.write("\n]\n\n");
308131
308619
  },
308132
- proof(node3, state) {
308133
- state.useMacro(proof);
308134
- const title = select("admonitionTitle", node3);
308135
- const kind = node3.kind || "proof";
308136
- const supplement = getDefaultCaptionSupplement(kind);
308137
- state.write(`#proof(kind: "${kind}", supplement: "${supplement}", labelName: ${node3.identifier ? `"${node3.identifier}"` : "none"}`);
308138
- if (title) {
308139
- state.write(", heading: [");
308140
- state.renderChildren(title);
308141
- state.write("])[");
308142
- } else {
308143
- state.write(")[");
308144
- }
308145
- state.renderChildren(node3);
308146
- state.write("]");
308147
- state.ensureNewLine();
308148
- },
308149
308620
  card(node3, state) {
308150
308621
  var _a6;
308151
308622
  if (node3.url) {
@@ -308167,7 +308638,8 @@ ${node3.value}
308167
308638
  },
308168
308639
  footer() {
308169
308640
  return;
308170
- }
308641
+ },
308642
+ ...proofHandlers
308171
308643
  };
308172
308644
  var TypstSerializer = class {
308173
308645
  constructor(file, tree, opts) {
@@ -308218,7 +308690,7 @@ var TypstSerializer = class {
308218
308690
  this.renderChildren({ children: node3 }, trailingNewLines, opts);
308219
308691
  return;
308220
308692
  }
308221
- const { delim = "", trimEnd: trimEnd2 = true } = opts;
308693
+ const { delim = "", trimEnd: trimEnd2 = true, after } = opts;
308222
308694
  const numChildren = (_b = (_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length) !== null && _b !== void 0 ? _b : 0;
308223
308695
  (_c = node3.children) === null || _c === void 0 ? void 0 : _c.forEach((child, index4) => {
308224
308696
  if (!child)
@@ -308237,6 +308709,8 @@ var TypstSerializer = class {
308237
308709
  });
308238
308710
  if (trimEnd2)
308239
308711
  this.trimEnd();
308712
+ if (after)
308713
+ this.write(after);
308240
308714
  for (let i2 = trailingNewLines; i2--; )
308241
308715
  this.addNewLine();
308242
308716
  }
@@ -308281,7 +308755,7 @@ var TYPST_IMAGE_EXTENSIONS = [
308281
308755
  ImageExtensions.jpeg
308282
308756
  ];
308283
308757
  function isTypstAvailable() {
308284
- return import_which5.default.sync("typst", { nothrow: true });
308758
+ return import_which6.default.sync("typst", { nothrow: true });
308285
308759
  }
308286
308760
  async function runTypstExecutable(session, typstFile) {
308287
308761
  if (!isTypstAvailable()) {
@@ -308443,6 +308917,23 @@ async function localArticleToTypstTemplated(session, file, templateOptions, opts
308443
308917
  macros: [],
308444
308918
  commands: {}
308445
308919
  };
308920
+ const state = session.store.getState();
308921
+ const projectFrontmatter = (_a6 = selectors_exports.selectLocalProjectConfig(state, projectPath !== null && projectPath !== void 0 ? projectPath : ".")) !== null && _a6 !== void 0 ? _a6 : {};
308922
+ if (file === selectors_exports.selectCurrentProjectFile(state)) {
308923
+ partDefinitions.forEach((def) => {
308924
+ var _a7;
308925
+ const part = extractTypstPart(session, { type: "root", children: [] }, {}, def, projectFrontmatter, templateYml);
308926
+ if (Array.isArray(part)) {
308927
+ part.forEach((item) => {
308928
+ collected = mergeTypstTemplateImports(collected, item);
308929
+ });
308930
+ parts[def.id] = part.map(({ value }) => value);
308931
+ } else if (part != null) {
308932
+ collected = mergeTypstTemplateImports(collected, part);
308933
+ parts[def.id] = (_a7 = part === null || part === void 0 ? void 0 : part.value) !== null && _a7 !== void 0 ? _a7 : "";
308934
+ }
308935
+ });
308936
+ }
308446
308937
  const hasGlossaries = false;
308447
308938
  const results = await Promise.all(content3.map(async ({ mdast: mdast2, frontmatter: frontmatter2, references }, ind) => {
308448
308939
  await finalizeMdast(session, mdast2, frontmatter2, fileArticles[ind].file, {
@@ -308479,8 +308970,7 @@ async function localArticleToTypstTemplated(session, file, templateOptions, opts
308479
308970
  frontmatter = content3[0].frontmatter;
308480
308971
  typstContent = results[0].value;
308481
308972
  } else {
308482
- const state = session.store.getState();
308483
- frontmatter = (_a6 = selectors_exports.selectLocalProjectConfig(state, projectPath !== null && projectPath !== void 0 ? projectPath : ".")) !== null && _a6 !== void 0 ? _a6 : {};
308973
+ frontmatter = projectFrontmatter;
308484
308974
  const { dir, name: name3, ext: ext2 } = import_node_path46.default.parse(output2);
308485
308975
  typstContent = "";
308486
308976
  let fileInd = 0;
@@ -308709,7 +309199,7 @@ var paragraph2 = (state, node3) => {
308709
309199
  state.closeBlock();
308710
309200
  };
308711
309201
  var block3 = (state, node3) => {
308712
- if (node3.visibility === "remove")
309202
+ if (node3.visibility === "remove" || node3.visibility === "hide")
308713
309203
  return;
308714
309204
  const metadataTags = getMetadataTags(node3);
308715
309205
  if (metadataTags.includes("page-break") || metadataTags.includes("new-page")) {
@@ -311117,7 +311607,7 @@ var handlers5 = {
311117
311607
  state.renderInline(node3, "title");
311118
311608
  },
311119
311609
  block(node3, state) {
311120
- if (node3.visibility === "remove")
311610
+ if (node3.visibility === "remove" || node3.visibility === "hide")
311121
311611
  return;
311122
311612
  state.renderChildren(node3);
311123
311613
  },
@@ -311919,12 +312409,12 @@ var import_node_path49 = __toESM(require("path"), 1);
311919
312409
  var import_util5 = __toESM(require("util"), 1);
311920
312410
 
311921
312411
  // ../myst-cli/dist/build/pdf/utils.js
311922
- var import_which6 = __toESM(require_lib15(), 1);
312412
+ var import_which7 = __toESM(require_lib15(), 1);
311923
312413
  function isLatexmkAvailable() {
311924
- return import_which6.default.sync("latexmk", { nothrow: true });
312414
+ return import_which7.default.sync("latexmk", { nothrow: true });
311925
312415
  }
311926
312416
  function isMakeglossariesAvailable() {
311927
- return import_which6.default.sync("makeglossaries", { nothrow: true });
312417
+ return import_which7.default.sync("makeglossaries", { nothrow: true });
311928
312418
  }
311929
312419
 
311930
312420
  // ../myst-cli/dist/build/pdf/create.js
@@ -316326,7 +316816,7 @@ var CODE_BLOCK_KEYS = [
316326
316816
  "caption"
316327
316817
  ];
316328
316818
  function code6(node3, _3, state, info) {
316329
- const nodeCodeBlockKeys = Object.keys(node3).filter((k) => CODE_BLOCK_KEYS.includes(k));
316819
+ const nodeCodeBlockKeys = Object.entries(node3).filter(([k, v]) => CODE_BLOCK_KEYS.includes(k) && v != null);
316330
316820
  if (!nodeCodeBlockKeys.length) {
316331
316821
  return handle5.code(node3, _3, state, info);
316332
316822
  }
@@ -316348,6 +316838,10 @@ function code6(node3, _3, state, info) {
316348
316838
  var IMAGE_DIRECTIVE_OPTS = ["class", "width", "align"];
316349
316839
  var IMAGE_OPTS = IMAGE_DIRECTIVE_OPTS.concat("title", "alt");
316350
316840
  function image5(node3, _3, state, info) {
316841
+ var _a6;
316842
+ if ((_a6 = node3 === null || node3 === void 0 ? void 0 : node3.data) === null || _a6 === void 0 ? void 0 : _a6.altTextIsAutoGenerated) {
316843
+ delete node3.alt;
316844
+ }
316351
316845
  const nodeImageDirectiveKeys = Object.keys(node3).filter((k) => IMAGE_DIRECTIVE_OPTS.includes(k));
316352
316846
  if (!nodeImageDirectiveKeys.length)
316353
316847
  return handle5.image(node3, void 0, state, info);
@@ -316403,15 +316897,18 @@ function containerValidator(node3, file) {
316403
316897
  var FIGURE_OPTS = ["label", "class", "width", "align", "title", "alt", "placeholder"];
316404
316898
  var TABLE_KEYS = ["headerRows", "label", "class", "width", "align"];
316405
316899
  function container3(node3, _3, state, info) {
316406
- var _a6, _b, _c;
316900
+ var _a6, _b, _c, _d2;
316407
316901
  const captionNode = select("caption", node3);
316408
316902
  const legendNode = select("legend", node3);
316409
316903
  const children = [...(captionNode === null || captionNode === void 0 ? void 0 : captionNode.children) || [], ...(legendNode === null || legendNode === void 0 ? void 0 : legendNode.children) || []];
316410
316904
  if (node3.kind === "figure") {
316411
316905
  const imageNodes = selectAll("image", node3);
316412
316906
  const imageNode = imageNodes.find((img2) => !img2.placeholder);
316907
+ if ((_a6 = imageNode === null || imageNode === void 0 ? void 0 : imageNode.data) === null || _a6 === void 0 ? void 0 : _a6.altTextIsAutoGenerated) {
316908
+ delete imageNode.alt;
316909
+ }
316413
316910
  const placeholderNode = imageNodes.find((img2) => img2.placeholder);
316414
- const url = (_b = (_a6 = imageNode === null || imageNode === void 0 ? void 0 : imageNode.urlSource) !== null && _a6 !== void 0 ? _a6 : imageNode === null || imageNode === void 0 ? void 0 : imageNode.url) !== null && _b !== void 0 ? _b : `#${node3.source.label}`;
316911
+ const url = (_c = (_b = imageNode === null || imageNode === void 0 ? void 0 : imageNode.urlSource) !== null && _b !== void 0 ? _b : imageNode === null || imageNode === void 0 ? void 0 : imageNode.url) !== null && _c !== void 0 ? _c : `#${node3.source.label}`;
316415
316912
  if (!url)
316416
316913
  return "";
316417
316914
  const combinedNode = { type: "container", url, children };
@@ -316422,7 +316919,7 @@ function container3(node3, _3, state, info) {
316422
316919
  combinedNode[key2] = val;
316423
316920
  });
316424
316921
  if (placeholderNode) {
316425
- combinedNode["placeholder"] = (_c = placeholderNode.urlSource) !== null && _c !== void 0 ? _c : placeholderNode.url;
316922
+ combinedNode["placeholder"] = (_d2 = placeholderNode.urlSource) !== null && _d2 !== void 0 ? _d2 : placeholderNode.url;
316426
316923
  }
316427
316924
  const options = {
316428
316925
  argsKey: "url",
@@ -316567,12 +317064,32 @@ function tabItem2(node3, _3, state, info) {
316567
317064
  const handler = writeFlowDirective("tab-item", node3.title, { keys: ["sync", "selected"] });
316568
317065
  return handler(node3, _3, state, info);
316569
317066
  }
317067
+ function iframe3(node3, _3, state, info) {
317068
+ const handler = writeStaticDirective("iframe", { argsKey: "src", keys: IMAGE_DIRECTIVE_OPTS });
317069
+ return handler(node3, _3, state, info);
317070
+ }
317071
+ function aside(node3, _3, state, info) {
317072
+ var _a6;
317073
+ const name3 = (_a6 = node3.kind) !== null && _a6 !== void 0 ? _a6 : "aside";
317074
+ const admonitionTitle3 = select("admonitionTitle", node3);
317075
+ const args = admonitionTitle3 ? state.containerPhrasing(admonitionTitle3, info) : "";
317076
+ const nodeCopy = {
317077
+ ...node3,
317078
+ children: node3.children.filter((n) => n.type !== "admonitionTitle")
317079
+ };
317080
+ const options = {
317081
+ keys: ["class"]
317082
+ };
317083
+ return writeFlowDirective(name3, args, options)(nodeCopy, _3, state, info);
317084
+ }
316570
317085
  var directiveHandlers2 = {
316571
317086
  code: code6,
316572
317087
  image: image5,
316573
317088
  container: container3,
316574
317089
  admonition: admonition4,
316575
317090
  details: details2,
317091
+ iframe: iframe3,
317092
+ aside,
316576
317093
  card,
316577
317094
  grid: writeFlowDirective("grid", void 0, {
316578
317095
  keys: ["columns"],
@@ -316599,7 +317116,7 @@ function comment6(node3, _3, state) {
316599
317116
  });
316600
317117
  }
316601
317118
  function block4(node3, _3, state, info) {
316602
- if (node3.visibility === "remove")
317119
+ if (node3.visibility === "remove" || node3.visibility === "hide")
316603
317120
  return "";
316604
317121
  const meta2 = node3.meta ? ` ${node3.meta}` : "";
316605
317122
  const content3 = state.containerFlow(node3, info);
@@ -316653,7 +317170,7 @@ function labelWrapper(handler) {
316653
317170
  const ident = (_a6 = node3.identifier) !== null && _a6 !== void 0 ? _a6 : node3.label;
316654
317171
  const prefix2 = ident ? `(${ident})=
316655
317172
  ` : "";
316656
- return `${prefix2}${handler(node3, _3, state, info)}`;
317173
+ return `${node3.implicit ? "" : prefix2}${handler(node3, _3, state, info)}`;
316657
317174
  };
316658
317175
  }
316659
317176
  function crossReference3(node3, _3, state, info) {
@@ -316955,7 +317472,7 @@ function frontmatterToCFF(frontmatter, abstract) {
316955
317472
  let dateString;
316956
317473
  if (frontmatter.date) {
316957
317474
  const date = new Date(frontmatter.date);
316958
- dateString = new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1e3).toISOString().split("T")[0];
317475
+ dateString = new Date(date.getTime()).toISOString().split("T")[0];
316959
317476
  }
316960
317477
  const { title, authors } = frontmatter;
316961
317478
  if (!title) {
@@ -317614,6 +318131,8 @@ async function startServer(session, opts) {
317614
318131
  }
317615
318132
 
317616
318133
  // ../myst-cli/dist/build/html/index.js
318134
+ var import_p_limit2 = __toESM(require_p_limit(), 1);
318135
+ var limitConnections = (0, import_p_limit2.default)(5);
317617
318136
  async function currentSiteRoutes(session, host, baseurl, opts) {
317618
318137
  var _a6, _b;
317619
318138
  const manifest = await getSiteManifest(session, opts);
@@ -317703,8 +318222,8 @@ async function buildHtml(session, opts) {
317703
318222
  return;
317704
318223
  const host = `http://localhost:${appServer.port}`;
317705
318224
  const routes = await currentSiteRoutes(session, host, baseurl, opts);
317706
- await Promise.all(routes.map(async (route) => {
317707
- const resp = await session.fetch(route.url);
318225
+ await Promise.all(routes.map(async (route) => limitConnections(async () => {
318226
+ const resp = await fetchWithRetry(session, route.url);
317708
318227
  if (!resp.ok) {
317709
318228
  session.log.error(`Error fetching ${route.url}`);
317710
318229
  return;
@@ -317722,7 +318241,7 @@ async function buildHtml(session, opts) {
317722
318241
  const content3 = await resp.text();
317723
318242
  writeFileToFolder(import_node_path57.default.join(htmlDir, route.path), content3);
317724
318243
  }
317725
- }));
318244
+ })));
317726
318245
  appServer.stop();
317727
318246
  const templateBuildDir = import_node_path57.default.join(template.templatePath, "public");
317728
318247
  import_fs_extra.default.copySync(templateBuildDir, htmlDir);
@@ -320498,6 +321017,7 @@ async function checkAtGitRoot() {
320498
321017
  // ../myst-cli/dist/init/gh-actions/index.js
320499
321018
  function createGithubPagesAction({ defaultBranch = "main", username = "username", isGithubIO }) {
320500
321019
  return `# This file was created automatically with \`myst init --gh-pages\` \u{1FA84} \u{1F49A}
321020
+ # Ensure your GitHub Pages settings for this repository are set to deploy with **GitHub Actions**.
320501
321021
 
320502
321022
  name: MyST GitHub Pages Deploy
320503
321023
  on:
@@ -332228,7 +332748,7 @@ function boxen(text7, options) {
332228
332748
 
332229
332749
  // ../myst-cli/dist/session/session.js
332230
332750
  var import_https_proxy_agent = __toESM(require_dist5(), 1);
332231
- var import_p_limit2 = __toESM(require_p_limit(), 1);
332751
+ var import_p_limit3 = __toESM(require_p_limit(), 1);
332232
332752
  var import_services = __toESM(require_lib27(), 1);
332233
332753
  if (!globalThis.fetch) {
332234
332754
  globalThis.fetch = fetch2;
@@ -332241,13 +332761,23 @@ var API_URL = "https://api.mystmd.org";
332241
332761
  var NPM_COMMAND = "npm i -g mystmd@latest";
332242
332762
  var PIP_COMMAND = "pip install -U mystmd";
332243
332763
  var LOCALHOSTS = ["localhost", "127.0.0.1", "::1"];
332244
- function logUpdateAvailable({ current: current2, latest: latest2, upgradeCommand, twitter }) {
332764
+ function socialLink({ twitter, bsky }) {
332765
+ if (bsky) {
332766
+ return `Follow ${source_default.yellowBright(`@${bsky}`)} for updates!
332767
+ https://bsky.app/profile/${bsky}`;
332768
+ }
332769
+ if (twitter) {
332770
+ return `Follow ${source_default.yellowBright(`@${twitter}`)} for updates!
332771
+ https://x.com/${twitter}`;
332772
+ }
332773
+ return "";
332774
+ }
332775
+ function logUpdateAvailable({ current: current2, latest: latest2, upgradeCommand, twitter, bsky }) {
332245
332776
  return boxen(`Update available! ${source_default.dim(`v${current2}`)} \u226B ${source_default.green.bold(`v${latest2}`)}
332246
332777
 
332247
332778
  Run \`${source_default.cyanBright.bold(upgradeCommand)}\` to update.
332248
332779
 
332249
- Follow ${source_default.yellowBright(`@${twitter}`)} for updates!
332250
- https://twitter.com/${twitter}`, {
332780
+ ${socialLink({ bsky, twitter })}`, {
332251
332781
  padding: 1,
332252
332782
  margin: 1,
332253
332783
  borderColor: "green",
@@ -332266,7 +332796,7 @@ var Session = class {
332266
332796
  this.API_URL = API_URL;
332267
332797
  this.configFiles = CONFIG_FILES;
332268
332798
  this.$logger = (_a6 = opts.logger) !== null && _a6 !== void 0 ? _a6 : chalkLogger(LogLevel.info, process.cwd());
332269
- this.doiLimiter = (_b = opts.doiLimiter) !== null && _b !== void 0 ? _b : (0, import_p_limit2.default)(3);
332799
+ this.doiLimiter = (_b = opts.doiLimiter) !== null && _b !== void 0 ? _b : (0, import_p_limit3.default)(3);
332270
332800
  const proxyUrl = process.env.HTTPS_PROXY;
332271
332801
  if (proxyUrl)
332272
332802
  this.proxyAgent = new import_https_proxy_agent.HttpsProxyAgent(proxyUrl);
@@ -332282,7 +332812,7 @@ var Session = class {
332282
332812
  current: version_default2,
332283
332813
  latest: this._latestVersion,
332284
332814
  upgradeCommand: process.env.MYST_LANG === "PYTHON" ? PIP_COMMAND : NPM_COMMAND,
332285
- twitter: "MystMarkdown"
332815
+ bsky: "mystmd.org"
332286
332816
  }));
332287
332817
  this._shownUpgrade = true;
332288
332818
  }
@@ -332377,14 +332907,8 @@ var Session = class {
332377
332907
  token: process.env.JUPYTER_TOKEN
332378
332908
  };
332379
332909
  } else {
332380
- const existing = await findExistingJupyterServer(this);
332381
- if (existing) {
332382
- this.log.debug(`Found existing server on: ${existing.appUrl}`);
332383
- partialServerSettings = existing;
332384
- } else {
332385
- this.log.debug(`Launching jupyter server on ${this.sourcePath()}`);
332386
- partialServerSettings = await launchJupyterServer(this.sourcePath(), this.log);
332387
- }
332910
+ this.log.debug(`Launching jupyter server on ${this.sourcePath()}`);
332911
+ partialServerSettings = await launchJupyterServer(this.sourcePath(), this.log);
332388
332912
  }
332389
332913
  const serverSettings = import_services.ServerConnection.makeSettings(partialServerSettings);
332390
332914
  const kernelManager = new import_services.KernelManager({ serverSettings });