mystmd 1.3.26__tar.gz → 1.3.28__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.3.26
3
+ Version: 1.3.28
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.3.26",
3
+ "version": "1.3.28",
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.3.26"
48
+ "myst-cli": "^1.3.28"
49
49
  }
50
50
  }
@@ -180855,50 +180855,64 @@ var require_common = __commonJS({
180855
180855
  createDebug.namespaces = namespaces;
180856
180856
  createDebug.names = [];
180857
180857
  createDebug.skips = [];
180858
- let i2;
180859
- const split2 = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
180860
- const len = split2.length;
180861
- for (i2 = 0; i2 < len; i2++) {
180862
- if (!split2[i2]) {
180863
- continue;
180858
+ const split2 = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
180859
+ for (const ns of split2) {
180860
+ if (ns[0] === "-") {
180861
+ createDebug.skips.push(ns.slice(1));
180862
+ } else {
180863
+ createDebug.names.push(ns);
180864
180864
  }
180865
- namespaces = split2[i2].replace(/\*/g, ".*?");
180866
- if (namespaces[0] === "-") {
180867
- createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
180865
+ }
180866
+ }
180867
+ function matchesTemplate(search4, template) {
180868
+ let searchIndex = 0;
180869
+ let templateIndex = 0;
180870
+ let starIndex = -1;
180871
+ let matchIndex = 0;
180872
+ while (searchIndex < search4.length) {
180873
+ if (templateIndex < template.length && (template[templateIndex] === search4[searchIndex] || template[templateIndex] === "*")) {
180874
+ if (template[templateIndex] === "*") {
180875
+ starIndex = templateIndex;
180876
+ matchIndex = searchIndex;
180877
+ templateIndex++;
180878
+ } else {
180879
+ searchIndex++;
180880
+ templateIndex++;
180881
+ }
180882
+ } else if (starIndex !== -1) {
180883
+ templateIndex = starIndex + 1;
180884
+ matchIndex++;
180885
+ searchIndex = matchIndex;
180868
180886
  } else {
180869
- createDebug.names.push(new RegExp("^" + namespaces + "$"));
180887
+ return false;
180870
180888
  }
180871
180889
  }
180890
+ while (templateIndex < template.length && template[templateIndex] === "*") {
180891
+ templateIndex++;
180892
+ }
180893
+ return templateIndex === template.length;
180872
180894
  }
180873
180895
  function disable() {
180874
180896
  const namespaces = [
180875
- ...createDebug.names.map(toNamespace),
180876
- ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
180897
+ ...createDebug.names,
180898
+ ...createDebug.skips.map((namespace) => "-" + namespace)
180877
180899
  ].join(",");
180878
180900
  createDebug.enable("");
180879
180901
  return namespaces;
180880
180902
  }
180881
180903
  function enabled(name3) {
180882
- if (name3[name3.length - 1] === "*") {
180883
- return true;
180884
- }
180885
- let i2;
180886
- let len;
180887
- for (i2 = 0, len = createDebug.skips.length; i2 < len; i2++) {
180888
- if (createDebug.skips[i2].test(name3)) {
180904
+ for (const skip of createDebug.skips) {
180905
+ if (matchesTemplate(name3, skip)) {
180889
180906
  return false;
180890
180907
  }
180891
180908
  }
180892
- for (i2 = 0, len = createDebug.names.length; i2 < len; i2++) {
180893
- if (createDebug.names[i2].test(name3)) {
180909
+ for (const ns of createDebug.names) {
180910
+ if (matchesTemplate(name3, ns)) {
180894
180911
  return true;
180895
180912
  }
180896
180913
  }
180897
180914
  return false;
180898
180915
  }
180899
- function toNamespace(regexp) {
180900
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
180901
- }
180902
180916
  function coerce2(val) {
180903
180917
  if (val instanceof Error) {
180904
180918
  return val.stack || val.message;
@@ -181059,7 +181073,7 @@ var require_browser5 = __commonJS({
181059
181073
  function load2() {
181060
181074
  let r2;
181061
181075
  try {
181062
- r2 = exports2.storage.getItem("debug");
181076
+ r2 = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
181063
181077
  } catch (error) {
181064
181078
  }
181065
181079
  if (!r2 && typeof process !== "undefined" && "env" in process) {
@@ -193426,7 +193440,7 @@ var {
193426
193440
  } = import_index.default;
193427
193441
 
193428
193442
  // src/version.ts
193429
- var version = "1.3.26";
193443
+ var version = "1.3.28";
193430
193444
  var version_default = version;
193431
193445
 
193432
193446
  // ../myst-cli/dist/build/build.js
@@ -195189,12 +195203,15 @@ var ExportFormats;
195189
195203
  })(ExportFormats || (ExportFormats = {}));
195190
195204
 
195191
195205
  // ../myst-toc/dist/toc.js
195192
- var COMMON_ENTRY_KEYS = ["title"];
195206
+ var COMMON_ENTRY_KEYS = ["title", "hidden"];
195193
195207
  function validateCommonEntry(entry, opts) {
195194
195208
  const output2 = {};
195195
195209
  if (defined(entry.title)) {
195196
195210
  output2.title = validateString(entry.title, incrementOptions("title", opts));
195197
195211
  }
195212
+ if (defined(entry.hidden)) {
195213
+ output2.hidden = validateBoolean(entry.hidden, incrementOptions("hidden", opts));
195214
+ }
195198
195215
  return output2;
195199
195216
  }
195200
195217
  function validateFileEntry(entry, opts) {
@@ -289719,7 +289736,7 @@ var import_mime_types = __toESM(require_mime_types(), 1);
289719
289736
  var import_node_path16 = __toESM(require("path"), 1);
289720
289737
 
289721
289738
  // ../myst-cli/dist/version.js
289722
- var version2 = "1.3.26";
289739
+ var version2 = "1.3.28";
289723
289740
  var version_default2 = version2;
289724
289741
 
289725
289742
  // ../myst-cli/dist/utils/headers.js
@@ -298206,12 +298223,13 @@ function listExplicitFiles(entries2, path44) {
298206
298223
  function patternsToFileEntries(session, entries2, path44, ignore3, file, opts) {
298207
298224
  return entries2.map((entry) => {
298208
298225
  if (isPattern(entry)) {
298209
- const { pattern } = entry;
298226
+ const { pattern, ...leftover } = entry;
298210
298227
  const matches4 = globSync(pattern, { cwd: path44, nodir: true, ...opts }).filter((item) => !ignore3 || !ignore3.includes(item)).sort(comparePaths);
298211
298228
  const newEntries = matches4.map((item) => {
298212
298229
  return {
298213
298230
  file: item,
298214
- implicit: true
298231
+ implicit: true,
298232
+ ...leftover
298215
298233
  };
298216
298234
  });
298217
298235
  if (newEntries.length === 0) {
@@ -298238,15 +298256,16 @@ function pagesFromEntries(session, path44, entries2, pages = [], level = 1, page
298238
298256
  let entryLevel = level;
298239
298257
  if (isFile(entry)) {
298240
298258
  entryLevel = level < 0 ? 0 : level;
298241
- const file = resolveExtension((0, import_node_path19.resolve)(path44, entry.file), (message, errorLevel, note) => {
298259
+ const { file, ...leftover } = entry;
298260
+ const resolvedFile = resolveExtension((0, import_node_path19.resolve)(path44, file), (message, errorLevel, note) => {
298242
298261
  addWarningForFile(session, configFile, message, errorLevel, {
298243
298262
  ruleId: RuleId.tocContentsExist,
298244
298263
  note
298245
298264
  });
298246
298265
  });
298247
- if (file && import_node_fs14.default.existsSync(file) && !isDirectory(file)) {
298248
- const { slug } = fileInfo2(file, pageSlugs, { ...opts, session });
298249
- pages.push({ file, level: entryLevel, slug, implicit: entry.implicit });
298266
+ if (resolvedFile && import_node_fs14.default.existsSync(resolvedFile) && !isDirectory(resolvedFile)) {
298267
+ const { slug } = fileInfo2(resolvedFile, pageSlugs, { ...opts, session });
298268
+ pages.push({ file: resolvedFile, level: entryLevel, slug, ...leftover });
298250
298269
  }
298251
298270
  } else if (isURL(entry)) {
298252
298271
  addWarningForFile(session, configFile, `URLs in table of contents are not yet supported: ${entry.url}`, "warn", {
@@ -298301,7 +298320,8 @@ function projectFromTOC(session, path44, toc, level = 1, file, opts) {
298301
298320
  }
298302
298321
  if ((opts === null || opts === void 0 ? void 0 : opts.urlFolders) && !opts.projectPath)
298303
298322
  opts.projectPath = path44;
298304
- const { slug } = fileInfo2(indexFile, pageSlugs, { ...opts, session });
298323
+ const slug = "index";
298324
+ pageSlugs[slug] = 1;
298305
298325
  const pages = [];
298306
298326
  pagesFromEntries(session, path44, entries2, pages, level, pageSlugs, opts);
298307
298327
  return { path: path44 || ".", file: indexFile, index: slug, pages };
@@ -300225,7 +300245,7 @@ var KIND_TO_EXT = {
300225
300245
  site: void 0
300226
300246
  };
300227
300247
  var DEFAULT_TEMPLATES = {
300228
- tex: "tex/myst/curvenote",
300248
+ tex: "tex/myst/plain_latex",
300229
300249
  typst: "typst/myst/lapreprint-typst",
300230
300250
  docx: "docx/myst/default",
300231
300251
  site: "site/myst/book-theme"
@@ -301993,8 +302013,8 @@ function makeNamedExportOption(description) {
301993
302013
  function makeStrictOption() {
301994
302014
  return new Option("--strict", "Summarize build warnings and stop on any errors.").default(false);
301995
302015
  }
301996
- function makeForceOption() {
301997
- return new Option("--force", "Build outputs for the given format, even if corresponding exports are not defined in file frontmatter").default(false);
302016
+ function makeForceOption(description) {
302017
+ return new Option("--force", description).default(false);
301998
302018
  }
301999
302019
  function makeCheckLinksOption() {
302000
302020
  return new Option("--check-links", "Check all links to websites resolve.").default(false);
@@ -307748,8 +307768,10 @@ var typstMacros = {
307748
307768
  gets: "arrow.l",
307749
307769
  rightharpoonup: "harpoon.rt",
307750
307770
  rightharpoondown: "harpoon.rb",
307771
+ rightleftharpoons: "harpoons.rtlb",
307751
307772
  leftharpoonup: "harpoon.lt",
307752
307773
  leftharpoondown: "harpoon.lb",
307774
+ leftrightharpoons: "harpoons.ltrb",
307753
307775
  infin: "infinity",
307754
307776
  // This is a mathjax only thing, https://docs.mathjax.org/en/v2.7-latest/tex.html#i
307755
307777
  infty: "infinity",
@@ -321177,7 +321199,7 @@ async function clean2(session, files, opts) {
321177
321199
 
321178
321200
  // ../myst-cli/dist/cli/build.js
321179
321201
  function makeBuildCommand() {
321180
- const command = new Command("build").description("Build PDF, LaTeX, Word and website exports from MyST files").argument("[files...]", "list of files to export").addOption(makeExecuteOption("Execute Notebooks")).addOption(makePdfOption("Build PDF output")).addOption(makeTexOption("Build LaTeX outputs")).addOption(makeTypstOption("Build Typst outputs")).addOption(makeDocxOption("Build Docx output")).addOption(makeMdOption("Build MD output")).addOption(makeJatsOption("Build JATS xml output")).addOption(makeMecaOptions("Build MECA zip output")).addOption(makeCffOption("Build CFF output")).addOption(makeSiteOption(`Build ${readableName()} site content`)).addOption(makeHtmlOption("Build static HTML site content")).addOption(makeAllOption("Build all exports")).addOption(makeDOIBibOption()).addOption(makeWatchOption()).addOption(makeNamedExportOption("Output file for the export")).addOption(makeForceOption()).addOption(makeCheckLinksOption()).addOption(makeStrictOption()).addOption(makeCIOption()).addOption(makeMaxSizeWebpOption());
321202
+ const command = new Command("build").description("Build PDF, LaTeX, Word and website exports from MyST files").argument("[files...]", "list of files to export").addOption(makeExecuteOption("Execute Notebooks")).addOption(makePdfOption("Build PDF output")).addOption(makeTexOption("Build LaTeX outputs")).addOption(makeTypstOption("Build Typst outputs")).addOption(makeDocxOption("Build Docx output")).addOption(makeMdOption("Build MD output")).addOption(makeJatsOption("Build JATS xml output")).addOption(makeMecaOptions("Build MECA zip output")).addOption(makeCffOption("Build CFF output")).addOption(makeSiteOption(`Build ${readableName()} site content`)).addOption(makeHtmlOption("Build static HTML site content")).addOption(makeAllOption("Build all exports")).addOption(makeDOIBibOption()).addOption(makeWatchOption()).addOption(makeNamedExportOption("Output file for the export")).addOption(makeForceOption("Build outputs for the given format, even if corresponding exports are not defined in file frontmatter")).addOption(makeCheckLinksOption()).addOption(makeStrictOption()).addOption(makeCIOption()).addOption(makeMaxSizeWebpOption());
321181
321203
  return command;
321182
321204
  }
321183
321205
 
@@ -333824,7 +333846,7 @@ function getKind(session, kinds) {
333824
333846
  return void 0;
333825
333847
  const { pdf, tex, typst, docx, site } = kinds;
333826
333848
  if (pdf)
333827
- session.log.warn('PDF templates may use either "tex" or "typst"');
333849
+ session.log.warn('PDF templates may be either "tex" or "typst", including both.');
333828
333850
  const flags = {
333829
333851
  [TemplateKind.tex]: (tex || pdf) ?? false,
333830
333852
  [TemplateKind.typst]: (typst || pdf) ?? false,
@@ -333839,8 +333861,11 @@ function getKind(session, kinds) {
333839
333861
  async function downloadTemplateCLI(session, template, path44, opts) {
333840
333862
  const templateKind = getKindFromName(template);
333841
333863
  const kinds = templateKind ? [templateKind] : getKind(session, opts);
333842
- if (!kinds || kinds.length > 1) {
333843
- throw new Error("Cannot lookup a template with more than one kind.");
333864
+ if (!(kinds == null ? void 0 : kinds.length)) {
333865
+ throw new Error("Cannot lookup a template without specifying a kind (e.g. typst).");
333866
+ }
333867
+ if (kinds.length > 1) {
333868
+ throw new Error("Cannot lookup a template when more than one kind is specified.");
333844
333869
  }
333845
333870
  const kind = kinds[0];
333846
333871
  const { templatePath: defaultTemplatePath, templateUrl } = resolveInputs(session, {
@@ -333947,7 +333972,7 @@ Tags: ${source_default8.dim(
333947
333972
  });
333948
333973
  }
333949
333974
  function makeDownloadCLI(program3) {
333950
- const command = new Command("download").description("Download a public template to a path").argument("<template>", "The template URL or name").argument("[path]", "A folder to download and unzip the template to").addOption(makePdfOption("Download PDF template")).addOption(makeTexOption("Download LaTeX template")).addOption(makeTypstOption("Download Typst template")).addOption(makeDocxOption("Download Docx template")).addOption(makeSiteOption("Download Site template")).addOption(makeForceOption()).action(clirun2(Session, downloadTemplateCLI, program3));
333975
+ const command = new Command("download").description("Download a public template to a path").argument("<template>", "The template URL or name").argument("[path]", "A folder to download and unzip the template to").addOption(makePdfOption("Download PDF template")).addOption(makeTexOption("Download LaTeX template")).addOption(makeTypstOption("Download Typst template")).addOption(makeDocxOption("Download Docx template")).addOption(makeSiteOption("Download Site template")).addOption(makeForceOption("Overwrite existing downloaded templates")).action(clirun2(Session, downloadTemplateCLI, program3));
333951
333976
  return command;
333952
333977
  }
333953
333978
  function makeListCLI(program3) {
File without changes
File without changes
File without changes
File without changes
File without changes