mystmd 1.2.7__tar.gz → 1.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mystmd
3
- Version: 1.2.7
3
+ Version: 1.2.8
4
4
  Summary: Command line tools for MyST Markdown
5
5
  Project-URL: Homepage, https://github.com/executablebooks/mystmd
6
6
  Project-URL: Bug Tracker, https://github.com/executablebooks/mystmd/issues
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mystmd",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "Command line tools for MyST Markdown",
5
5
  "author": "Rowan Cockett <rowan@curvenote.com>",
6
6
  "license": "MIT",
@@ -45,6 +45,6 @@
45
45
  "commander": "^10.0.1",
46
46
  "core-js": "^3.31.1",
47
47
  "js-yaml": "^4.1.0",
48
- "myst-cli": "^1.2.7"
48
+ "myst-cli": "^1.2.8"
49
49
  }
50
50
  }
@@ -193305,7 +193305,7 @@ var {
193305
193305
  } = import_index.default;
193306
193306
 
193307
193307
  // src/version.ts
193308
- var version = "1.2.7";
193308
+ var version = "1.2.8";
193309
193309
  var version_default = version;
193310
193310
 
193311
193311
  // ../myst-cli/dist/build/build.js
@@ -198615,36 +198615,18 @@ function validatePageFrontmatter(input3, opts) {
198615
198615
  function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
198616
198616
  return fillProjectFrontmatter(pageFrontmatter, projectFrontmatter, opts, USE_PROJECT_FALLBACK);
198617
198617
  }
198618
- function fillProjectFrontmatter(base5, filler, opts, keys2) {
198619
- var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x2;
198618
+ function fillSiteFrontmatter(base5, filler, opts, keys2) {
198619
+ var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
198620
198620
  const frontmatter = fillMissingKeys(base5, filler, keys2 !== null && keys2 !== void 0 ? keys2 : Object.keys(filler));
198621
- if (filler.numbering || base5.numbering) {
198622
- frontmatter.numbering = fillNumbering(base5.numbering, filler.numbering);
198623
- }
198624
- if (filler.math || base5.math) {
198625
- frontmatter.math = { ...(_a6 = filler.math) !== null && _a6 !== void 0 ? _a6 : {}, ...(_b = base5.math) !== null && _b !== void 0 ? _b : {} };
198626
- }
198627
- if (filler.abbreviations || base5.abbreviations) {
198628
- frontmatter.abbreviations = {
198629
- ...(_c = filler.abbreviations) !== null && _c !== void 0 ? _c : {},
198630
- ...(_d2 = base5.abbreviations) !== null && _d2 !== void 0 ? _d2 : {}
198631
- };
198632
- }
198633
198621
  if (filler.options || base5.options) {
198634
198622
  frontmatter.options = {
198635
- ...(_e = filler.options) !== null && _e !== void 0 ? _e : {},
198636
- ...(_f = base5.options) !== null && _f !== void 0 ? _f : {}
198637
- };
198638
- }
198639
- if (filler.settings || base5.settings) {
198640
- frontmatter.settings = {
198641
- ...(_g = filler.settings) !== null && _g !== void 0 ? _g : {},
198642
- ...(_h = base5.settings) !== null && _h !== void 0 ? _h : {}
198623
+ ...(_a6 = filler.options) !== null && _a6 !== void 0 ? _a6 : {},
198624
+ ...(_b = base5.options) !== null && _b !== void 0 ? _b : {}
198643
198625
  };
198644
198626
  }
198645
198627
  const contributorIds = /* @__PURE__ */ new Set();
198646
198628
  const affiliationIds = /* @__PURE__ */ new Set();
198647
- (_j = frontmatter.funding) === null || _j === void 0 ? void 0 : _j.forEach((fund) => {
198629
+ (_c = frontmatter.funding) === null || _c === void 0 ? void 0 : _c.forEach((fund) => {
198648
198630
  var _a7;
198649
198631
  (_a7 = fund.awards) === null || _a7 === void 0 ? void 0 : _a7.forEach((award) => {
198650
198632
  var _a8, _b2, _c2;
@@ -198659,18 +198641,18 @@ function fillProjectFrontmatter(base5, filler, opts, keys2) {
198659
198641
  });
198660
198642
  });
198661
198643
  });
198662
- (_k = frontmatter.reviewers) === null || _k === void 0 ? void 0 : _k.forEach((reviewer) => {
198644
+ (_d2 = frontmatter.reviewers) === null || _d2 === void 0 ? void 0 : _d2.forEach((reviewer) => {
198663
198645
  contributorIds.add(reviewer);
198664
198646
  });
198665
- (_l = frontmatter.editors) === null || _l === void 0 ? void 0 : _l.forEach((editor) => {
198647
+ (_e = frontmatter.editors) === null || _e === void 0 ? void 0 : _e.forEach((editor) => {
198666
198648
  contributorIds.add(editor);
198667
198649
  });
198668
- if (((_m = frontmatter.authors) === null || _m === void 0 ? void 0 : _m.length) || contributorIds.size) {
198650
+ if (((_f = frontmatter.authors) === null || _f === void 0 ? void 0 : _f.length) || contributorIds.size) {
198669
198651
  const people = [
198670
- ...(_o = base5.authors) !== null && _o !== void 0 ? _o : [],
198671
- ...(_p = filler.authors) !== null && _p !== void 0 ? _p : [],
198672
- ...(_q = base5.contributors) !== null && _q !== void 0 ? _q : [],
198673
- ...(_r = filler.contributors) !== null && _r !== void 0 ? _r : []
198652
+ ...(_g = base5.authors) !== null && _g !== void 0 ? _g : [],
198653
+ ...(_h = filler.authors) !== null && _h !== void 0 ? _h : [],
198654
+ ...(_j = base5.contributors) !== null && _j !== void 0 ? _j : [],
198655
+ ...(_k = filler.contributors) !== null && _k !== void 0 ? _k : []
198674
198656
  ];
198675
198657
  const peopleLookup = {};
198676
198658
  people.forEach((auth) => {
@@ -198682,7 +198664,7 @@ function fillProjectFrontmatter(base5, filler, opts, keys2) {
198682
198664
  validationWarning(`Duplicate contributor id within project: ${auth.id}`, incrementOptions("authors", opts));
198683
198665
  }
198684
198666
  });
198685
- if ((_s = frontmatter.authors) === null || _s === void 0 ? void 0 : _s.length) {
198667
+ if ((_l = frontmatter.authors) === null || _l === void 0 ? void 0 : _l.length) {
198686
198668
  frontmatter.authors = frontmatter.authors.map((auth) => {
198687
198669
  var _a7;
198688
198670
  if (!auth.id)
@@ -198698,18 +198680,18 @@ function fillProjectFrontmatter(base5, filler, opts, keys2) {
198698
198680
  });
198699
198681
  }
198700
198682
  }
198701
- [...(_t = frontmatter.authors) !== null && _t !== void 0 ? _t : [], ...(_u = frontmatter.contributors) !== null && _u !== void 0 ? _u : []].forEach((auth) => {
198683
+ [...(_m = frontmatter.authors) !== null && _m !== void 0 ? _m : [], ...(_o = frontmatter.contributors) !== null && _o !== void 0 ? _o : []].forEach((auth) => {
198702
198684
  var _a7;
198703
198685
  (_a7 = auth.affiliations) === null || _a7 === void 0 ? void 0 : _a7.forEach((aff) => {
198704
198686
  affiliationIds.add(aff);
198705
198687
  });
198706
198688
  });
198707
- (_v = frontmatter.affiliations) === null || _v === void 0 ? void 0 : _v.forEach((aff) => {
198689
+ (_p = frontmatter.affiliations) === null || _p === void 0 ? void 0 : _p.forEach((aff) => {
198708
198690
  if (aff.id)
198709
198691
  affiliationIds.add(aff.id);
198710
198692
  });
198711
198693
  if (affiliationIds.size) {
198712
- const affiliations2 = [...(_w = base5.affiliations) !== null && _w !== void 0 ? _w : [], ...(_x2 = filler.affiliations) !== null && _x2 !== void 0 ? _x2 : []];
198694
+ const affiliations2 = [...(_q = base5.affiliations) !== null && _q !== void 0 ? _q : [], ...(_r = filler.affiliations) !== null && _r !== void 0 ? _r : []];
198713
198695
  const affiliationLookup = {};
198714
198696
  affiliations2.forEach((aff) => {
198715
198697
  if (!aff.id || isStashPlaceholder(aff))
@@ -198727,6 +198709,29 @@ function fillProjectFrontmatter(base5, filler, opts, keys2) {
198727
198709
  }
198728
198710
  return frontmatter;
198729
198711
  }
198712
+ function fillProjectFrontmatter(base5, filler, opts, keys2) {
198713
+ var _a6, _b, _c, _d2, _e, _f;
198714
+ const frontmatter = fillSiteFrontmatter(base5, filler, opts, keys2 !== null && keys2 !== void 0 ? keys2 : Object.keys(filler));
198715
+ if (filler.numbering || base5.numbering) {
198716
+ frontmatter.numbering = fillNumbering(base5.numbering, filler.numbering);
198717
+ }
198718
+ if (filler.math || base5.math) {
198719
+ frontmatter.math = { ...(_a6 = filler.math) !== null && _a6 !== void 0 ? _a6 : {}, ...(_b = base5.math) !== null && _b !== void 0 ? _b : {} };
198720
+ }
198721
+ if (filler.abbreviations || base5.abbreviations) {
198722
+ frontmatter.abbreviations = {
198723
+ ...(_c = filler.abbreviations) !== null && _c !== void 0 ? _c : {},
198724
+ ...(_d2 = base5.abbreviations) !== null && _d2 !== void 0 ? _d2 : {}
198725
+ };
198726
+ }
198727
+ if (filler.settings || base5.settings) {
198728
+ frontmatter.settings = {
198729
+ ...(_e = filler.settings) !== null && _e !== void 0 ? _e : {},
198730
+ ...(_f = base5.settings) !== null && _f !== void 0 ? _f : {}
198731
+ };
198732
+ }
198733
+ return frontmatter;
198734
+ }
198730
198735
 
198731
198736
  // ../myst-frontmatter/dist/utils/unnestKernelSpec.js
198732
198737
  function unnestKernelSpec(pageFrontmatter) {
@@ -220934,6 +220939,15 @@ var defaultHtmlToMdastOptions = {
220934
220939
  attrs.alt = node3.properties.alt;
220935
220940
  return h4(node3, "image", attrs);
220936
220941
  },
220942
+ video(h4, node3) {
220943
+ const attrs = addClassAndIdentifier(node3);
220944
+ attrs.url = String(node3.properties.src || "");
220945
+ if (node3.properties.title)
220946
+ attrs.title = node3.properties.title;
220947
+ if (node3.properties.alt)
220948
+ attrs.alt = node3.properties.alt;
220949
+ return h4(node3, "image", attrs);
220950
+ },
220937
220951
  figure(h4, node3) {
220938
220952
  const attrs = addClassAndIdentifier(node3);
220939
220953
  return h4(node3, "container", attrs, all5(h4, node3));
@@ -240572,8 +240586,8 @@ function configValidationOpts(vfile2, property, ruleId) {
240572
240586
  }
240573
240587
  };
240574
240588
  }
240575
- function fillSiteConfig(base5, filler) {
240576
- return fillMissingKeys(base5, filler, Object.keys(filler));
240589
+ function fillSiteConfig(base5, filler, opts) {
240590
+ return fillSiteFrontmatter(base5, filler, opts, Object.keys(filler));
240577
240591
  }
240578
240592
  async function getValidatedConfigsFromFile(session, file, vfile2, stack) {
240579
240593
  var _a6, _b, _c, _d2;
@@ -240636,7 +240650,7 @@ async function getValidatedConfigsFromFile(session, file, vfile2, stack) {
240636
240650
  const { site: extSite, project: extProject } = await getValidatedConfigsFromFile(session, extFile, vfile2, stack);
240637
240651
  session.store.dispatch(config.actions.receiveConfigExtension({ file: extFile }));
240638
240652
  if (extSite) {
240639
- site = site ? fillSiteConfig(extSite, site) : extSite;
240653
+ site = site ? fillSiteConfig(extSite, site, incrementOptions("extend", opts)) : extSite;
240640
240654
  }
240641
240655
  if (extProject) {
240642
240656
  project = project ? fillProjectFrontmatter(extProject, project, projectOpts) : extProject;
@@ -240646,7 +240660,7 @@ async function getValidatedConfigsFromFile(session, file, vfile2, stack) {
240646
240660
  const { site: rawSite, project: rawProject } = conf !== null && conf !== void 0 ? conf : {};
240647
240661
  const path41 = (0, import_node_path8.dirname)(file);
240648
240662
  if (rawSite) {
240649
- site = fillSiteConfig(await validateSiteConfigAndThrow(session, path41, vfile2, rawSite), site !== null && site !== void 0 ? site : {});
240663
+ site = fillSiteConfig(await validateSiteConfigAndThrow(session, path41, vfile2, rawSite), site !== null && site !== void 0 ? site : {}, incrementOptions("extend", opts));
240650
240664
  }
240651
240665
  if (site) {
240652
240666
  session.log.debug(`Loaded site config from ${file}`);
@@ -240694,12 +240708,12 @@ async function loadConfig(session, path41, opts) {
240694
240708
  async function resolveToAbsolute(session, basePath, relativePath, opts) {
240695
240709
  let message;
240696
240710
  if ((opts === null || opts === void 0 ? void 0 : opts.allowRemote) && isUrl(relativePath)) {
240697
- const cacheFilename = `config-item-${computeHash(relativePath)}${(0, import_node_path8.extname)(relativePath)}`;
240711
+ const cacheFilename = `config-item-${computeHash(relativePath)}${(0, import_node_path8.extname)(new URL(relativePath).pathname)}`;
240698
240712
  if (!loadFromCache(session, cacheFilename, { maxAge: 30 })) {
240699
240713
  try {
240700
240714
  const resp = await session.fetch(relativePath);
240701
240715
  if (resp.ok) {
240702
- writeToCache(session, cacheFilename, await resp.text());
240716
+ writeToCache(session, cacheFilename, Buffer.from(await resp.arrayBuffer()));
240703
240717
  } else {
240704
240718
  message = `Bad response from config URL: ${relativePath}`;
240705
240719
  }
@@ -287772,7 +287786,7 @@ var import_node_path16 = __toESM(require("path"), 1);
287772
287786
  var import_nbtx = __toESM(require_cjs2(), 1);
287773
287787
 
287774
287788
  // ../myst-cli/dist/version.js
287775
- var version2 = "1.2.7";
287789
+ var version2 = "1.2.8";
287776
287790
  var version_default2 = version2;
287777
287791
 
287778
287792
  // ../myst-cli/dist/utils/headers.js
@@ -297841,6 +297855,8 @@ function validateFile(session, input3, opts) {
297841
297855
  const filename = validateString(input3, opts);
297842
297856
  if (!filename)
297843
297857
  return;
297858
+ if (opts.allowRemote && isUrl(filename))
297859
+ return filename;
297844
297860
  let resolvedFile;
297845
297861
  if (opts.file) {
297846
297862
  resolvedFile = import_node_path23.default.resolve(import_node_path23.default.dirname(opts.file), filename);
@@ -299021,7 +299037,7 @@ async function resolveTemplateFileOptions(session, mystTemplate, options) {
299021
299037
  await Promise.all(((_a6 = mystTemplate.getValidatedTemplateYml().options) !== null && _a6 !== void 0 ? _a6 : []).map(async (option3) => {
299022
299038
  if (option3.type === TemplateOptionType.file && options[option3.id]) {
299023
299039
  const configPath = selectors_exports.selectCurrentSitePath(session.store.getState());
299024
- const absPath = configPath ? await resolveToAbsolute(session, configPath, options[option3.id]) : options[option3.id];
299040
+ const absPath = configPath ? await resolveToAbsolute(session, configPath, options[option3.id], { allowRemote: true }) : options[option3.id];
299025
299041
  const fileHash = hashAndCopyStaticFile(session, absPath, session.publicPath(), (m2) => {
299026
299042
  addWarningForFile(session, options[option3.id], m2, "error", {
299027
299043
  ruleId: RuleId.templateFileCopied
@@ -299117,7 +299133,7 @@ async function getSiteManifest(session, opts) {
299117
299133
  const actions = (_c = siteConfig.actions) === null || _c === void 0 ? void 0 : _c.map((action) => resolveSiteAction(session, action, siteConfigFile, "actions")).filter((action) => !!action);
299118
299134
  const siteFrontmatter = filterKeys(siteConfig, SITE_FRONTMATTER_KEYS);
299119
299135
  const mystTemplate = await getMystTemplate(session, opts);
299120
- const validatedOptions = mystTemplate.validateOptions((_d2 = siteFrontmatter.options) !== null && _d2 !== void 0 ? _d2 : {}, siteConfigFile);
299136
+ const validatedOptions = mystTemplate.validateOptions((_d2 = siteFrontmatter.options) !== null && _d2 !== void 0 ? _d2 : {}, siteConfigFile, { allowRemote: true });
299121
299137
  const validatedFrontmatter = mystTemplate.validateDoc(siteFrontmatter, validatedOptions, void 0, siteConfigFile);
299122
299138
  const resolvedOptions = await resolveTemplateFileOptions(session, mystTemplate, validatedOptions);
299123
299139
  validatedFrontmatter.options = resolvedOptions;
@@ -314506,6 +314522,7 @@ function get_baseurl(session) {
314506
314522
  return baseurl;
314507
314523
  }
314508
314524
  async function buildHtml(session, opts) {
314525
+ var _a6;
314509
314526
  const template = await getMystTemplate(session, opts);
314510
314527
  const baseurl = get_baseurl(session);
314511
314528
  const htmlDir = import_node_path54.default.join(session.buildPath(), "html");
@@ -314531,7 +314548,12 @@ async function buildHtml(session, opts) {
314531
314548
  import_fs_extra.default.copySync(session.publicPath(), import_node_path54.default.join(htmlDir, "build"));
314532
314549
  import_fs_extra.default.copySync(import_node_path54.default.join(session.sitePath(), "config.json"), import_node_path54.default.join(htmlDir, "config.json"));
314533
314550
  import_fs_extra.default.copySync(import_node_path54.default.join(session.sitePath(), "objects.inv"), import_node_path54.default.join(htmlDir, "objects.inv"));
314534
- import_fs_extra.default.copySync(import_node_path54.default.join(session.sitePath(), "myst.xref.json"), import_node_path54.default.join(htmlDir, "myst.xref.json"));
314551
+ const xrefs = JSON.parse(import_fs_extra.default.readFileSync(import_node_path54.default.join(session.sitePath(), "myst.xref.json")).toString());
314552
+ (_a6 = xrefs.references) === null || _a6 === void 0 ? void 0 : _a6.forEach((ref) => {
314553
+ var _a7;
314554
+ ref.data = (_a7 = ref.data) === null || _a7 === void 0 ? void 0 : _a7.replace(/^\/content/, "");
314555
+ });
314556
+ import_fs_extra.default.writeFileSync(import_node_path54.default.join(htmlDir, "myst.xref.json"), JSON.stringify(xrefs));
314535
314557
  rewriteAssetsFolder(htmlDir, baseurl);
314536
314558
  process.exit(0);
314537
314559
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes