mystmd 1.5.1__tar.gz → 1.6.1__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.4
2
2
  Name: mystmd
3
- Version: 1.5.1
3
+ Version: 1.6.1
4
4
  Summary: Command line tools for MyST Markdown
5
5
  Project-URL: Homepage, https://github.com/jupyter-book/mystmd
6
6
  Project-URL: Bug Tracker, https://github.com/jupyter-book/mystmd/issues
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mystmd",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
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.5.1"
48
+ "myst-cli": "^1.6.1"
49
49
  }
50
50
  }
@@ -193391,7 +193391,7 @@ var {
193391
193391
  } = import_index.default;
193392
193392
 
193393
193393
  // src/version.ts
193394
- var version = "1.5.1";
193394
+ var version = "1.6.1";
193395
193395
  var version_default = version;
193396
193396
 
193397
193397
  // ../myst-cli/dist/build/build.js
@@ -195264,6 +195264,7 @@ var PROJECT_AND_PAGE_FRONTMATTER_KEYS = [
195264
195264
  "settings",
195265
195265
  // We maybe want to move this into site frontmatter in the future
195266
195266
  "edit_url",
195267
+ "source_url",
195267
195268
  ...KNOWN_EXTERNAL_IDENTIFIERS,
195268
195269
  // Do not add any project specific keys here!
195269
195270
  ...SITE_FRONTMATTER_KEYS
@@ -199366,6 +199367,11 @@ function validateProjectAndPageFrontmatterKeys(value, opts) {
199366
199367
  } else if (defined(value.edit_url)) {
199367
199368
  output2.edit_url = validateUrl(value.edit_url, incrementOptions("edit_url", opts));
199368
199369
  }
199370
+ if (value.source_url === null) {
199371
+ output2.source_url = null;
199372
+ } else if (defined(value.source_url)) {
199373
+ output2.source_url = validateUrl(value.source_url, incrementOptions("source_url", opts));
199374
+ }
199369
199375
  return output2;
199370
199376
  }
199371
199377
  function validateProjectFrontmatterKeys(value, opts) {
@@ -205195,10 +205201,19 @@ function buffer(value) {
205195
205201
 
205196
205202
  // ../myst-transforms/dist/admonitions.js
205197
205203
  var githubAdmonitionKinds = ["note", "tip", "important", "warning", "caution"];
205204
+ function getPossibleAdmonitionHeaderChildren(possibleHeading) {
205205
+ var _a6;
205206
+ if ((possibleHeading === null || possibleHeading === void 0 ? void 0 : possibleHeading.type) === "paragraph" && ((_a6 = possibleHeading.children) === null || _a6 === void 0 ? void 0 : _a6.length) === 1 && possibleHeading.children[0].type === "strong") {
205207
+ return possibleHeading.children[0].children;
205208
+ } else if ((possibleHeading === null || possibleHeading === void 0 ? void 0 : possibleHeading.type) === "heading") {
205209
+ return possibleHeading.children;
205210
+ }
205211
+ return void 0;
205212
+ }
205198
205213
  function admonitionHeadersTransform(tree, opts) {
205199
205214
  const admonitions = selectAll("admonition", tree);
205200
205215
  admonitions.forEach((node3) => {
205201
- var _a6, _b, _c, _d2, _e;
205216
+ var _a6, _b, _c, _d2;
205202
205217
  if (!node3.kind || node3.kind === AdmonitionKind.admonition || // This condition is legacy
205203
205218
  ((_b = (_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6[0]) === null || _b === void 0 ? void 0 : _b.type) === "admonitionTitle") {
205204
205219
  return;
@@ -205212,12 +205227,9 @@ function admonitionHeadersTransform(tree, opts) {
205212
205227
  ];
205213
205228
  if ((_d2 = opts === null || opts === void 0 ? void 0 : opts.replaceAdmonitionTitles) !== null && _d2 !== void 0 ? _d2 : true) {
205214
205229
  const [admonitionHeader, possibleHeading, ...rest] = node3.children;
205215
- if ((possibleHeading === null || possibleHeading === void 0 ? void 0 : possibleHeading.type) === "paragraph" && ((_e = possibleHeading.children) === null || _e === void 0 ? void 0 : _e.length) === 1 && possibleHeading.children[0].type === "strong") {
205216
- const strongTextChildren = possibleHeading.children[0].children;
205217
- admonitionHeader.children = strongTextChildren;
205218
- node3.children = [admonitionHeader, ...rest];
205219
- } else if ((possibleHeading === null || possibleHeading === void 0 ? void 0 : possibleHeading.type) === "heading") {
205220
- admonitionHeader.children = possibleHeading.children;
205230
+ const headerChildren = getPossibleAdmonitionHeaderChildren(possibleHeading);
205231
+ if (headerChildren) {
205232
+ admonitionHeader.children = headerChildren;
205221
205233
  node3.children = [admonitionHeader, ...rest];
205222
205234
  }
205223
205235
  }
@@ -238747,17 +238759,29 @@ function listFromPages(pages, projectSlug) {
238747
238759
  function listItemFromPages(pages, projectSlug) {
238748
238760
  if (pages.length === 0)
238749
238761
  return;
238750
- const { title, slug, enumerator, level } = pages[0];
238762
+ const { title, slug, url, enumerator, level } = pages[0];
238751
238763
  const text7 = {
238752
238764
  type: "text",
238753
238765
  value: `${enumerator ? `${enumerator} ` : ""}${title}`
238754
238766
  };
238755
- const child = slug != null ? {
238756
- type: "link",
238757
- url: `${projectSlug ? `/${projectSlug}` : ""}/${slug}`,
238758
- internal: true,
238759
- children: [text7]
238760
- } : text7;
238767
+ let child;
238768
+ if (url != null) {
238769
+ child = {
238770
+ type: "link",
238771
+ url,
238772
+ internal: false,
238773
+ children: [text7]
238774
+ };
238775
+ } else if (slug != null) {
238776
+ child = {
238777
+ type: "link",
238778
+ url: `${projectSlug ? `/${projectSlug}` : ""}/${slug}`,
238779
+ internal: true,
238780
+ children: [text7]
238781
+ };
238782
+ } else {
238783
+ child = text7;
238784
+ }
238761
238785
  const item = {
238762
238786
  type: "listItem",
238763
238787
  children: [child]
@@ -288324,6 +288348,60 @@ function getTokenHandlers(specHandlers) {
288324
288348
  return handlers6;
288325
288349
  }
288326
288350
 
288351
+ // ../myst-parser/dist/transforms/listItemParagraphs.js
288352
+ function listItemParagraphsTransform(tree) {
288353
+ selectAll("listItem", tree).forEach((node3) => {
288354
+ if (!node3.children || node3.children.length === 0)
288355
+ return;
288356
+ const phrasingTypes2 = /* @__PURE__ */ new Set([
288357
+ "text",
288358
+ "emphasis",
288359
+ "strong",
288360
+ "delete",
288361
+ "link",
288362
+ "image",
288363
+ "break",
288364
+ "subscript",
288365
+ "superscript",
288366
+ "smallcaps",
288367
+ "inlineCode",
288368
+ "inlineMath",
288369
+ "mystRole",
288370
+ "footnoteReference",
288371
+ "crossReference",
288372
+ "cite",
288373
+ "citeGroup",
288374
+ "html"
288375
+ ]);
288376
+ const hasPhrasingContent = node3.children.some((child) => phrasingTypes2.has(child.type));
288377
+ if (hasPhrasingContent) {
288378
+ const newChildren = [];
288379
+ let currentPhrasingGroup = [];
288380
+ node3.children.forEach((child) => {
288381
+ if (phrasingTypes2.has(child.type)) {
288382
+ currentPhrasingGroup.push(child);
288383
+ } else {
288384
+ if (currentPhrasingGroup.length > 0) {
288385
+ newChildren.push({
288386
+ type: "paragraph",
288387
+ children: currentPhrasingGroup
288388
+ });
288389
+ currentPhrasingGroup = [];
288390
+ }
288391
+ newChildren.push(child);
288392
+ }
288393
+ });
288394
+ if (currentPhrasingGroup.length > 0) {
288395
+ newChildren.push({
288396
+ type: "paragraph",
288397
+ children: currentPhrasingGroup
288398
+ });
288399
+ }
288400
+ node3.children = newChildren;
288401
+ }
288402
+ });
288403
+ }
288404
+
288327
288405
  // ../myst-parser/dist/tokensToMyst.js
288328
288406
  function computeAmsmathTightness(src, map14) {
288329
288407
  var _a6;
@@ -288823,6 +288901,7 @@ function nestSingleImagesIntoParagraphs(tree) {
288823
288901
  var defaultOptions2 = {
288824
288902
  handlers: defaultMdast,
288825
288903
  hoistSingleImagesOutofParagraphs: true,
288904
+ listItemParagraphs: true,
288826
288905
  nestBlocks: true
288827
288906
  };
288828
288907
  function tokensToMyst(src, tokens, options = defaultOptions2) {
@@ -288852,6 +288931,9 @@ function tokensToMyst(src, tokens, options = defaultOptions2) {
288852
288931
  }
288853
288932
  }
288854
288933
  });
288934
+ if (opts.listItemParagraphs) {
288935
+ listItemParagraphsTransform(tree);
288936
+ }
288855
288937
  visit(tree, "crossReference", (node3) => {
288856
288938
  delete node3.children;
288857
288939
  if (node3.value) {
@@ -289778,11 +289860,9 @@ var tabItemDirective = {
289778
289860
  var tabDirectives = [tabSetDirective, tabItemDirective];
289779
289861
 
289780
289862
  // ../myst-cli/dist/process/myst.js
289781
- function parseMyst(session, content3, file, opts) {
289863
+ function getMystParserOptions(session, opts) {
289782
289864
  var _a6, _b, _c, _d2;
289783
- const vfile2 = new VFile();
289784
- vfile2.path = file;
289785
- const parsed = mystParse(content3, {
289865
+ return {
289786
289866
  markdownit: { linkify: true },
289787
289867
  directives: [
289788
289868
  cardDirective,
@@ -289795,9 +289875,14 @@ function parseMyst(session, content3, file, opts) {
289795
289875
  extensions: {
289796
289876
  frontmatter: !(opts === null || opts === void 0 ? void 0 : opts.ignoreFrontmatter)
289797
289877
  },
289798
- roles: [buttonRole, ...(_d2 = (_c = session.plugins) === null || _c === void 0 ? void 0 : _c.roles) !== null && _d2 !== void 0 ? _d2 : []],
289799
- vfile: vfile2
289800
- });
289878
+ roles: [buttonRole, ...(_d2 = (_c = session.plugins) === null || _c === void 0 ? void 0 : _c.roles) !== null && _d2 !== void 0 ? _d2 : []]
289879
+ };
289880
+ }
289881
+ function parseMyst(session, content3, file, opts) {
289882
+ const vfile2 = new VFile();
289883
+ vfile2.path = file;
289884
+ const parserOptions = getMystParserOptions(session, opts);
289885
+ const parsed = mystParse(content3, { ...parserOptions, vfile: vfile2 });
289801
289886
  logMessagesFromVFile(session, vfile2);
289802
289887
  return parsed;
289803
289888
  }
@@ -289981,7 +290066,7 @@ var import_mime_types = __toESM(require_mime_types(), 1);
289981
290066
  var import_node_path16 = __toESM(require("path"), 1);
289982
290067
 
289983
290068
  // ../myst-cli/dist/version.js
289984
- var version2 = "1.5.1";
290069
+ var version2 = "1.6.1";
289985
290070
  var version_default2 = version2;
289986
290071
 
289987
290072
  // ../myst-cli/dist/utils/headers.js
@@ -290296,6 +290381,10 @@ function npmPackageName() {
290296
290381
  var _a6;
290297
290382
  return (_a6 = process.env.MYSTMD_NPM_PACKAGE_NAME) !== null && _a6 !== void 0 ? _a6 : "mystmd";
290298
290383
  }
290384
+ function npmBinaryName() {
290385
+ var _a6;
290386
+ return (_a6 = process.env.MYSTMD_NPM_BINARY_NAME) !== null && _a6 !== void 0 ? _a6 : "myst";
290387
+ }
290299
290388
  function homeURL() {
290300
290389
  var _a6;
290301
290390
  return (_a6 = process.env.MYSTMD_HOME_URL) !== null && _a6 !== void 0 ? _a6 : "https://mystmd.org";
@@ -291782,14 +291871,6 @@ async function getValidatedConfigsFromFile(session, file, vfile2, stack) {
291782
291871
  }
291783
291872
  const { site: rawSite, project: rawProject } = conf !== null && conf !== void 0 ? conf : {};
291784
291873
  const path44 = (0, import_node_path18.dirname)(file);
291785
- if (rawSite) {
291786
- site = fillSiteConfig(await validateSiteConfigAndThrow(session, path44, vfile2, rawSite), site !== null && site !== void 0 ? site : {}, incrementOptions("extend", opts));
291787
- }
291788
- if (site) {
291789
- session.log.debug(`Loaded site config from ${file}`);
291790
- } else {
291791
- session.log.debug(`No site config in ${file}`);
291792
- }
291793
291874
  if (rawProject) {
291794
291875
  project = fillProjectFrontmatter(await validateProjectConfigAndThrow(session, path44, vfile2, rawProject), project !== null && project !== void 0 ? project : {}, projectOpts);
291795
291876
  }
@@ -291798,6 +291879,14 @@ async function getValidatedConfigsFromFile(session, file, vfile2, stack) {
291798
291879
  } else {
291799
291880
  session.log.debug(`No project config defined in ${file}`);
291800
291881
  }
291882
+ if (rawSite) {
291883
+ site = fillSiteConfig(await validateSiteConfigAndThrow(session, path44, vfile2, rawSite), site !== null && site !== void 0 ? site : {}, incrementOptions("extend", opts));
291884
+ }
291885
+ if (site) {
291886
+ session.log.debug(`Loaded site config from ${file}`);
291887
+ } else {
291888
+ session.log.debug(`No site config in ${file}`);
291889
+ }
291801
291890
  logMessagesFromVFile(session, vfile2);
291802
291891
  return { site, project, extend: extend5 };
291803
291892
  }
@@ -291948,13 +292037,6 @@ async function writeConfigs(session, path44, newConfigs) {
291948
292037
  const file = configFromPath(session, path44) || defaultConfigFile(session, path44);
291949
292038
  const vfile2 = new VFile();
291950
292039
  vfile2.path = file;
291951
- if (siteConfig) {
291952
- saveSiteConfig(session, path44, await validateSiteConfigAndThrow(session, path44, vfile2, siteConfig));
291953
- }
291954
- siteConfig = selectors_exports.selectLocalSiteConfig(session.store.getState(), path44);
291955
- if (siteConfig) {
291956
- siteConfig = await resolveSiteConfigPaths(session, path44, siteConfig, resolveToRelative, file);
291957
- }
291958
292040
  if (projectConfig) {
291959
292041
  saveProjectConfig(session, path44, await validateProjectConfigAndThrow(session, path44, vfile2, projectConfig));
291960
292042
  }
@@ -291963,6 +292045,13 @@ async function writeConfigs(session, path44, newConfigs) {
291963
292045
  projectConfig = prepareToWrite(projectConfig);
291964
292046
  projectConfig = await resolveProjectConfigPaths(session, path44, projectConfig, resolveToRelative, file);
291965
292047
  }
292048
+ if (siteConfig) {
292049
+ saveSiteConfig(session, path44, await validateSiteConfigAndThrow(session, path44, vfile2, siteConfig));
292050
+ }
292051
+ siteConfig = selectors_exports.selectLocalSiteConfig(session.store.getState(), path44);
292052
+ if (siteConfig) {
292053
+ siteConfig = await resolveSiteConfigPaths(session, path44, siteConfig, resolveToRelative, file);
292054
+ }
291966
292055
  if (!siteConfig && !projectConfig) {
291967
292056
  session.log.debug(`No new config to write to ${file}`);
291968
292057
  return;
@@ -304704,7 +304793,8 @@ async function addEditUrl(session, frontmatter, file) {
304704
304793
  const getGitRoot = makeExecutable("git rev-parse --show-toplevel", gitLog);
304705
304794
  const gitRoot = (await getGitRoot()).trim();
304706
304795
  if (gitBranch && gitRoot && file.startsWith(gitRoot)) {
304707
- frontmatter.edit_url = `${frontmatter.github}/blob/${gitBranch}${file.replace(gitRoot, "")}`;
304796
+ frontmatter.source_url = `${frontmatter.github}/blob/${gitBranch}${file.replace(gitRoot, "")}`;
304797
+ frontmatter.edit_url = `${frontmatter.github}/edit/${gitBranch}${file.replace(gitRoot, "")}`;
304708
304798
  session.log.debug(`Added edit URL ${frontmatter.edit_url} to ${file}`);
304709
304799
  }
304710
304800
  } catch {
@@ -306891,8 +306981,13 @@ var handlers3 = {
306891
306981
  }
306892
306982
  },
306893
306983
  listItem(node3, state) {
306984
+ var _a6, _b;
306894
306985
  state.write("\\item ");
306895
- state.renderChildren(node3, true);
306986
+ if (((_b = (_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6[0]) === null || _b === void 0 ? void 0 : _b.type) === "paragraph" && node3.children.length === 1) {
306987
+ state.renderChildren(node3.children[0], true);
306988
+ } else {
306989
+ state.renderChildren(node3, true);
306990
+ }
306896
306991
  state.write("\n");
306897
306992
  },
306898
306993
  thematicBreak(node3, state) {
@@ -313408,7 +313503,7 @@ To resolve this, run: myst build --all`, {
313408
313503
  });
313409
313504
  }
313410
313505
  });
313411
- const manuscriptExports = (await collectExportOptions(session, articleFile ? [articleFile] : [], [ExportFormats.docx, ExportFormats.pdf, ExportFormats.tex], {
313506
+ const manuscriptExports = (await collectExportOptions(session, articleFile ? [articleFile] : [], [ExportFormats.docx, ExportFormats.pdf, ExportFormats.tex, ExportFormats.typst], {
313412
313507
  projectPath
313413
313508
  })).filter((exp) => {
313414
313509
  return exp.format !== ExportFormats.tex || import_node_path51.default.extname(exp.output) === ".zip";
@@ -318711,7 +318806,7 @@ async function currentSiteRoutes(session, host, baseurl, opts) {
318711
318806
  const pageSlug = slugToUrl(page.slug);
318712
318807
  return {
318713
318808
  url: `${host}${projSlug}/${pageSlug}`,
318714
- path: import_node_path57.default.join((_a8 = proj.slug) !== null && _a8 !== void 0 ? _a8 : "", `${pageSlug}.html`)
318809
+ path: import_node_path57.default.join((_a8 = proj.slug) !== null && _a8 !== void 0 ? _a8 : "", `${pageSlug}/index.html`)
318715
318810
  };
318716
318811
  }),
318717
318812
  // Download all of the configured JSON
@@ -321579,7 +321674,7 @@ async function checkAtGitRoot() {
321579
321674
 
321580
321675
  // ../myst-cli/dist/init/gh-actions/index.js
321581
321676
  function createGithubPagesAction({ defaultBranch = "main", username = "username", isGithubIO }) {
321582
- return `# This file was created automatically with \`${binaryName()} init --gh-pages\` \u{1FA84} \u{1F49A}
321677
+ return `# This file was created automatically with \`${npmBinaryName()} init --gh-pages\` \u{1FA84} \u{1F49A}
321583
321678
  # Ensure your GitHub Pages settings for this repository are set to deploy with **GitHub Actions**.
321584
321679
 
321585
321680
  name: ${readableName()} GitHub Pages Deploy
@@ -321619,7 +321714,7 @@ jobs:
321619
321714
  - name: Install ${readableName()}
321620
321715
  run: npm install -g ${npmPackageName()}
321621
321716
  - name: Build HTML Assets
321622
- run: ${binaryName()} build --html
321717
+ run: ${npmBinaryName()} build --html
321623
321718
  - name: Upload artifact
321624
321719
  uses: actions/upload-pages-artifact@v3
321625
321720
  with:
@@ -321630,7 +321725,7 @@ jobs:
321630
321725
  `;
321631
321726
  }
321632
321727
  function createGithubCurvenoteAction({ defaultBranch = "main" }) {
321633
- return `# This file was created automatically with \`${binaryName()} init --gh-curvenote\` \u{1FA84} \u{1F49A}
321728
+ return `# This file was created automatically with \`${npmBinaryName()} init --gh-curvenote\` \u{1FA84} \u{1F49A}
321634
321729
 
321635
321730
  name: Curvenote Deploy
321636
321731
  on:
@@ -321732,7 +321827,7 @@ ${filename}
321732
321827
 
321733
321828
  ${githubPagesUrl}
321734
321829
  ` : "on your https://{{ organization }}.github.io/{{ repo }} domain"}
321735
- 7. \u{1F389} Celebrate and tell us about your site on Twitter or Mastodon! \u{1F426} \u{1F418}
321830
+ 7. \u{1F389} Celebrate and tell us about your site on BlueSky or Mastodon! \u{1F426} \u{1F418}
321736
321831
  `);
321737
321832
  }
321738
321833
  async function githubCurvenoteAction(session) {
@@ -321775,7 +321870,7 @@ ${filename}
321775
321870
  ${githubUrl}/actions
321776
321871
  ` : ""}
321777
321872
  7. Once the action completes, your site should be deployed
321778
- 8. \u{1F389} Celebrate and tell us about your site on Twitter or Mastodon! \u{1F426} \u{1F418}
321873
+ 8. \u{1F389} Celebrate and tell us about your site on BlueSky or Mastodon! \u{1F426} \u{1F418}
321779
321874
  `);
321780
321875
  }
321781
321876
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes