mystmd 1.2.3__tar.gz → 1.2.5__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.
- {mystmd-1.2.3 → mystmd-1.2.5}/PKG-INFO +1 -1
- {mystmd-1.2.3 → mystmd-1.2.5}/_package.json +2 -2
- {mystmd-1.2.3 → mystmd-1.2.5}/src/mystmd_py/myst.cjs +367 -157
- {mystmd-1.2.3 → mystmd-1.2.5}/.gitignore +0 -0
- {mystmd-1.2.3 → mystmd-1.2.5}/LICENSE +0 -0
- {mystmd-1.2.3 → mystmd-1.2.5}/README.md +0 -0
- {mystmd-1.2.3 → mystmd-1.2.5}/pyproject.toml +0 -0
- {mystmd-1.2.3 → mystmd-1.2.5}/src/mystmd_py/__init__.py +0 -0
- {mystmd-1.2.3 → mystmd-1.2.5}/src/mystmd_py/main.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mystmd",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.5",
|
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.
|
48
|
+
"myst-cli": "^1.2.5"
|
49
49
|
}
|
50
50
|
}
|
@@ -193279,7 +193279,7 @@ var {
|
|
193279
193279
|
} = import_index.default;
|
193280
193280
|
|
193281
193281
|
// src/version.ts
|
193282
|
-
var version = "1.2.
|
193282
|
+
var version = "1.2.5";
|
193283
193283
|
var version_default = version;
|
193284
193284
|
|
193285
193285
|
// ../myst-cli/dist/build/build.js
|
@@ -193969,6 +193969,8 @@ function validateDate(input3, opts) {
|
|
193969
193969
|
function validateObject(input3, opts) {
|
193970
193970
|
if (typeof input3 !== "object")
|
193971
193971
|
return validationError(`must be object`, opts);
|
193972
|
+
if (Array.isArray(input3))
|
193973
|
+
return validationError(`must be object, not array`, opts);
|
193972
193974
|
return input3;
|
193973
193975
|
}
|
193974
193976
|
function validateKeys(input3, keys2, opts) {
|
@@ -195374,6 +195376,9 @@ var licenses = {
|
|
195374
195376
|
name: "BSD Zero Clause License",
|
195375
195377
|
osi: true
|
195376
195378
|
},
|
195379
|
+
"3D-Slicer-1.0": {
|
195380
|
+
name: "3D Slicer License v1.0"
|
195381
|
+
},
|
195377
195382
|
AAL: {
|
195378
195383
|
name: "Attribution Assurance License",
|
195379
195384
|
osi: true
|
@@ -195446,6 +195451,9 @@ var licenses = {
|
|
195446
195451
|
Aladdin: {
|
195447
195452
|
name: "Aladdin Free Public License"
|
195448
195453
|
},
|
195454
|
+
"AMD-newlib": {
|
195455
|
+
name: "AMD newlib License"
|
195456
|
+
},
|
195449
195457
|
AMDPLPA: {
|
195450
195458
|
name: "AMD's plpa_map.c License"
|
195451
195459
|
},
|
@@ -195464,6 +195472,9 @@ var licenses = {
|
|
195464
195472
|
"ANTLR-PD-fallback": {
|
195465
195473
|
name: "ANTLR Software Rights Notice with license fallback"
|
195466
195474
|
},
|
195475
|
+
"any-OSI": {
|
195476
|
+
name: "Any OSI License"
|
195477
|
+
},
|
195467
195478
|
"Apache-1.0": {
|
195468
195479
|
name: "Apache License 1.0",
|
195469
195480
|
free: true
|
@@ -195590,6 +195601,9 @@ var licenses = {
|
|
195590
195601
|
"BSD-2-Clause-Darwin": {
|
195591
195602
|
name: "BSD 2-Clause - Ian Darwin variant"
|
195592
195603
|
},
|
195604
|
+
"BSD-2-Clause-first-lines": {
|
195605
|
+
name: "BSD 2-Clause - first lines requirement"
|
195606
|
+
},
|
195593
195607
|
"BSD-2-Clause-Patent": {
|
195594
195608
|
name: "BSD-2-Clause Plus Patent License",
|
195595
195609
|
osi: true
|
@@ -195711,6 +195725,9 @@ var licenses = {
|
|
195711
195725
|
"Caldera-no-preamble": {
|
195712
195726
|
name: "Caldera License (without preamble)"
|
195713
195727
|
},
|
195728
|
+
Catharon: {
|
195729
|
+
name: "Catharon License"
|
195730
|
+
},
|
195714
195731
|
"CATOSL-1.1": {
|
195715
195732
|
name: "Computer Associates Trusted Open Source License 1.1",
|
195716
195733
|
osi: true
|
@@ -196073,6 +196090,9 @@ var licenses = {
|
|
196073
196090
|
curl: {
|
196074
196091
|
name: "curl License"
|
196075
196092
|
},
|
196093
|
+
"cve-tou": {
|
196094
|
+
name: "Common Vulnerability Enumeration ToU License"
|
196095
|
+
},
|
196076
196096
|
"D-FSL-1.0": {
|
196077
196097
|
name: "Deutsche Freie Software Lizenz"
|
196078
196098
|
},
|
@@ -196346,6 +196366,9 @@ var licenses = {
|
|
196346
196366
|
gtkbook: {
|
196347
196367
|
name: "gtkbook License"
|
196348
196368
|
},
|
196369
|
+
Gutmann: {
|
196370
|
+
name: "Gutmann License"
|
196371
|
+
},
|
196349
196372
|
HaskellReport: {
|
196350
196373
|
name: "Haskell Language Report License"
|
196351
196374
|
},
|
@@ -196378,21 +196401,33 @@ var licenses = {
|
|
196378
196401
|
"HPND-export-US": {
|
196379
196402
|
name: "HPND with US Government export control warning"
|
196380
196403
|
},
|
196404
|
+
"HPND-export-US-acknowledgement": {
|
196405
|
+
name: "HPND with US Government export control warning and acknowledgment"
|
196406
|
+
},
|
196381
196407
|
"HPND-export-US-modify": {
|
196382
196408
|
name: "HPND with US Government export control warning and modification rqmt"
|
196383
196409
|
},
|
196410
|
+
"HPND-export2-US": {
|
196411
|
+
name: "HPND with US Government export control and 2 disclaimers"
|
196412
|
+
},
|
196384
196413
|
"HPND-Fenneberg-Livingston": {
|
196385
196414
|
name: "Historical Permission Notice and Disclaimer - Fenneberg-Livingston variant"
|
196386
196415
|
},
|
196387
196416
|
"HPND-INRIA-IMAG": {
|
196388
196417
|
name: "Historical Permission Notice and Disclaimer - INRIA-IMAG variant"
|
196389
196418
|
},
|
196419
|
+
"HPND-Intel": {
|
196420
|
+
name: "Historical Permission Notice and Disclaimer - Intel variant"
|
196421
|
+
},
|
196390
196422
|
"HPND-Kevlin-Henney": {
|
196391
196423
|
name: "Historical Permission Notice and Disclaimer - Kevlin Henney variant"
|
196392
196424
|
},
|
196393
196425
|
"HPND-Markus-Kuhn": {
|
196394
196426
|
name: "Historical Permission Notice and Disclaimer - Markus Kuhn variant"
|
196395
196427
|
},
|
196428
|
+
"HPND-merchantability-variant": {
|
196429
|
+
name: "Historical Permission Notice and Disclaimer - merchantability variant"
|
196430
|
+
},
|
196396
196431
|
"HPND-MIT-disclaimer": {
|
196397
196432
|
name: "Historical Permission Notice and Disclaimer with MIT disclaimer"
|
196398
196433
|
},
|
@@ -196411,9 +196446,15 @@ var licenses = {
|
|
196411
196446
|
"HPND-sell-variant-MIT-disclaimer": {
|
196412
196447
|
name: "HPND sell variant with MIT disclaimer"
|
196413
196448
|
},
|
196449
|
+
"HPND-sell-variant-MIT-disclaimer-rev": {
|
196450
|
+
name: "HPND sell variant with MIT disclaimer - reverse"
|
196451
|
+
},
|
196414
196452
|
"HPND-UC": {
|
196415
196453
|
name: "Historical Permission Notice and Disclaimer - University of California variant"
|
196416
196454
|
},
|
196455
|
+
"HPND-UC-export-US": {
|
196456
|
+
name: "Historical Permission Notice and Disclaimer - University of California, US export warning"
|
196457
|
+
},
|
196417
196458
|
HTMLTIDY: {
|
196418
196459
|
name: "HTML Tidy License"
|
196419
196460
|
},
|
@@ -196693,6 +196734,9 @@ var licenses = {
|
|
196693
196734
|
"MIT-Festival": {
|
196694
196735
|
name: "MIT Festival Variant"
|
196695
196736
|
},
|
196737
|
+
"MIT-Khronos-old": {
|
196738
|
+
name: "MIT Khronos - old variant"
|
196739
|
+
},
|
196696
196740
|
"MIT-Modern-Variant": {
|
196697
196741
|
name: "MIT License Modern Variant",
|
196698
196742
|
osi: true
|
@@ -196790,9 +196834,15 @@ var licenses = {
|
|
196790
196834
|
"NBPL-1.0": {
|
196791
196835
|
name: "Net Boolean Public License v1"
|
196792
196836
|
},
|
196837
|
+
"NCBI-PD": {
|
196838
|
+
name: "NCBI Public Domain Notice"
|
196839
|
+
},
|
196793
196840
|
"NCGL-UK-2.0": {
|
196794
196841
|
name: "Non-Commercial Government Licence"
|
196795
196842
|
},
|
196843
|
+
NCL: {
|
196844
|
+
name: "NCL Source Code License"
|
196845
|
+
},
|
196796
196846
|
NCSA: {
|
196797
196847
|
name: "University of Illinois/NCSA Open Source License",
|
196798
196848
|
osi: true,
|
@@ -196869,6 +196919,9 @@ var licenses = {
|
|
196869
196919
|
"O-UDA-1.0": {
|
196870
196920
|
name: "Open Use of Data Agreement v1.0"
|
196871
196921
|
},
|
196922
|
+
OAR: {
|
196923
|
+
name: "OAR License"
|
196924
|
+
},
|
196872
196925
|
"OCCT-PL": {
|
196873
196926
|
name: "Open CASCADE Technology Public License"
|
196874
196927
|
},
|
@@ -197063,6 +197116,9 @@ var licenses = {
|
|
197063
197116
|
Pixar: {
|
197064
197117
|
name: "Pixar License"
|
197065
197118
|
},
|
197119
|
+
pkgconf: {
|
197120
|
+
name: "pkgconf License"
|
197121
|
+
},
|
197066
197122
|
Plexus: {
|
197067
197123
|
name: "Plexus Classworlds License"
|
197068
197124
|
},
|
@@ -197079,6 +197135,9 @@ var licenses = {
|
|
197079
197135
|
name: "PostgreSQL License",
|
197080
197136
|
osi: true
|
197081
197137
|
},
|
197138
|
+
PPL: {
|
197139
|
+
name: "Peer Production License"
|
197140
|
+
},
|
197082
197141
|
"PSF-2.0": {
|
197083
197142
|
name: "Python Software Foundation License 2.0"
|
197084
197143
|
},
|
@@ -197260,6 +197319,9 @@ var licenses = {
|
|
197260
197319
|
"Sun-PPP": {
|
197261
197320
|
name: "Sun PPP License"
|
197262
197321
|
},
|
197322
|
+
"Sun-PPP-2000": {
|
197323
|
+
name: "Sun PPP License (2000)"
|
197324
|
+
},
|
197263
197325
|
SunPro: {
|
197264
197326
|
name: "SunPro License"
|
197265
197327
|
},
|
@@ -197287,6 +197349,9 @@ var licenses = {
|
|
197287
197349
|
"TGPPL-1.0": {
|
197288
197350
|
name: "Transitive Grace Period Public Licence 1.0"
|
197289
197351
|
},
|
197352
|
+
threeparttable: {
|
197353
|
+
name: "threeparttable License"
|
197354
|
+
},
|
197290
197355
|
TMate: {
|
197291
197356
|
name: "TMate Open Source License"
|
197292
197357
|
},
|
@@ -197436,6 +197501,9 @@ var licenses = {
|
|
197436
197501
|
XSkat: {
|
197437
197502
|
name: "XSkat License"
|
197438
197503
|
},
|
197504
|
+
xzoom: {
|
197505
|
+
name: "xzoom License"
|
197506
|
+
},
|
197439
197507
|
"YPL-1.0": {
|
197440
197508
|
name: "Yahoo! Public License v1.0"
|
197441
197509
|
},
|
@@ -198145,6 +198213,39 @@ function validateProjectAndPageSettings(value, opts) {
|
|
198145
198213
|
return output2;
|
198146
198214
|
}
|
198147
198215
|
|
198216
|
+
// ../myst-frontmatter/dist/math/validators.js
|
198217
|
+
function validateMathMacro(input3, opts) {
|
198218
|
+
if (typeof input3 === "string") {
|
198219
|
+
input3 = { macro: input3 };
|
198220
|
+
}
|
198221
|
+
const value = validateObjectKeys(input3, { required: ["macro"], optional: ["title", "description"] }, opts);
|
198222
|
+
if (!value)
|
198223
|
+
return;
|
198224
|
+
const macro2 = validateString(value.macro, incrementOptions("macro", opts));
|
198225
|
+
if (!macro2)
|
198226
|
+
return;
|
198227
|
+
const output2 = { macro: macro2 };
|
198228
|
+
if (defined(value.title)) {
|
198229
|
+
output2.title = validateString(value.title, incrementOptions("title", opts));
|
198230
|
+
}
|
198231
|
+
if (defined(value.description)) {
|
198232
|
+
output2.description = validateString(value.description, incrementOptions("description", opts));
|
198233
|
+
}
|
198234
|
+
return output2;
|
198235
|
+
}
|
198236
|
+
function validateMathMacroObject(input3, opts) {
|
198237
|
+
const value = validateObject(input3, opts);
|
198238
|
+
if (!value)
|
198239
|
+
return;
|
198240
|
+
const validMacros = Object.entries(value).map(([key2, val]) => {
|
198241
|
+
const macro2 = validateMathMacro(val, incrementOptions(key2, opts));
|
198242
|
+
if (!macro2)
|
198243
|
+
return false;
|
198244
|
+
return [key2, macro2];
|
198245
|
+
}).filter((valid2) => !!valid2);
|
198246
|
+
return Object.fromEntries(validMacros);
|
198247
|
+
}
|
198248
|
+
|
198148
198249
|
// ../myst-frontmatter/dist/project/validators.js
|
198149
198250
|
function validateProjectAndPageFrontmatterKeys(value, opts) {
|
198150
198251
|
const output2 = validateSiteFrontmatterKeys(value, opts);
|
@@ -198193,14 +198294,7 @@ function validateProjectAndPageFrontmatterKeys(value, opts) {
|
|
198193
198294
|
output2.numbering = validateNumbering(value.numbering, incrementOptions("numbering", opts));
|
198194
198295
|
}
|
198195
198296
|
if (defined(value.math)) {
|
198196
|
-
|
198197
|
-
const math7 = validateObject(value.math, mathOpts);
|
198198
|
-
if (math7) {
|
198199
|
-
const stringKeys = Object.keys(math7).filter((key2) => {
|
198200
|
-
return validateString(math7[key2], incrementOptions(key2, mathOpts));
|
198201
|
-
});
|
198202
|
-
output2.math = filterKeys(math7, stringKeys);
|
198203
|
-
}
|
198297
|
+
output2.math = validateMathMacroObject(value.math, incrementOptions("math", opts));
|
198204
198298
|
}
|
198205
198299
|
if (defined(value.abbreviations)) {
|
198206
198300
|
const abbreviationsOpts = incrementOptions("abbreviations", opts);
|
@@ -198359,30 +198453,33 @@ function validatePageFrontmatter(input3, opts) {
|
|
198359
198453
|
|
198360
198454
|
// ../myst-frontmatter/dist/utils/fillPageFrontmatter.js
|
198361
198455
|
function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
198456
|
+
return fillProjectFrontmatter(pageFrontmatter, projectFrontmatter, opts, USE_PROJECT_FALLBACK);
|
198457
|
+
}
|
198458
|
+
function fillProjectFrontmatter(base5, filler, opts, keys2) {
|
198362
198459
|
var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x2;
|
198363
|
-
const frontmatter = fillMissingKeys(
|
198364
|
-
if (
|
198365
|
-
frontmatter.numbering = fillNumbering(
|
198460
|
+
const frontmatter = fillMissingKeys(base5, filler, keys2 !== null && keys2 !== void 0 ? keys2 : Object.keys(filler));
|
198461
|
+
if (filler.numbering || base5.numbering) {
|
198462
|
+
frontmatter.numbering = fillNumbering(base5.numbering, filler.numbering);
|
198366
198463
|
}
|
198367
|
-
if (
|
198368
|
-
frontmatter.math = { ...(_a6 =
|
198464
|
+
if (filler.math || base5.math) {
|
198465
|
+
frontmatter.math = { ...(_a6 = filler.math) !== null && _a6 !== void 0 ? _a6 : {}, ...(_b = base5.math) !== null && _b !== void 0 ? _b : {} };
|
198369
198466
|
}
|
198370
|
-
if (
|
198467
|
+
if (filler.abbreviations || base5.abbreviations) {
|
198371
198468
|
frontmatter.abbreviations = {
|
198372
|
-
...(_c =
|
198373
|
-
...(_d2 =
|
198469
|
+
...(_c = filler.abbreviations) !== null && _c !== void 0 ? _c : {},
|
198470
|
+
...(_d2 = base5.abbreviations) !== null && _d2 !== void 0 ? _d2 : {}
|
198374
198471
|
};
|
198375
198472
|
}
|
198376
|
-
if (
|
198473
|
+
if (filler.options || base5.options) {
|
198377
198474
|
frontmatter.options = {
|
198378
|
-
...(_e =
|
198379
|
-
...(_f =
|
198475
|
+
...(_e = filler.options) !== null && _e !== void 0 ? _e : {},
|
198476
|
+
...(_f = base5.options) !== null && _f !== void 0 ? _f : {}
|
198380
198477
|
};
|
198381
198478
|
}
|
198382
|
-
if (
|
198479
|
+
if (filler.settings || base5.settings) {
|
198383
198480
|
frontmatter.settings = {
|
198384
|
-
...(_g =
|
198385
|
-
...(_h =
|
198481
|
+
...(_g = filler.settings) !== null && _g !== void 0 ? _g : {},
|
198482
|
+
...(_h = base5.settings) !== null && _h !== void 0 ? _h : {}
|
198386
198483
|
};
|
198387
198484
|
}
|
198388
198485
|
const contributorIds = /* @__PURE__ */ new Set();
|
@@ -198410,10 +198507,10 @@ function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
|
198410
198507
|
});
|
198411
198508
|
if (((_m = frontmatter.authors) === null || _m === void 0 ? void 0 : _m.length) || contributorIds.size) {
|
198412
198509
|
const people = [
|
198413
|
-
...(_o =
|
198414
|
-
...(_p =
|
198415
|
-
...(_q =
|
198416
|
-
...(_r =
|
198510
|
+
...(_o = base5.authors) !== null && _o !== void 0 ? _o : [],
|
198511
|
+
...(_p = filler.authors) !== null && _p !== void 0 ? _p : [],
|
198512
|
+
...(_q = base5.contributors) !== null && _q !== void 0 ? _q : [],
|
198513
|
+
...(_r = filler.contributors) !== null && _r !== void 0 ? _r : []
|
198417
198514
|
];
|
198418
198515
|
const peopleLookup = {};
|
198419
198516
|
people.forEach((auth) => {
|
@@ -198452,10 +198549,7 @@ function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
|
198452
198549
|
affiliationIds.add(aff.id);
|
198453
198550
|
});
|
198454
198551
|
if (affiliationIds.size) {
|
198455
|
-
const affiliations2 = [
|
198456
|
-
...(_w = pageFrontmatter.affiliations) !== null && _w !== void 0 ? _w : [],
|
198457
|
-
...(_x2 = projectFrontmatter.affiliations) !== null && _x2 !== void 0 ? _x2 : []
|
198458
|
-
];
|
198552
|
+
const affiliations2 = [...(_w = base5.affiliations) !== null && _w !== void 0 ? _w : [], ...(_x2 = filler.affiliations) !== null && _x2 !== void 0 ? _x2 : []];
|
198459
198553
|
const affiliationLookup = {};
|
198460
198554
|
affiliations2.forEach((aff) => {
|
198461
198555
|
if (!aff.id || isStashPlaceholder(aff))
|
@@ -235259,7 +235353,7 @@ var TRANSFORM_NAME = "myst-transforms:math";
|
|
235259
235353
|
var replacements = {
|
235260
235354
|
"\xA0": " "
|
235261
235355
|
};
|
235262
|
-
var
|
235356
|
+
var builtInMacros = {
|
235263
235357
|
"\\mbox": "\\text{#1}"
|
235264
235358
|
// mbox is not supported in KaTeX, this is an OK fallback
|
235265
235359
|
};
|
@@ -235361,11 +235455,15 @@ function removeWarnings(result, predicate) {
|
|
235361
235455
|
function tryRender(file, node3, value, opts) {
|
235362
235456
|
const displayMode = node3.type === "math";
|
235363
235457
|
const warnings2 = [];
|
235458
|
+
let simplifiedMacros = {};
|
235459
|
+
if (opts === null || opts === void 0 ? void 0 : opts.macros) {
|
235460
|
+
simplifiedMacros = Object.fromEntries(Object.entries(opts.macros).map(([k, v]) => [k, v.macro]));
|
235461
|
+
}
|
235364
235462
|
try {
|
235365
235463
|
const html7 = katex.renderToString(value, {
|
235366
235464
|
displayMode,
|
235367
235465
|
output: (opts === null || opts === void 0 ? void 0 : opts.mathML) ? "mathml" : void 0,
|
235368
|
-
macros: { ...
|
235466
|
+
macros: { ...builtInMacros, ...simplifiedMacros },
|
235369
235467
|
strict: (f3, m2) => {
|
235370
235468
|
warnings2.push(`${f3}, ${m2}`);
|
235371
235469
|
}
|
@@ -236443,19 +236541,36 @@ var GithubTransformer = class {
|
|
236443
236541
|
};
|
236444
236542
|
|
236445
236543
|
// ../myst-transforms/dist/links/check.js
|
236446
|
-
function checkLinkTextTransform(mdast2, vfile2) {
|
236447
|
-
const linkNodes = selectAll("link,linkBlock,card
|
236448
|
-
|
236449
|
-
return;
|
236544
|
+
function checkLinkTextTransform(mdast2, externalReferences, vfile2) {
|
236545
|
+
const linkNodes = selectAll("link,linkBlock,card", mdast2);
|
236546
|
+
const xrefNodes = selectAll("crossReference", mdast2);
|
236450
236547
|
linkNodes.forEach((node3) => {
|
236451
236548
|
var _a6;
|
236452
|
-
if (
|
236549
|
+
if (node3.url && (node3.url.startsWith("xref:") || node3.url.startsWith("myst:"))) {
|
236550
|
+
const key2 = node3.url.slice(5).split("/")[0].split("#")[0];
|
236551
|
+
if (externalReferences.map((ref) => ref.key).includes(key2)) {
|
236552
|
+
} else {
|
236553
|
+
fileError(vfile2, `Link did not resolve to valid cross-reference: ${node3.url}`, {
|
236554
|
+
node: node3,
|
236555
|
+
ruleId: RuleId.linkTextExists,
|
236556
|
+
note: key2 ? `You need an entry in your project references with key "${key2}"` : void 0
|
236557
|
+
});
|
236558
|
+
}
|
236559
|
+
} else if (!toText(node3.children) && !select("image", node3)) {
|
236453
236560
|
fileWarn(vfile2, `Link text is empty for <${(_a6 = node3.urlSource) !== null && _a6 !== void 0 ? _a6 : node3.url}${node3.identifier ? `#${node3.identifier}` : ""}>`, {
|
236454
236561
|
node: node3,
|
236455
236562
|
ruleId: RuleId.linkTextExists
|
236456
236563
|
});
|
236457
236564
|
}
|
236458
236565
|
});
|
236566
|
+
xrefNodes.forEach((node3) => {
|
236567
|
+
if (!toText(node3.children) && !select("image", node3)) {
|
236568
|
+
fileWarn(vfile2, `Cross reference text is empty for <${node3.urlSource}>`, {
|
236569
|
+
node: node3,
|
236570
|
+
ruleId: RuleId.linkTextExists
|
236571
|
+
});
|
236572
|
+
}
|
236573
|
+
});
|
236459
236574
|
}
|
236460
236575
|
|
236461
236576
|
// ../myst-transforms/dist/targets.js
|
@@ -237303,7 +237418,7 @@ var ReferenceState = class {
|
|
237303
237418
|
}
|
237304
237419
|
};
|
237305
237420
|
function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
|
237306
|
-
var _a6, _b, _c;
|
237421
|
+
var _a6, _b, _c, _d2, _e;
|
237307
237422
|
numbering = fillNumbering(numbering, DEFAULT_NUMBERING);
|
237308
237423
|
const kind = kindFromNode2(targetNode);
|
237309
237424
|
const noNodeChildren = !((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length);
|
@@ -237322,8 +237437,8 @@ function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
|
|
237322
237437
|
fillReferenceEnumerators2(vfile2, node3, template, targetNode, title);
|
237323
237438
|
}
|
237324
237439
|
node3.resolved = true;
|
237325
|
-
node3.identifier = targetNode.identifier;
|
237326
|
-
node3.html_id = targetNode.html_id;
|
237440
|
+
node3.identifier = (_d2 = targetNode.identifier) !== null && _d2 !== void 0 ? _d2 : node3.identifier;
|
237441
|
+
node3.html_id = (_e = targetNode.html_id) !== null && _e !== void 0 ? _e : node3.html_id;
|
237327
237442
|
}
|
237328
237443
|
function warnNodeTargetNotFound(node3, vfile2) {
|
237329
237444
|
if (!vfile2)
|
@@ -237661,6 +237776,7 @@ var selectors_exports = {};
|
|
237661
237776
|
__export(selectors_exports, {
|
237662
237777
|
selectAffiliation: () => selectAffiliation,
|
237663
237778
|
selectAllDependencies: () => selectAllDependencies,
|
237779
|
+
selectConfigExtensions: () => selectConfigExtensions,
|
237664
237780
|
selectCurrentProjectConfig: () => selectCurrentProjectConfig,
|
237665
237781
|
selectCurrentProjectFile: () => selectCurrentProjectFile,
|
237666
237782
|
selectCurrentProjectPath: () => selectCurrentProjectPath,
|
@@ -237735,6 +237851,10 @@ function selectLocalConfigFile(state, path42) {
|
|
237735
237851
|
function selectLocalRawConfig(state, path42) {
|
237736
237852
|
return mutableCopy(state.local.config.rawConfigs[(0, import_node_path4.resolve)(path42)]);
|
237737
237853
|
}
|
237854
|
+
function selectConfigExtensions(state) {
|
237855
|
+
var _a6;
|
237856
|
+
return [...(_a6 = state.local.config.configExtensions) !== null && _a6 !== void 0 ? _a6 : []];
|
237857
|
+
}
|
237738
237858
|
function selectReloadingState(state) {
|
237739
237859
|
const { reloading, reloadRequested } = state.local.watch;
|
237740
237860
|
return { reloading, reloadRequested };
|
@@ -239927,6 +240047,11 @@ var config = createSlice({
|
|
239927
240047
|
receiveProjectConfig(state, action) {
|
239928
240048
|
const { path: path42, ...payload } = action.payload;
|
239929
240049
|
state.projects[(0, import_node_path5.resolve)(path42)] = payload;
|
240050
|
+
},
|
240051
|
+
receiveConfigExtension(state, action) {
|
240052
|
+
var _a6;
|
240053
|
+
(_a6 = state.configExtensions) !== null && _a6 !== void 0 ? _a6 : state.configExtensions = [];
|
240054
|
+
state.configExtensions.push(action.payload.file);
|
239930
240055
|
}
|
239931
240056
|
}
|
239932
240057
|
});
|
@@ -240199,15 +240324,7 @@ function configFromPath(session, path42) {
|
|
240199
240324
|
return void 0;
|
240200
240325
|
return configs[0];
|
240201
240326
|
}
|
240202
|
-
function
|
240203
|
-
var _a6, _b, _c;
|
240204
|
-
const file = configFromPath(session, path42);
|
240205
|
-
if (!file) {
|
240206
|
-
session.log.debug(`No config loaded from path: ${path42}`);
|
240207
|
-
return;
|
240208
|
-
}
|
240209
|
-
const vfile2 = new VFile();
|
240210
|
-
vfile2.path = file;
|
240327
|
+
function loadConfigYaml(file) {
|
240211
240328
|
if (!import_node_fs2.default.existsSync(file))
|
240212
240329
|
throw Error(`Cannot find config file: ${file}`);
|
240213
240330
|
let rawConf;
|
@@ -240219,27 +240336,38 @@ function loadConfig(session, path42) {
|
|
240219
240336
|
${err.message}` : "";
|
240220
240337
|
throw Error(`Unable to read config file ${file} as YAML${suffix}`);
|
240221
240338
|
}
|
240222
|
-
|
240223
|
-
|
240224
|
-
|
240225
|
-
|
240226
|
-
|
240227
|
-
|
240228
|
-
property: "config",
|
240339
|
+
return rawConf;
|
240340
|
+
}
|
240341
|
+
function configValidationOpts(vfile2, property, ruleId) {
|
240342
|
+
return {
|
240343
|
+
file: vfile2.path,
|
240344
|
+
property,
|
240229
240345
|
messages: {},
|
240230
240346
|
errorLogFn: (message) => {
|
240231
|
-
fileError(vfile2, message, { ruleId
|
240347
|
+
fileError(vfile2, message, { ruleId });
|
240232
240348
|
},
|
240233
240349
|
warningLogFn: (message) => {
|
240234
|
-
fileWarn(vfile2, message, { ruleId
|
240350
|
+
fileWarn(vfile2, message, { ruleId });
|
240235
240351
|
}
|
240236
240352
|
};
|
240237
|
-
|
240238
|
-
|
240239
|
-
|
240240
|
-
|
240241
|
-
|
240242
|
-
|
240353
|
+
}
|
240354
|
+
function fillSiteConfig(base5, filler) {
|
240355
|
+
return fillMissingKeys(base5, filler, Object.keys(filler));
|
240356
|
+
}
|
240357
|
+
function getValidatedConfigsFromFile(session, file, vfile2, stack) {
|
240358
|
+
var _a6, _b, _c;
|
240359
|
+
if (!vfile2) {
|
240360
|
+
vfile2 = new VFile();
|
240361
|
+
vfile2.path = file;
|
240362
|
+
}
|
240363
|
+
const opts = configValidationOpts(vfile2, "config", RuleId.validConfigStructure);
|
240364
|
+
const conf = validateObjectKeys(loadConfigYaml(file), {
|
240365
|
+
required: ["version"],
|
240366
|
+
optional: ["site", "project", "extend"],
|
240367
|
+
alias: { extends: "extend" }
|
240368
|
+
}, opts);
|
240369
|
+
if (conf && conf.version !== VERSION) {
|
240370
|
+
validationError(`"${conf.version}" does not match ${VERSION}`, incrementOptions("version", opts));
|
240243
240371
|
}
|
240244
240372
|
logMessagesFromVFile(session, vfile2);
|
240245
240373
|
if (!conf || opts.messages.errors) {
|
@@ -240262,22 +240390,83 @@ ${err.message}` : "";
|
|
240262
240390
|
const { logoText, ...rest } = conf.site;
|
240263
240391
|
conf.site = { logo_text: logoText, ...rest };
|
240264
240392
|
}
|
240265
|
-
|
240266
|
-
|
240393
|
+
let site;
|
240394
|
+
let project;
|
240395
|
+
const projectOpts = configValidationOpts(vfile2, "config.project", RuleId.validProjectConfig);
|
240396
|
+
let extend5;
|
240397
|
+
if (conf.extend) {
|
240398
|
+
extend5 = validateList(conf.extend, { coerce: true, ...incrementOptions("extend", opts) }, (item, index4) => {
|
240399
|
+
const relativeFile = validateString(item, incrementOptions(`extend.${index4}`, opts));
|
240400
|
+
if (!relativeFile)
|
240401
|
+
return relativeFile;
|
240402
|
+
return resolveToAbsolute(session, (0, import_node_path7.dirname)(file), relativeFile);
|
240403
|
+
});
|
240404
|
+
stack = [...stack !== null && stack !== void 0 ? stack : [], file];
|
240405
|
+
extend5 === null || extend5 === void 0 ? void 0 : extend5.forEach((extFile) => {
|
240406
|
+
if (stack === null || stack === void 0 ? void 0 : stack.includes(extFile)) {
|
240407
|
+
fileError(vfile2, 'Circular dependency encountered during "config.extend" resolution', {
|
240408
|
+
ruleId: RuleId.validConfigStructure,
|
240409
|
+
note: [...stack, extFile].map((f3) => resolveToRelative(session, ".", f3)).join(" > ")
|
240410
|
+
});
|
240411
|
+
return;
|
240412
|
+
}
|
240413
|
+
const { site: extSite, project: extProject } = getValidatedConfigsFromFile(session, extFile, vfile2, stack);
|
240414
|
+
session.store.dispatch(config.actions.receiveConfigExtension({ file: extFile }));
|
240415
|
+
if (extSite) {
|
240416
|
+
site = site ? fillSiteConfig(extSite, site) : extSite;
|
240417
|
+
}
|
240418
|
+
if (extProject) {
|
240419
|
+
project = project ? fillProjectFrontmatter(extProject, project, projectOpts) : extProject;
|
240420
|
+
}
|
240421
|
+
});
|
240422
|
+
}
|
240423
|
+
const { site: rawSite, project: rawProject } = conf !== null && conf !== void 0 ? conf : {};
|
240424
|
+
const path42 = (0, import_node_path7.dirname)(file);
|
240425
|
+
if (rawSite) {
|
240426
|
+
site = fillSiteConfig(validateSiteConfigAndThrow(session, path42, vfile2, rawSite), site !== null && site !== void 0 ? site : {});
|
240427
|
+
}
|
240267
240428
|
if (site) {
|
240268
|
-
validateSiteConfigAndSave(session, path42, vfile2, site);
|
240269
240429
|
session.log.debug(`Loaded site config from ${file}`);
|
240270
240430
|
} else {
|
240271
240431
|
session.log.debug(`No site config in ${file}`);
|
240272
240432
|
}
|
240433
|
+
if (rawProject) {
|
240434
|
+
project = fillProjectFrontmatter(validateProjectConfigAndThrow(session, path42, vfile2, rawProject), project !== null && project !== void 0 ? project : {}, projectOpts);
|
240435
|
+
}
|
240273
240436
|
if (project) {
|
240274
|
-
validateProjectConfigAndSave(session, path42, vfile2, project);
|
240275
240437
|
session.log.debug(`Loaded project config from ${file}`);
|
240276
240438
|
} else {
|
240277
240439
|
session.log.debug(`No project config defined in ${file}`);
|
240278
240440
|
}
|
240279
240441
|
logMessagesFromVFile(session, vfile2);
|
240280
|
-
return
|
240442
|
+
return { site, project, extend: extend5 };
|
240443
|
+
}
|
240444
|
+
function loadConfig(session, path42, opts) {
|
240445
|
+
const file = configFromPath(session, path42);
|
240446
|
+
if (!file) {
|
240447
|
+
session.log.debug(`No config loaded from path: ${path42}`);
|
240448
|
+
return;
|
240449
|
+
}
|
240450
|
+
const rawConf = loadConfigYaml(file);
|
240451
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.reloadProject)) {
|
240452
|
+
const existingConf = selectors_exports.selectLocalRawConfig(session.store.getState(), path42);
|
240453
|
+
if (existingConf && JSON.stringify(rawConf) === JSON.stringify(existingConf.raw)) {
|
240454
|
+
return existingConf.validated;
|
240455
|
+
}
|
240456
|
+
}
|
240457
|
+
const { site, project, extend: extend5 } = getValidatedConfigsFromFile(session, file);
|
240458
|
+
const validated = { ...rawConf, site, project, extend: extend5 };
|
240459
|
+
session.store.dispatch(config.actions.receiveRawConfig({
|
240460
|
+
path: path42,
|
240461
|
+
file,
|
240462
|
+
raw: rawConf,
|
240463
|
+
validated
|
240464
|
+
}));
|
240465
|
+
if (site)
|
240466
|
+
saveSiteConfig(session, path42, site);
|
240467
|
+
if (project)
|
240468
|
+
saveProjectConfig(session, path42, project);
|
240469
|
+
return validated;
|
240281
240470
|
}
|
240282
240471
|
function resolveToAbsolute(session, basePath, relativePath, checkExists = true) {
|
240283
240472
|
let message;
|
@@ -240346,45 +240535,29 @@ function resolveProjectConfigPaths(session, path42, projectConfig, resolutionFn)
|
|
240346
240535
|
}
|
240347
240536
|
return { ...projectConfig, ...resolvedFields };
|
240348
240537
|
}
|
240349
|
-
function
|
240350
|
-
|
240351
|
-
file: vfile2.path,
|
240352
|
-
property: "site",
|
240353
|
-
messages: {},
|
240354
|
-
errorLogFn: (message) => {
|
240355
|
-
fileError(vfile2, message, { ruleId: RuleId.validSiteConfig });
|
240356
|
-
},
|
240357
|
-
warningLogFn: (message) => {
|
240358
|
-
fileWarn(vfile2, message, { ruleId: RuleId.validSiteConfig });
|
240359
|
-
}
|
240360
|
-
});
|
240538
|
+
function validateSiteConfigAndThrow(session, path42, vfile2, rawSite) {
|
240539
|
+
const site = validateSiteConfig(rawSite, configValidationOpts(vfile2, "config.site", RuleId.validSiteConfig));
|
240361
240540
|
logMessagesFromVFile(session, vfile2);
|
240362
|
-
if (!
|
240541
|
+
if (!site) {
|
240363
240542
|
const errorSuffix = vfile2.path ? ` in ${vfile2.path}` : "";
|
240364
240543
|
throw Error(`Please address invalid site config${errorSuffix}`);
|
240365
240544
|
}
|
240366
|
-
|
240367
|
-
session.store.dispatch(config.actions.receiveSiteConfig({ path: path42, ...siteConfig }));
|
240545
|
+
return resolveSiteConfigPaths(session, path42, site, resolveToAbsolute);
|
240368
240546
|
}
|
240369
|
-
function
|
240370
|
-
|
240371
|
-
|
240372
|
-
|
240373
|
-
|
240374
|
-
errorLogFn: (message) => {
|
240375
|
-
fileError(vfile2, message, { ruleId: RuleId.validProjectConfig });
|
240376
|
-
},
|
240377
|
-
warningLogFn: (message) => {
|
240378
|
-
fileWarn(vfile2, message, { ruleId: RuleId.validProjectConfig });
|
240379
|
-
}
|
240380
|
-
});
|
240547
|
+
function saveSiteConfig(session, path42, site) {
|
240548
|
+
session.store.dispatch(config.actions.receiveSiteConfig({ path: path42, ...site }));
|
240549
|
+
}
|
240550
|
+
function validateProjectConfigAndThrow(session, path42, vfile2, rawProject) {
|
240551
|
+
const project = validateProjectConfig(rawProject, configValidationOpts(vfile2, "config.project", RuleId.validProjectConfig));
|
240381
240552
|
logMessagesFromVFile(session, vfile2);
|
240382
|
-
if (!
|
240553
|
+
if (!project) {
|
240383
240554
|
const errorSuffix = vfile2.path ? ` in ${vfile2.path}` : "";
|
240384
240555
|
throw Error(`Please address invalid project config${errorSuffix}`);
|
240385
240556
|
}
|
240386
|
-
|
240387
|
-
|
240557
|
+
return resolveProjectConfigPaths(session, path42, project, resolveToAbsolute);
|
240558
|
+
}
|
240559
|
+
function saveProjectConfig(session, path42, project) {
|
240560
|
+
session.store.dispatch(config.actions.receiveProjectConfig({ path: path42, ...project }));
|
240388
240561
|
}
|
240389
240562
|
function writeConfigs(session, path42, newConfigs) {
|
240390
240563
|
var _a6;
|
@@ -240392,14 +240565,16 @@ function writeConfigs(session, path42, newConfigs) {
|
|
240392
240565
|
const file = configFromPath(session, path42) || defaultConfigFile(session, path42);
|
240393
240566
|
const vfile2 = new VFile();
|
240394
240567
|
vfile2.path = file;
|
240395
|
-
if (siteConfig)
|
240396
|
-
|
240568
|
+
if (siteConfig) {
|
240569
|
+
saveSiteConfig(session, path42, validateSiteConfigAndThrow(session, path42, vfile2, siteConfig));
|
240570
|
+
}
|
240397
240571
|
siteConfig = selectors_exports.selectLocalSiteConfig(session.store.getState(), path42);
|
240398
240572
|
if (siteConfig) {
|
240399
240573
|
siteConfig = resolveSiteConfigPaths(session, path42, siteConfig, resolveToRelative);
|
240400
240574
|
}
|
240401
|
-
if (projectConfig)
|
240402
|
-
|
240575
|
+
if (projectConfig) {
|
240576
|
+
saveProjectConfig(session, path42, validateProjectConfigAndThrow(session, path42, vfile2, projectConfig));
|
240577
|
+
}
|
240403
240578
|
projectConfig = selectors_exports.selectLocalProjectConfig(session.store.getState(), path42);
|
240404
240579
|
if (projectConfig) {
|
240405
240580
|
projectConfig = prepareToWrite(projectConfig);
|
@@ -240409,8 +240584,7 @@ function writeConfigs(session, path42, newConfigs) {
|
|
240409
240584
|
session.log.debug(`No new config to write to ${file}`);
|
240410
240585
|
return;
|
240411
240586
|
}
|
240412
|
-
const
|
240413
|
-
const validatedRawConfig = (_a6 = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.validated) !== null && _a6 !== void 0 ? _a6 : emptyConfig();
|
240587
|
+
const validatedRawConfig = (_a6 = loadConfig(session, path42)) !== null && _a6 !== void 0 ? _a6 : emptyConfig();
|
240414
240588
|
let logContent;
|
240415
240589
|
if (siteConfig && projectConfig) {
|
240416
240590
|
logContent = "site and project configs";
|
@@ -287405,7 +287579,7 @@ var import_node_path17 = __toESM(require("path"), 1);
|
|
287405
287579
|
var import_nbtx = __toESM(require_cjs2(), 1);
|
287406
287580
|
|
287407
287581
|
// ../myst-cli/dist/version.js
|
287408
|
-
var version2 = "1.2.
|
287582
|
+
var version2 = "1.2.5";
|
287409
287583
|
var version_default2 = version2;
|
287410
287584
|
|
287411
287585
|
// ../myst-cli/dist/utils/headers.js
|
@@ -295338,6 +295512,7 @@ async function loadProjectFromDisk(session, path42, opts) {
|
|
295338
295512
|
if (cachedProject)
|
295339
295513
|
return cachedProject;
|
295340
295514
|
}
|
295515
|
+
loadConfig(session, path42, opts);
|
295341
295516
|
const projectConfig = selectors_exports.selectLocalProjectConfig(session.store.getState(), path42);
|
295342
295517
|
const file = (0, import_node_path22.join)(path42, session.configFiles[0]);
|
295343
295518
|
if (!projectConfig && (opts === null || opts === void 0 ? void 0 : opts.warnOnNoConfig)) {
|
@@ -299437,7 +299612,7 @@ async function checkLinksTransform(session, file, mdast2) {
|
|
299437
299612
|
}
|
299438
299613
|
|
299439
299614
|
// ../myst-cli/dist/transforms/embed.js
|
299440
|
-
function mutateEmbedNode(node3, targetNode) {
|
299615
|
+
function mutateEmbedNode(node3, targetNode, opts) {
|
299441
299616
|
if (targetNode && node3["remove-output"]) {
|
299442
299617
|
targetNode = filter2(targetNode, (n) => {
|
299443
299618
|
var _a6;
|
@@ -299457,6 +299632,13 @@ function mutateEmbedNode(node3, targetNode) {
|
|
299457
299632
|
delete idNode.label;
|
299458
299633
|
delete idNode.html_id;
|
299459
299634
|
});
|
299635
|
+
selectAll("crossReference", targetNode).forEach((targetXRef) => {
|
299636
|
+
if (!targetXRef.remote) {
|
299637
|
+
targetXRef.url = opts === null || opts === void 0 ? void 0 : opts.url;
|
299638
|
+
targetXRef.dataUrl = opts === null || opts === void 0 ? void 0 : opts.dataUrl;
|
299639
|
+
targetXRef.remote = true;
|
299640
|
+
}
|
299641
|
+
});
|
299460
299642
|
if (!targetNode) {
|
299461
299643
|
node3.children = [];
|
299462
299644
|
} else if (targetNode.type === "block") {
|
@@ -299465,11 +299647,17 @@ function mutateEmbedNode(node3, targetNode) {
|
|
299465
299647
|
node3.children = [targetNode];
|
299466
299648
|
}
|
299467
299649
|
}
|
299650
|
+
function targetsToTarget(targets) {
|
299651
|
+
if (targets.length === 1)
|
299652
|
+
return copyNode(targets[0]);
|
299653
|
+
return { type: "block", children: copyNode(targets) };
|
299654
|
+
}
|
299468
299655
|
async function embedTransform(session, mdast2, file, dependencies, state) {
|
299469
|
-
const
|
299656
|
+
const references = Object.values(castSession(session).$externalReferences);
|
299657
|
+
const mystTransformer = new MystTransformer(references);
|
299470
299658
|
const embedNodes = selectAll("embed", mdast2);
|
299471
299659
|
await Promise.all(embedNodes.map(async (node3) => {
|
299472
|
-
var _a6, _b, _c, _d2, _e, _f, _g
|
299660
|
+
var _a6, _b, _c, _d2, _e, _f, _g;
|
299473
299661
|
const vfile2 = state.vfile;
|
299474
299662
|
const label = (_a6 = node3.source) === null || _a6 === void 0 ? void 0 : _a6.label;
|
299475
299663
|
if (!label) {
|
@@ -299478,10 +299666,14 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299478
299666
|
}
|
299479
299667
|
if (label.startsWith("xref:") || label.startsWith("myst:")) {
|
299480
299668
|
if (!mystTransformer.test(label)) {
|
299481
|
-
|
299482
|
-
|
299483
|
-
|
299484
|
-
|
299669
|
+
let note;
|
299670
|
+
const sphinxTransformer = new SphinxTransformer(references);
|
299671
|
+
if (sphinxTransformer.test(label)) {
|
299672
|
+
note = "Embed target must be a MyST project, not intersphinx.";
|
299673
|
+
} else {
|
299674
|
+
note = "Embed target must be a MyST project and included in your project references.";
|
299675
|
+
}
|
299676
|
+
fileError(vfile2, `Cannot embed "${label}"`, { node: node3, note });
|
299485
299677
|
return;
|
299486
299678
|
}
|
299487
299679
|
const referenceLink = {
|
@@ -299509,16 +299701,13 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299509
299701
|
return;
|
299510
299702
|
targetNodes2 = data.mdast.children;
|
299511
299703
|
}
|
299512
|
-
|
299704
|
+
if (!(targetNodes2 === null || targetNodes2 === void 0 ? void 0 : targetNodes2.length))
|
299705
|
+
return;
|
299706
|
+
const targetNode = targetsToTarget(targetNodes2);
|
299513
299707
|
selectAll("crossReference", targetNode).forEach((targetXRef) => {
|
299514
299708
|
if (targetXRef.remoteBaseUrl)
|
299515
299709
|
return;
|
299516
299710
|
targetXRef.remoteBaseUrl = referenceXRef.remoteBaseUrl;
|
299517
|
-
if (!targetXRef.remote) {
|
299518
|
-
targetXRef.url = referenceXRef.url;
|
299519
|
-
targetXRef.dataUrl = referenceXRef.dataUrl;
|
299520
|
-
targetXRef.remote = true;
|
299521
|
-
}
|
299522
299711
|
});
|
299523
299712
|
selectAll("link", targetNode).forEach((targetLink) => {
|
299524
299713
|
if (!targetLink.internal)
|
@@ -299534,7 +299723,7 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299534
299723
|
return;
|
299535
299724
|
target2.source.remoteBaseUrl = referenceXRef.remoteBaseUrl;
|
299536
299725
|
});
|
299537
|
-
mutateEmbedNode(node3, targetNode);
|
299726
|
+
mutateEmbedNode(node3, targetNode, referenceXRef);
|
299538
299727
|
const source3 = {
|
299539
299728
|
url: referenceXRef.url,
|
299540
299729
|
remoteBaseUrl: referenceXRef.remoteBaseUrl,
|
@@ -299585,12 +299774,13 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299585
299774
|
fileError(vfile2, `Embed target for "${label}" not found`, { node: node3 });
|
299586
299775
|
return;
|
299587
299776
|
}
|
299588
|
-
const target =
|
299589
|
-
|
299590
|
-
|
299591
|
-
if (!multiState.states)
|
299777
|
+
const target = targetsToTarget(targetNodes);
|
299778
|
+
if (!state.states) {
|
299779
|
+
mutateEmbedNode(node3, target);
|
299592
299780
|
return;
|
299593
|
-
|
299781
|
+
}
|
299782
|
+
const { url, dataUrl, filePath } = stateProvider;
|
299783
|
+
mutateEmbedNode(node3, target, { url, dataUrl });
|
299594
299784
|
if (!url)
|
299595
299785
|
return;
|
299596
299786
|
const source2 = { url, label };
|
@@ -299599,7 +299789,7 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299599
299789
|
path: file,
|
299600
299790
|
dependency: filePath
|
299601
299791
|
}));
|
299602
|
-
const { kind, slug, frontmatter, location: location4 } = (
|
299792
|
+
const { kind, slug, frontmatter, location: location4 } = (_g = selectFile(session, filePath)) !== null && _g !== void 0 ? _g : {};
|
299603
299793
|
if (kind)
|
299604
299794
|
source2.kind = kind;
|
299605
299795
|
if (slug)
|
@@ -300905,6 +301095,7 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
|
|
300905
301095
|
const { mdast: mdast2, dependencies, frontmatter } = mdastPost;
|
300906
301096
|
const fileState = cache.$internalReferences[file];
|
300907
301097
|
const state = pageReferenceStates ? new MultiPageReferenceResolver(pageReferenceStates, file, vfile2) : fileState;
|
301098
|
+
const externalReferences = Object.values(cache.$externalReferences);
|
300908
301099
|
const transformers = [
|
300909
301100
|
...extraLinkTransformers || [],
|
300910
301101
|
new WikiTransformer(),
|
@@ -300913,8 +301104,8 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
|
|
300913
301104
|
new RORTransformer(),
|
300914
301105
|
new DOITransformer(),
|
300915
301106
|
// This also is picked up in the next transform
|
300916
|
-
new MystTransformer(
|
300917
|
-
new SphinxTransformer(
|
301107
|
+
new MystTransformer(externalReferences),
|
301108
|
+
new SphinxTransformer(externalReferences),
|
300918
301109
|
new StaticFileTransformer(session, file)
|
300919
301110
|
// Links static files and internally linked files
|
300920
301111
|
];
|
@@ -300935,7 +301126,7 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
|
|
300935
301126
|
});
|
300936
301127
|
await pipe.run(mdast2, vfile2);
|
300937
301128
|
keysTransform(mdast2);
|
300938
|
-
checkLinkTextTransform(mdast2, vfile2);
|
301129
|
+
checkLinkTextTransform(mdast2, externalReferences, vfile2);
|
300939
301130
|
logMessagesFromVFile(session, fileState.vfile);
|
300940
301131
|
logMessagesFromVFile(session, vfile2);
|
300941
301132
|
log.debug(toc(`Transformed mdast cross references and links for "${file}" in %s`));
|
@@ -302163,7 +302354,7 @@ function addMacrosToState(value, state) {
|
|
302163
302354
|
return;
|
302164
302355
|
Object.entries(state.options.math).forEach(([k, v]) => {
|
302165
302356
|
if (value.includes(k))
|
302166
|
-
state.data.mathPlugins[k] = v;
|
302357
|
+
state.data.mathPlugins[k] = v.macro;
|
302167
302358
|
});
|
302168
302359
|
}
|
302169
302360
|
function withRecursiveCommands(state, plugins2 = state.data.mathPlugins) {
|
@@ -302176,7 +302367,7 @@ function withRecursiveCommands(state, plugins2 = state.data.mathPlugins) {
|
|
302176
302367
|
return;
|
302177
302368
|
pluginsList.forEach(([, value]) => {
|
302178
302369
|
if (value.includes(k))
|
302179
|
-
addedPlugins[k] = v;
|
302370
|
+
addedPlugins[k] = v.macro;
|
302180
302371
|
});
|
302181
302372
|
});
|
302182
302373
|
const newPlugins = { ...addedPlugins, ...plugins2 };
|
@@ -303967,28 +304158,39 @@ function addMacrosToState2(value, state) {
|
|
303967
304158
|
return;
|
303968
304159
|
Object.entries(state.options.math).forEach(([k, v]) => {
|
303969
304160
|
const key2 = texToTypst(k);
|
303970
|
-
if (value.includes(key2))
|
303971
|
-
state.data.mathPlugins[key2] = texToTypst(v);
|
304161
|
+
if (value.includes(key2)) {
|
304162
|
+
state.data.mathPlugins[key2] = texToTypst(v.macro);
|
304163
|
+
}
|
303972
304164
|
});
|
303973
304165
|
}
|
303974
|
-
function
|
303975
|
-
|
303976
|
-
|
303977
|
-
|
303978
|
-
|
303979
|
-
|
303980
|
-
|
303981
|
-
|
303982
|
-
|
303983
|
-
|
303984
|
-
|
303985
|
-
|
304166
|
+
function findCommandInMacro(macro2, command) {
|
304167
|
+
const escapedCommand = command.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
304168
|
+
const commandRe = new RegExp(`${escapedCommand}(?![a-zA-Z])`, "g");
|
304169
|
+
return [...macro2.matchAll(commandRe)].length > 0;
|
304170
|
+
}
|
304171
|
+
function replaceCommandInMacro(macro2, command, replaceValue) {
|
304172
|
+
const escapedCommand = command.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
304173
|
+
const commandRe = new RegExp(`${escapedCommand}(?![a-zA-Z])`, "g");
|
304174
|
+
return macro2.replaceAll(commandRe, replaceValue);
|
304175
|
+
}
|
304176
|
+
function resolveRecursiveCommands(plugins2) {
|
304177
|
+
let pluginsUpdated = false;
|
304178
|
+
const newPlugins = Object.fromEntries(Object.entries(plugins2).map(([command, value]) => {
|
304179
|
+
let newMacro = value.macro;
|
304180
|
+
Object.entries(plugins2).forEach(([c, { macro: m2 }]) => {
|
304181
|
+
if (findCommandInMacro(newMacro, c)) {
|
304182
|
+
if (command === c) {
|
304183
|
+
} else {
|
304184
|
+
newMacro = replaceCommandInMacro(newMacro, c, m2);
|
304185
|
+
pluginsUpdated = true;
|
304186
|
+
}
|
304187
|
+
}
|
303986
304188
|
});
|
303987
|
-
|
303988
|
-
|
303989
|
-
if (
|
303990
|
-
return newPlugins;
|
303991
|
-
return
|
304189
|
+
return [command, { ...value, macro: newMacro }];
|
304190
|
+
}));
|
304191
|
+
if (pluginsUpdated)
|
304192
|
+
return resolveRecursiveCommands(newPlugins);
|
304193
|
+
return newPlugins;
|
303992
304194
|
}
|
303993
304195
|
var math5 = (node3, state) => {
|
303994
304196
|
const value = texToTypst(node3.value);
|
@@ -304403,7 +304605,10 @@ var TypstSerializer = class {
|
|
304403
304605
|
var _a6;
|
304404
304606
|
file.result = "";
|
304405
304607
|
this.file = file;
|
304406
|
-
|
304608
|
+
const { math: math7, ...otherOpts } = opts !== null && opts !== void 0 ? opts : {};
|
304609
|
+
this.options = { ...otherOpts };
|
304610
|
+
if (math7)
|
304611
|
+
this.options.math = resolveRecursiveCommands(math7);
|
304407
304612
|
this.data = { mathPlugins: {}, macros: /* @__PURE__ */ new Set() };
|
304408
304613
|
this.handlers = (_a6 = opts === null || opts === void 0 ? void 0 : opts.handlers) !== null && _a6 !== void 0 ? _a6 : handlers4;
|
304409
304614
|
this.footnotes = Object.fromEntries(selectAll("footnoteDefinition", tree).map((node3) => {
|
@@ -304481,7 +304686,7 @@ var plugin3 = function(opts) {
|
|
304481
304686
|
const tex = file.result.trim();
|
304482
304687
|
const result = {
|
304483
304688
|
macros: [...state.data.macros],
|
304484
|
-
commands:
|
304689
|
+
commands: state.data.mathPlugins,
|
304485
304690
|
value: tex
|
304486
304691
|
};
|
304487
304692
|
file.result = result;
|
@@ -305557,7 +305762,7 @@ async function runWordExport(session, file, exportOptions, opts) {
|
|
305557
305762
|
data.frontmatter = { ...data.frontmatter, ...exportFrontmatter };
|
305558
305763
|
const { options, doc } = mystTemplate.prepare({
|
305559
305764
|
frontmatter: data.frontmatter,
|
305560
|
-
parts:
|
305765
|
+
parts: {},
|
305561
305766
|
options: { ...data.frontmatter.options, ...exportOptions },
|
305562
305767
|
sourceFile: file
|
305563
305768
|
});
|
@@ -313315,9 +313520,11 @@ var import_chokidar2 = __toESM(require_chokidar(), 1);
|
|
313315
313520
|
var import_node_path53 = require("path");
|
313316
313521
|
function watchConfigAndPublic(session, serverReload, opts) {
|
313317
313522
|
const watchFiles = ["public"];
|
313318
|
-
const
|
313523
|
+
const state = session.store.getState();
|
313524
|
+
const siteConfigFile = selectors_exports.selectCurrentSiteFile(state);
|
313319
313525
|
if (siteConfigFile)
|
313320
313526
|
watchFiles.push(siteConfigFile);
|
313527
|
+
watchFiles.push(...selectors_exports.selectConfigExtensions(state));
|
313321
313528
|
return import_chokidar2.default.watch(watchFiles, {
|
313322
313529
|
ignoreInitial: true,
|
313323
313530
|
awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 50 }
|
@@ -313326,6 +313533,8 @@ function watchConfigAndPublic(session, serverReload, opts) {
|
|
313326
313533
|
function triggerProjectReload(session, file, eventType, projectPath) {
|
313327
313534
|
const state = session.store.getState();
|
313328
313535
|
const projectConfigFile = projectPath ? selectors_exports.selectLocalConfigFile(state, projectPath) : selectors_exports.selectCurrentProjectFile(state);
|
313536
|
+
if (selectors_exports.selectConfigExtensions(state).includes(file))
|
313537
|
+
return true;
|
313329
313538
|
if (file === projectConfigFile || (0, import_node_path53.basename)(file) === "_toc.yml")
|
313330
313539
|
return true;
|
313331
313540
|
if (["add", "unlink"].includes(eventType))
|
@@ -313333,6 +313542,7 @@ function triggerProjectReload(session, file, eventType, projectPath) {
|
|
313333
313542
|
return false;
|
313334
313543
|
}
|
313335
313544
|
async function processorFn(session, file, eventType, siteProject, serverReload, opts) {
|
313545
|
+
var _a6;
|
313336
313546
|
if (file) {
|
313337
313547
|
changeFile(session, file, eventType);
|
313338
313548
|
if (KNOWN_FAST_BUILDS.has((0, import_node_path53.extname)(file)) && eventType === "unlink") {
|
@@ -313340,8 +313550,8 @@ async function processorFn(session, file, eventType, siteProject, serverReload,
|
|
313340
313550
|
}
|
313341
313551
|
}
|
313342
313552
|
if (!siteProject || !file || !KNOWN_FAST_BUILDS.has((0, import_node_path53.extname)(file)) || ["add", "unlink"].includes(eventType)) {
|
313343
|
-
let reloadProject = false;
|
313344
|
-
if (file && triggerProjectReload(session, file, eventType, siteProject === null || siteProject === void 0 ? void 0 : siteProject.path)) {
|
313553
|
+
let reloadProject = (_a6 = opts === null || opts === void 0 ? void 0 : opts.reloadProject) !== null && _a6 !== void 0 ? _a6 : false;
|
313554
|
+
if (reloadProject || file && triggerProjectReload(session, file, eventType, siteProject === null || siteProject === void 0 ? void 0 : siteProject.path)) {
|
313345
313555
|
session.log.info("\u{1F4A5} Triggered full project load and site rebuild");
|
313346
313556
|
reloadProject = true;
|
313347
313557
|
} else {
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|