mystmd 1.1.47__tar.gz → 1.1.48__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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: mystmd
3
- Version: 1.1.47
3
+ Version: 1.1.48
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.1.47",
3
+ "version": "1.1.48",
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.1.47"
48
+ "myst-cli": "^1.1.48"
49
49
  }
50
50
  }
@@ -195964,7 +195964,7 @@ var {
195964
195964
  } = import_index.default;
195965
195965
 
195966
195966
  // src/version.ts
195967
- var version = "1.1.47";
195967
+ var version = "1.1.48";
195968
195968
  var version_default = version;
195969
195969
 
195970
195970
  // ../myst-cli/dist/build/build.js
@@ -197617,9 +197617,17 @@ var FRONTMATTER_ALIASES = {
197617
197617
  ack: "acknowledgments",
197618
197618
  acknowledgements: "acknowledgments",
197619
197619
  availability: "data_availability",
197620
- plain_language_summary: "summary",
197620
+ dataAvailability: "data_availability",
197621
+ "data-availability": "data_availability",
197621
197622
  quote: "epigraph",
197623
+ plain_language_summary: "summary",
197624
+ "plain-language-summary": "summary",
197625
+ plainLanguageSummary: "summary",
197622
197626
  lay_summary: "summary",
197627
+ "lay-summary": "summary",
197628
+ keyPoints: "keypoints",
197629
+ key_points: "keypoints",
197630
+ "key-points": "keypoints",
197623
197631
  image: "thumbnail"
197624
197632
  };
197625
197633
  function validateSiteFrontmatterKeys(value, opts) {
@@ -202491,12 +202499,17 @@ function createState(selector, tree) {
202491
202499
  }
202492
202500
 
202493
202501
  // ../myst-common/dist/extractParts.js
202494
- function selectBlockParts(tree, part) {
202502
+ function coercePart(part) {
202495
202503
  if (!part) {
202496
202504
  return [];
202497
202505
  }
202506
+ return typeof part === "string" ? [part] : part;
202507
+ }
202508
+ function selectBlockParts(tree, part) {
202509
+ const parts = coercePart(part);
202510
+ if (parts.length === 0)
202511
+ return [];
202498
202512
  const blockParts = selectAll("block", tree).filter((block5) => {
202499
- const parts = typeof part === "string" ? [part] : part;
202500
202513
  return parts.map((p5) => {
202501
202514
  var _a6, _b;
202502
202515
  return ((_a6 = block5.data) === null || _a6 === void 0 ? void 0 : _a6.part) === p5 || ((_b = block5.data) === null || _b === void 0 ? void 0 : _b.tags) && Array.isArray(block5.data.tags) && block5.data.tags.includes(p5);
@@ -202504,11 +202517,70 @@ function selectBlockParts(tree, part) {
202504
202517
  });
202505
202518
  return blockParts;
202506
202519
  }
202520
+ function createPartBlock(children, part, opts) {
202521
+ var _a6;
202522
+ const block5 = { type: "block", children };
202523
+ if (!(opts === null || opts === void 0 ? void 0 : opts.removePartData)) {
202524
+ (_a6 = block5.data) !== null && _a6 !== void 0 ? _a6 : block5.data = {};
202525
+ block5.data.part = part;
202526
+ }
202527
+ return block5;
202528
+ }
202529
+ function extractImplicitPart(tree, part, opts) {
202530
+ const parts = coercePart(part);
202531
+ if (parts.length === 0)
202532
+ return;
202533
+ let insideImplicitPart = false;
202534
+ const blockParts = [];
202535
+ let paragraphs = [];
202536
+ tree.children.forEach((child, index4) => {
202537
+ var _a6;
202538
+ if (insideImplicitPart && child.type === "paragraph") {
202539
+ paragraphs.push(copyNode(child));
202540
+ child.type = "__part_delete__";
202541
+ }
202542
+ if (child.type !== "__part_delete__" || index4 === tree.children.length - 1) {
202543
+ insideImplicitPart = false;
202544
+ if (paragraphs.length > 0) {
202545
+ blockParts.push(createPartBlock(paragraphs, parts[0], opts));
202546
+ paragraphs = [];
202547
+ selectAll("__part_heading__", tree).forEach((node3) => {
202548
+ node3.type = "__part_delete__";
202549
+ });
202550
+ }
202551
+ }
202552
+ if (child.type === "block") {
202553
+ if ((_a6 = child.data) === null || _a6 === void 0 ? void 0 : _a6.part)
202554
+ return;
202555
+ if (tree.type !== "root")
202556
+ return;
202557
+ const blockPartsTree = extractImplicitPart(child, parts);
202558
+ if (blockPartsTree)
202559
+ blockParts.push(...blockPartsTree.children);
202560
+ } else if (child.type === "heading" && parts.includes(toText(child).toLowerCase())) {
202561
+ insideImplicitPart = true;
202562
+ child.type = "__part_heading__";
202563
+ }
202564
+ });
202565
+ selectAll("__part_heading__", tree).forEach((node3) => {
202566
+ node3.type = "heading";
202567
+ });
202568
+ if (blockParts.length === 0)
202569
+ return;
202570
+ const partsTree = { type: "root", children: blockParts };
202571
+ remove(tree, "__part_delete__");
202572
+ return partsTree;
202573
+ }
202507
202574
  function extractPart(tree, part, opts) {
202508
- const partStrings = typeof part === "string" ? [part] : part;
202575
+ const partStrings = coercePart(part);
202576
+ if (partStrings.length === 0)
202577
+ return;
202509
202578
  const blockParts = selectBlockParts(tree, part);
202510
- if (blockParts.length === 0)
202511
- return void 0;
202579
+ if (blockParts.length === 0) {
202580
+ if (opts === null || opts === void 0 ? void 0 : opts.requireExplicitPart)
202581
+ return;
202582
+ return extractImplicitPart(tree, partStrings);
202583
+ }
202512
202584
  const children = copyNode(blockParts).map((block5) => {
202513
202585
  var _a6;
202514
202586
  (_a6 = block5.data) !== null && _a6 !== void 0 ? _a6 : block5.data = {};
@@ -278577,7 +278649,7 @@ function addAffiliation(node3, state) {
278577
278649
  state.closeParagraph();
278578
278650
  const renderedAffil = state.stack.pop();
278579
278651
  const fmAffil = { id: affilNumber, name: getContentFromRenderedSpan(renderedAffil) };
278580
- if (!affilNumber) {
278652
+ if (!affilNumber && fm.authors.length > 0) {
278581
278653
  const lastAuthor = fm.authors[fm.authors.length - 1];
278582
278654
  if (!lastAuthor.affiliations)
278583
278655
  lastAuthor.affiliations = [];
@@ -281353,8 +281425,10 @@ var dropdownDirective = {
281353
281425
  // ../myst-directives/dist/embed.js
281354
281426
  var embedDirective = {
281355
281427
  name: "embed",
281428
+ doc: "The embed directive allows you to duplicate content from another part of your project. This can also be done through the figure directive.",
281356
281429
  arg: {
281357
281430
  type: String,
281431
+ doc: "The label of the node that you are embedding.",
281358
281432
  required: true
281359
281433
  },
281360
281434
  options: {
@@ -281959,20 +282033,21 @@ var listTableDirective = {
281959
282033
  }
281960
282034
  };
281961
282035
 
281962
- // ../myst-directives/dist/margin.js
281963
- var marginDirective = {
281964
- name: "margin",
282036
+ // ../myst-directives/dist/aside.js
282037
+ var asideDirective = {
282038
+ name: "aside",
282039
+ alias: ["margin", "sidebar"],
281965
282040
  body: {
281966
282041
  type: "myst",
281967
282042
  required: true
281968
282043
  },
281969
282044
  run(data) {
281970
- return [
281971
- {
281972
- type: "margin",
281973
- children: data.body
281974
- }
281975
- ];
282045
+ const aside = {
282046
+ type: "aside",
282047
+ kind: data.name == "aside" || data.name == "margin" ? void 0 : data.name,
282048
+ children: data.body
282049
+ };
282050
+ return [aside];
281976
282051
  }
281977
282052
  };
281978
282053
 
@@ -282193,7 +282268,7 @@ var defaultDirectives = [
282193
282268
  includeDirective,
282194
282269
  tableDirective,
282195
282270
  listTableDirective,
282196
- marginDirective,
282271
+ asideDirective,
282197
282272
  glossaryDirective,
282198
282273
  mathDirective,
282199
282274
  mdastDirective,
@@ -282604,6 +282679,25 @@ var underlineRole = {
282604
282679
  }
282605
282680
  };
282606
282681
 
282682
+ // ../myst-roles/dist/keyboard.js
282683
+ var keyboardRole = {
282684
+ name: "keyboard",
282685
+ doc: 'The keyboard role denote textual user input from a keyboard, such as "Ctrl" + "Space".',
282686
+ alias: ["kbd"],
282687
+ body: {
282688
+ type: String,
282689
+ required: true
282690
+ },
282691
+ run(data) {
282692
+ const body3 = data.body;
282693
+ const node3 = {
282694
+ type: "keyboard",
282695
+ children: [{ type: "text", value: body3 }]
282696
+ };
282697
+ return [node3];
282698
+ }
282699
+ };
282700
+
282607
282701
  // ../myst-roles/dist/index.js
282608
282702
  var defaultRoles = [
282609
282703
  abbreviationRole,
@@ -282620,7 +282714,8 @@ var defaultRoles = [
282620
282714
  smallcapsRole,
282621
282715
  subscriptRole,
282622
282716
  superscriptRole,
282623
- underlineRole
282717
+ underlineRole,
282718
+ keyboardRole
282624
282719
  ];
282625
282720
 
282626
282721
  // ../myst-parser/dist/tlds.js
@@ -285403,7 +285498,7 @@ var import_node_path16 = __toESM(require("path"), 1);
285403
285498
  var import_nbtx = __toESM(require_cjs2(), 1);
285404
285499
 
285405
285500
  // ../myst-cli/dist/version.js
285406
- var version2 = "1.1.47";
285501
+ var version2 = "1.1.48";
285407
285502
  var version_default2 = version2;
285408
285503
 
285409
285504
  // ../myst-cli/dist/utils/headers.js
@@ -300482,6 +300577,33 @@ function getClasses2(className) {
300482
300577
  }
300483
300578
 
300484
300579
  // ../myst-to-tex/dist/math.js
300580
+ var ENVIRONMENTS2 = [
300581
+ "equation",
300582
+ "multline",
300583
+ "gather",
300584
+ "align",
300585
+ "alignat",
300586
+ "flalign",
300587
+ "matrix",
300588
+ "pmatrix",
300589
+ "bmatrix",
300590
+ "Bmatrix",
300591
+ "vmatrix",
300592
+ "Vmatrix",
300593
+ "eqnarray"
300594
+ ];
300595
+ var RE_OPEN2 = new RegExp(`^\\\\begin{(${ENVIRONMENTS2.join("|")})([*]?)}`);
300596
+ function isAmsmathEnvironment(value) {
300597
+ const matchOpen = value.trim().match(RE_OPEN2);
300598
+ if (!matchOpen)
300599
+ return false;
300600
+ const [, environment2, star3] = matchOpen;
300601
+ const end = `\\end{${environment2}${star3}}`;
300602
+ const matchClose = value.trim().endsWith(end);
300603
+ if (!matchClose)
300604
+ return false;
300605
+ return true;
300606
+ }
300485
300607
  function addMacrosToState(value, state) {
300486
300608
  if (!state.options.math)
300487
300609
  return;
@@ -300517,15 +300639,22 @@ var math4 = (node3, state) => {
300517
300639
  state.write(node3.value);
300518
300640
  state.write(" \\)");
300519
300641
  } else {
300520
- state.write(`\\begin{equation${enumerated === false ? "*" : ""}}
300642
+ const isAmsMath = isAmsmathEnvironment(node3.value);
300643
+ if (isAmsMath) {
300644
+ state.ensureNewLine();
300645
+ state.write(node3.value);
300646
+ state.ensureNewLine(true);
300647
+ } else {
300648
+ state.write(`\\begin{equation${enumerated === false ? "*" : ""}}
300521
300649
  `);
300522
- if (label) {
300523
- state.write(`\\label{${label}}`);
300650
+ if (label) {
300651
+ state.write(`\\label{${label}}`);
300652
+ }
300653
+ state.ensureNewLine();
300654
+ state.write(node3.value);
300655
+ state.ensureNewLine(true);
300656
+ state.write(`\\end{equation${enumerated === false ? "*" : ""}}`);
300524
300657
  }
300525
- state.ensureNewLine();
300526
- state.write(node3.value);
300527
- state.ensureNewLine(true);
300528
- state.write(`\\end{equation${enumerated === false ? "*" : ""}}`);
300529
300658
  }
300530
300659
  if (!state.data.isInTable)
300531
300660
  state.closeBlock(node3);
@@ -302646,7 +302775,9 @@ ${node3.value}
302646
302775
  state.renderChildren(node3, 0, " ");
302647
302776
  },
302648
302777
  cite(node3, state) {
302649
- state.write(`#cite(<${node3.label}>`);
302778
+ const needsLabel = !/^[a-zA-Z0-9_\-:.]+$/.test(node3.label);
302779
+ const label = needsLabel ? `label("${node3.label}")` : `<${node3.label}>`;
302780
+ state.write(`#cite(${label}`);
302650
302781
  if (node3.kind === "narrative")
302651
302782
  state.write(`, form: "prose"`);
302652
302783
  if (node3.suffix)
@@ -302794,7 +302925,7 @@ function isTypstAvailable() {
302794
302925
  }
302795
302926
  async function runTypstExecutable(session, typstFile) {
302796
302927
  if (!isTypstAvailable()) {
302797
- session.log.debug("typst CLI must be installed to build PDFs from typst");
302928
+ session.log.error("The typst CLI must be installed to build PDFs with typst");
302798
302929
  return;
302799
302930
  }
302800
302931
  if (import_node_path49.default.extname(typstFile) !== ".typ") {
File without changes
File without changes
File without changes
File without changes
File without changes