@diplodoc/client 3.10.0 → 3.10.2
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.
- package/CHANGELOG.md +14 -0
- package/build/client/{app-250ccd6b9d8d1ce4.css → app-34c68624e23be7ce.css} +2 -2
- package/build/client/{app-250ccd6b9d8d1ce4.css.map → app-34c68624e23be7ce.css.map} +1 -1
- package/build/client/{app-15ff6087f699f3a0.rtl.css → app-d88d1fac5b51ff99.rtl.css} +1 -1
- package/build/client/{app-d3c7d6f65b8d53f0.js → app-f02b0cdd5ec0de12.js} +2 -2
- package/build/client/app-f02b0cdd5ec0de12.js.map +1 -0
- package/build/client/manifest.json +7 -7
- package/build/client/{search-d55c2c5eee1cd174.rtl.css → search-232df3e8600322f2.rtl.css} +1 -1
- package/build/client/{search-733d78d17e4b1925.css → search-b82629d53f2e437c.css} +2 -2
- package/build/client/{search-733d78d17e4b1925.css.map → search-b82629d53f2e437c.css.map} +1 -1
- package/build/server/app.js +33 -28
- package/build/server/app.js.map +1 -1
- package/build/server/vendor.js +374 -374
- package/build/server/vendor.js.map +1 -1
- package/build/utils.d.ts +2 -3
- package/package.json +1 -1
- package/build/client/app-d3c7d6f65b8d53f0.js.map +0 -1
package/build/server/vendor.js
CHANGED
|
@@ -12411,12 +12411,14 @@ function getPageType({
|
|
|
12411
12411
|
|
|
12412
12412
|
|
|
12413
12413
|
}),
|
|
12414
|
-
|
|
12414
|
+
86224: (function (module, __unused_webpack_exports, __webpack_require__) {
|
|
12415
12415
|
"use strict";
|
|
12416
12416
|
|
|
12417
|
+
var __create = Object.create;
|
|
12417
12418
|
var __defProp = Object.defineProperty;
|
|
12418
12419
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12419
12420
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12421
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
12420
12422
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12421
12423
|
var __export = (target, all) => {
|
|
12422
12424
|
for (var name in all)
|
|
@@ -12430,393 +12432,113 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
12430
12432
|
}
|
|
12431
12433
|
return to;
|
|
12432
12434
|
};
|
|
12435
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
12436
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
12437
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
12438
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
12439
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
12440
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
12441
|
+
mod
|
|
12442
|
+
));
|
|
12433
12443
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
12434
12444
|
|
|
12435
|
-
// src/
|
|
12436
|
-
var
|
|
12437
|
-
__export(
|
|
12438
|
-
|
|
12439
|
-
|
|
12445
|
+
// src/index.ts
|
|
12446
|
+
var src_exports = {};
|
|
12447
|
+
__export(src_exports, {
|
|
12448
|
+
createBlockInlineToken: () => createBlockInlineToken,
|
|
12449
|
+
directiveParser: () => directiveParser,
|
|
12450
|
+
disableBlockDirectives: () => disableBlockDirectives,
|
|
12451
|
+
disableInlineDirectives: () => disableInlineDirectives,
|
|
12452
|
+
enableBlockDirectives: () => enableBlockDirectives,
|
|
12453
|
+
enableInlineDirectives: () => enableInlineDirectives,
|
|
12454
|
+
registerContainerDirective: () => registerContainerDirective,
|
|
12455
|
+
registerInlineDirective: () => registerInlineDirective,
|
|
12456
|
+
registerLeafBlockDirective: () => registerLeafBlockDirective,
|
|
12457
|
+
tokenizeBlockContent: () => tokenizeBlockContent,
|
|
12458
|
+
tokenizeInlineContent: () => tokenizeInlineContent
|
|
12440
12459
|
});
|
|
12441
|
-
module.exports = __toCommonJS(
|
|
12442
|
-
|
|
12443
|
-
// src/plugin/plugin.ts
|
|
12444
|
-
var import_utils = __webpack_require__(87910);
|
|
12460
|
+
module.exports = __toCommonJS(src_exports);
|
|
12461
|
+
var import_markdown_it_directive = __toESM(__webpack_require__(20767));
|
|
12445
12462
|
|
|
12446
|
-
// src/
|
|
12447
|
-
var
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
CutOpen: "yfm_cut_open",
|
|
12451
|
-
CutClose: "yfm_cut_close",
|
|
12452
|
-
Title: "yfm_cut_title",
|
|
12453
|
-
TitleOpen: "yfm_cut_title_open",
|
|
12454
|
-
TitleClose: "yfm_cut_title_close",
|
|
12455
|
-
Content: "yfm_cut_content",
|
|
12456
|
-
ContentOpen: "yfm_cut_content_open",
|
|
12457
|
-
ContentClose: "yfm_cut_content_close"
|
|
12458
|
-
};
|
|
12459
|
-
var ClassNames = {
|
|
12460
|
-
Cut: "yfm-cut",
|
|
12461
|
-
Title: "yfm-cut-title",
|
|
12462
|
-
Content: "yfm-cut-content"
|
|
12463
|
+
// src/const.ts
|
|
12464
|
+
var RULE = {
|
|
12465
|
+
Inline: "inline_directive",
|
|
12466
|
+
Block: "block_directive"
|
|
12463
12467
|
};
|
|
12468
|
+
var CONTAINER_KEY = Symbol();
|
|
12469
|
+
var LEAF_BLOCK_KEY = Symbol();
|
|
12464
12470
|
|
|
12465
|
-
// src/
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
return tokens[i].type === "paragraph_open" && tokens[i + 1].type === "inline" && tokens[i + 1].content.match(CUT_REGEXP);
|
|
12471
|
+
// src/helpers/index.ts
|
|
12472
|
+
function enableInlineDirectives(md) {
|
|
12473
|
+
md.inline.ruler.enable(RULE.Inline, true);
|
|
12469
12474
|
}
|
|
12470
|
-
function
|
|
12471
|
-
|
|
12475
|
+
function disableInlineDirectives(md) {
|
|
12476
|
+
md.inline.ruler.disable(RULE.Inline, true);
|
|
12472
12477
|
}
|
|
12473
|
-
function
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
level++;
|
|
12479
|
-
} else if (matchCloseToken(tokens, i)) {
|
|
12480
|
-
if (level === 0) {
|
|
12481
|
-
return i;
|
|
12482
|
-
}
|
|
12483
|
-
level--;
|
|
12484
|
-
}
|
|
12485
|
-
i++;
|
|
12486
|
-
}
|
|
12487
|
-
return null;
|
|
12478
|
+
function enableBlockDirectives(md) {
|
|
12479
|
+
md.block.ruler.enable(RULE.Block, true);
|
|
12480
|
+
}
|
|
12481
|
+
function disableBlockDirectives(md) {
|
|
12482
|
+
md.block.ruler.disable(RULE.Block, true);
|
|
12488
12483
|
}
|
|
12489
12484
|
|
|
12490
|
-
// src/
|
|
12491
|
-
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
if (match) {
|
|
12498
|
-
const closeTokenIdx = findCloseTokenIdx(tokens, i + 4);
|
|
12499
|
-
if (!closeTokenIdx) {
|
|
12500
|
-
i += 3;
|
|
12501
|
-
continue;
|
|
12502
|
-
}
|
|
12503
|
-
const title = match[1];
|
|
12504
|
-
const attrs = match[2] || "";
|
|
12505
|
-
if (typeof title === "undefined") {
|
|
12506
|
-
throw new Error(`No title provided for cut ${match[0]}`);
|
|
12507
|
-
}
|
|
12508
|
-
const attrsParser = new import_utils.AttrsParser(attrs);
|
|
12509
|
-
const newOpenToken = new state.Token(TokenType.CutOpen, "details", 1);
|
|
12510
|
-
newOpenToken.attrSet("class", ClassNames.Cut);
|
|
12511
|
-
newOpenToken.map = tokens[i].map;
|
|
12512
|
-
newOpenToken.markup = "{%";
|
|
12513
|
-
attrsParser.apply(newOpenToken);
|
|
12514
|
-
const titleOpen = new state.Token(TokenType.TitleOpen, "summary", 1);
|
|
12515
|
-
titleOpen.attrSet("class", ClassNames.Title);
|
|
12516
|
-
const titleInline = state.md.parseInline(title, state.env)[0];
|
|
12517
|
-
const titleClose = new state.Token(TokenType.TitleClose, "summary", -1);
|
|
12518
|
-
const contentOpen = new state.Token(TokenType.ContentOpen, "div", 1);
|
|
12519
|
-
contentOpen.attrSet("class", ClassNames.Content);
|
|
12520
|
-
if (newOpenToken.map) {
|
|
12521
|
-
const contentOpenStart = newOpenToken.map[0] + 1;
|
|
12522
|
-
const contentOpenEnd = newOpenToken.map[0] + 2;
|
|
12523
|
-
contentOpen.map = [contentOpenStart, contentOpenEnd];
|
|
12524
|
-
}
|
|
12525
|
-
const contentClose = new state.Token(TokenType.ContentClose, "div", -1);
|
|
12526
|
-
const newCloseToken = new state.Token(TokenType.CutClose, "details", -1);
|
|
12527
|
-
newCloseToken.map = tokens[closeTokenIdx].map;
|
|
12528
|
-
const insideTokens = [
|
|
12529
|
-
newOpenToken,
|
|
12530
|
-
titleOpen,
|
|
12531
|
-
titleInline,
|
|
12532
|
-
titleClose,
|
|
12533
|
-
contentOpen,
|
|
12534
|
-
...tokens.slice(i + 3, closeTokenIdx),
|
|
12535
|
-
contentClose,
|
|
12536
|
-
newCloseToken
|
|
12537
|
-
];
|
|
12538
|
-
tokens.splice(i, closeTokenIdx - i + 3, ...insideTokens);
|
|
12539
|
-
state.env ??= {};
|
|
12540
|
-
state.env[ENV_FLAG_NAME] = true;
|
|
12541
|
-
i++;
|
|
12542
|
-
} else {
|
|
12543
|
-
i++;
|
|
12544
|
-
}
|
|
12545
|
-
}
|
|
12546
|
-
};
|
|
12547
|
-
try {
|
|
12548
|
-
md.core.ruler.before("curly_attributes", "cut", rule);
|
|
12549
|
-
} catch (e) {
|
|
12550
|
-
md.core.ruler.push("cut", rule);
|
|
12551
|
-
}
|
|
12552
|
-
};
|
|
12485
|
+
// src/utils.ts
|
|
12486
|
+
function isFunction(arg) {
|
|
12487
|
+
return typeof arg === "function";
|
|
12488
|
+
}
|
|
12489
|
+
function isString(arg) {
|
|
12490
|
+
return typeof arg === "string";
|
|
12491
|
+
}
|
|
12553
12492
|
|
|
12554
|
-
// src/
|
|
12555
|
-
function
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12493
|
+
// src/helpers/tokenizers.ts
|
|
12494
|
+
function tokenizeInlineContent(state, content) {
|
|
12495
|
+
const oldPos = state.pos;
|
|
12496
|
+
const oldPosMax = state.posMax;
|
|
12497
|
+
state.pos = content.startPos;
|
|
12498
|
+
state.posMax = content.endPos;
|
|
12499
|
+
state.md.inline.tokenize(state);
|
|
12500
|
+
state.pos = oldPos;
|
|
12501
|
+
state.posMax = oldPosMax;
|
|
12563
12502
|
}
|
|
12564
|
-
function
|
|
12565
|
-
const
|
|
12566
|
-
const
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12503
|
+
function tokenizeBlockContent(state, content, parentType) {
|
|
12504
|
+
const oldParent = state.parentType;
|
|
12505
|
+
const oldLineMax = state.lineMax;
|
|
12506
|
+
state.parentType = parentType ?? "directive";
|
|
12507
|
+
state.line = content.startLine;
|
|
12508
|
+
state.lineMax = content.endLine;
|
|
12509
|
+
state.md.block.tokenize(state, content.startLine, content.endLine);
|
|
12510
|
+
state.lineMax = oldLineMax;
|
|
12511
|
+
state.parentType = oldParent;
|
|
12512
|
+
}
|
|
12513
|
+
function createBlockInlineToken(state, { inlineContent, startLine }) {
|
|
12514
|
+
const token = state.push("inline", "", 0);
|
|
12515
|
+
token.children = [];
|
|
12516
|
+
token.content = inlineContent?.raw || "";
|
|
12517
|
+
token.map = [startLine, startLine + 1];
|
|
12518
|
+
return token;
|
|
12519
|
+
}
|
|
12520
|
+
|
|
12521
|
+
// src/helpers/registrars.ts
|
|
12522
|
+
function registerInlineDirective(md, name, handler) {
|
|
12523
|
+
md.inlineDirectives[name] = (args) => {
|
|
12524
|
+
const params = buildInlineParams(args);
|
|
12525
|
+
return handler(args.state, params);
|
|
12570
12526
|
};
|
|
12571
|
-
for (const [originFile, outputFile] of Object.entries(runtimeFiles)) {
|
|
12572
|
-
const file = join(PATH_TO_RUNTIME, originFile);
|
|
12573
|
-
if (!cache.has(file)) {
|
|
12574
|
-
cache.add(file);
|
|
12575
|
-
copy(resolve(__dirname, file), join(output, outputFile));
|
|
12576
|
-
}
|
|
12577
|
-
}
|
|
12578
12527
|
}
|
|
12579
|
-
function
|
|
12580
|
-
const
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12528
|
+
function registerLeafBlockDirective(md, nameOrConfig, maybeHandler) {
|
|
12529
|
+
const [name, handler] = isString(nameOrConfig) ? [nameOrConfig, maybeHandler] : [nameOrConfig.name, buildLeafBlockHandler(nameOrConfig)];
|
|
12530
|
+
md[LEAF_BLOCK_KEY] ||= {};
|
|
12531
|
+
md[LEAF_BLOCK_KEY][name] = handler;
|
|
12532
|
+
md.blockDirectives[name] = getBlockDefaultHandler(md, name);
|
|
12584
12533
|
}
|
|
12585
|
-
function
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
md.
|
|
12593
|
-
(0, import_directive.registerContainerDirective)(md, {
|
|
12594
|
-
name: "cut",
|
|
12595
|
-
match(_params, state) {
|
|
12596
|
-
state.env ??= {};
|
|
12597
|
-
state.env[ENV_FLAG_NAME] = true;
|
|
12598
|
-
return true;
|
|
12599
|
-
},
|
|
12600
|
-
container: {
|
|
12601
|
-
tag: "details",
|
|
12602
|
-
token: TokenType.Cut,
|
|
12603
|
-
attrs: {
|
|
12604
|
-
class: ClassNames.Cut
|
|
12605
|
-
}
|
|
12606
|
-
},
|
|
12607
|
-
inlineContent: {
|
|
12608
|
-
required: false,
|
|
12609
|
-
tag: "summary",
|
|
12610
|
-
token: TokenType.Title,
|
|
12611
|
-
attrs: {
|
|
12612
|
-
class: ClassNames.Title
|
|
12613
|
-
}
|
|
12614
|
-
},
|
|
12615
|
-
content: {
|
|
12616
|
-
tag: "div",
|
|
12617
|
-
token: TokenType.Content,
|
|
12618
|
-
attrs: {
|
|
12619
|
-
class: ClassNames.Content
|
|
12620
|
-
}
|
|
12621
|
-
}
|
|
12622
|
-
});
|
|
12623
|
-
};
|
|
12624
|
-
|
|
12625
|
-
// src/plugin/transform.ts
|
|
12626
|
-
var registerTransform = (md, {
|
|
12627
|
-
runtime,
|
|
12628
|
-
bundle,
|
|
12629
|
-
output,
|
|
12630
|
-
directiveSyntax
|
|
12631
|
-
}) => {
|
|
12632
|
-
if (directiveSyntax === "disabled" || directiveSyntax === "enabled") {
|
|
12633
|
-
md.use(cutPlugin);
|
|
12634
|
-
}
|
|
12635
|
-
if (directiveSyntax === "enabled" || directiveSyntax === "only") {
|
|
12636
|
-
md.use(cutDirective);
|
|
12637
|
-
}
|
|
12638
|
-
md.core.ruler.push("yfm_cut_after", ({ env }) => {
|
|
12639
|
-
hidden(env, "bundled", /* @__PURE__ */ new Set());
|
|
12640
|
-
if (env?.[ENV_FLAG_NAME]) {
|
|
12641
|
-
env.meta = env.meta || {};
|
|
12642
|
-
env.meta.script = env.meta.script || [];
|
|
12643
|
-
env.meta.script.push(runtime.script);
|
|
12644
|
-
env.meta.style = env.meta.style || [];
|
|
12645
|
-
env.meta.style.push(runtime.style);
|
|
12646
|
-
if (bundle) {
|
|
12647
|
-
copyRuntime({ runtime, output }, env.bundled);
|
|
12648
|
-
}
|
|
12649
|
-
}
|
|
12650
|
-
});
|
|
12651
|
-
};
|
|
12652
|
-
function transform(options = {}) {
|
|
12653
|
-
const { bundle = true } = options;
|
|
12654
|
-
if (bundle && typeof options.runtime === "string") {
|
|
12655
|
-
throw new TypeError("Option `runtime` should be record when `bundle` is enabled.");
|
|
12656
|
-
}
|
|
12657
|
-
const directiveSyntax = options.directiveSyntax || "disabled";
|
|
12658
|
-
const runtime = typeof options.runtime === "string" ? { script: options.runtime, style: options.runtime } : options.runtime || {
|
|
12659
|
-
script: "_assets/cut-extension.js",
|
|
12660
|
-
style: "_assets/cut-extension.css"
|
|
12661
|
-
};
|
|
12662
|
-
const plugin = function(md, { output = "." } = {}) {
|
|
12663
|
-
registerTransform(md, {
|
|
12664
|
-
directiveSyntax,
|
|
12665
|
-
runtime,
|
|
12666
|
-
bundle,
|
|
12667
|
-
output
|
|
12668
|
-
});
|
|
12669
|
-
};
|
|
12670
|
-
Object.assign(plugin, {
|
|
12671
|
-
collect(input, { destRoot = "." }) {
|
|
12672
|
-
const MdIt = dynrequire("markdown-it");
|
|
12673
|
-
const md = new MdIt().use((md2) => {
|
|
12674
|
-
registerTransform(md2, {
|
|
12675
|
-
directiveSyntax,
|
|
12676
|
-
runtime,
|
|
12677
|
-
bundle,
|
|
12678
|
-
output: destRoot
|
|
12679
|
-
});
|
|
12680
|
-
});
|
|
12681
|
-
md.parse(input, {});
|
|
12682
|
-
}
|
|
12683
|
-
});
|
|
12684
|
-
return plugin;
|
|
12685
|
-
}
|
|
12686
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
12687
|
-
0 && 0;
|
|
12688
|
-
//# sourceMappingURL=index.js.map
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
}),
|
|
12692
|
-
86224: (function (module, __unused_webpack_exports, __webpack_require__) {
|
|
12693
|
-
"use strict";
|
|
12694
|
-
|
|
12695
|
-
var __create = Object.create;
|
|
12696
|
-
var __defProp = Object.defineProperty;
|
|
12697
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12698
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12699
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
12700
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12701
|
-
var __export = (target, all) => {
|
|
12702
|
-
for (var name in all)
|
|
12703
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12704
|
-
};
|
|
12705
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12706
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12707
|
-
for (let key of __getOwnPropNames(from))
|
|
12708
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12709
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12710
|
-
}
|
|
12711
|
-
return to;
|
|
12712
|
-
};
|
|
12713
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
12714
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
12715
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
12716
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
12717
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
12718
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
12719
|
-
mod
|
|
12720
|
-
));
|
|
12721
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
12722
|
-
|
|
12723
|
-
// src/index.ts
|
|
12724
|
-
var src_exports = {};
|
|
12725
|
-
__export(src_exports, {
|
|
12726
|
-
createBlockInlineToken: () => createBlockInlineToken,
|
|
12727
|
-
directiveParser: () => directiveParser,
|
|
12728
|
-
disableBlockDirectives: () => disableBlockDirectives,
|
|
12729
|
-
disableInlineDirectives: () => disableInlineDirectives,
|
|
12730
|
-
enableBlockDirectives: () => enableBlockDirectives,
|
|
12731
|
-
enableInlineDirectives: () => enableInlineDirectives,
|
|
12732
|
-
registerContainerDirective: () => registerContainerDirective,
|
|
12733
|
-
registerInlineDirective: () => registerInlineDirective,
|
|
12734
|
-
registerLeafBlockDirective: () => registerLeafBlockDirective,
|
|
12735
|
-
tokenizeBlockContent: () => tokenizeBlockContent,
|
|
12736
|
-
tokenizeInlineContent: () => tokenizeInlineContent
|
|
12737
|
-
});
|
|
12738
|
-
module.exports = __toCommonJS(src_exports);
|
|
12739
|
-
var import_markdown_it_directive = __toESM(__webpack_require__(20767));
|
|
12740
|
-
|
|
12741
|
-
// src/const.ts
|
|
12742
|
-
var RULE = {
|
|
12743
|
-
Inline: "inline_directive",
|
|
12744
|
-
Block: "block_directive"
|
|
12745
|
-
};
|
|
12746
|
-
var CONTAINER_KEY = Symbol();
|
|
12747
|
-
var LEAF_BLOCK_KEY = Symbol();
|
|
12748
|
-
|
|
12749
|
-
// src/helpers/index.ts
|
|
12750
|
-
function enableInlineDirectives(md) {
|
|
12751
|
-
md.inline.ruler.enable(RULE.Inline, true);
|
|
12752
|
-
}
|
|
12753
|
-
function disableInlineDirectives(md) {
|
|
12754
|
-
md.inline.ruler.disable(RULE.Inline, true);
|
|
12755
|
-
}
|
|
12756
|
-
function enableBlockDirectives(md) {
|
|
12757
|
-
md.block.ruler.enable(RULE.Block, true);
|
|
12758
|
-
}
|
|
12759
|
-
function disableBlockDirectives(md) {
|
|
12760
|
-
md.block.ruler.disable(RULE.Block, true);
|
|
12761
|
-
}
|
|
12762
|
-
|
|
12763
|
-
// src/utils.ts
|
|
12764
|
-
function isFunction(arg) {
|
|
12765
|
-
return typeof arg === "function";
|
|
12766
|
-
}
|
|
12767
|
-
function isString(arg) {
|
|
12768
|
-
return typeof arg === "string";
|
|
12769
|
-
}
|
|
12770
|
-
|
|
12771
|
-
// src/helpers/tokenizers.ts
|
|
12772
|
-
function tokenizeInlineContent(state, content) {
|
|
12773
|
-
const oldPos = state.pos;
|
|
12774
|
-
const oldPosMax = state.posMax;
|
|
12775
|
-
state.pos = content.startPos;
|
|
12776
|
-
state.posMax = content.endPos;
|
|
12777
|
-
state.md.inline.tokenize(state);
|
|
12778
|
-
state.pos = oldPos;
|
|
12779
|
-
state.posMax = oldPosMax;
|
|
12780
|
-
}
|
|
12781
|
-
function tokenizeBlockContent(state, content, parentType) {
|
|
12782
|
-
const oldParent = state.parentType;
|
|
12783
|
-
const oldLineMax = state.lineMax;
|
|
12784
|
-
state.parentType = parentType ?? "directive";
|
|
12785
|
-
state.line = content.startLine;
|
|
12786
|
-
state.lineMax = content.endLine;
|
|
12787
|
-
state.md.block.tokenize(state, content.startLine, content.endLine);
|
|
12788
|
-
state.lineMax = oldLineMax;
|
|
12789
|
-
state.parentType = oldParent;
|
|
12790
|
-
}
|
|
12791
|
-
function createBlockInlineToken(state, { inlineContent, startLine }) {
|
|
12792
|
-
const token = state.push("inline", "", 0);
|
|
12793
|
-
token.children = [];
|
|
12794
|
-
token.content = inlineContent?.raw || "";
|
|
12795
|
-
token.map = [startLine, startLine + 1];
|
|
12796
|
-
return token;
|
|
12797
|
-
}
|
|
12798
|
-
|
|
12799
|
-
// src/helpers/registrars.ts
|
|
12800
|
-
function registerInlineDirective(md, name, handler) {
|
|
12801
|
-
md.inlineDirectives[name] = (args) => {
|
|
12802
|
-
const params = buildInlineParams(args);
|
|
12803
|
-
return handler(args.state, params);
|
|
12804
|
-
};
|
|
12805
|
-
}
|
|
12806
|
-
function registerLeafBlockDirective(md, nameOrConfig, maybeHandler) {
|
|
12807
|
-
const [name, handler] = isString(nameOrConfig) ? [nameOrConfig, maybeHandler] : [nameOrConfig.name, buildLeafBlockHandler(nameOrConfig)];
|
|
12808
|
-
md[LEAF_BLOCK_KEY] ||= {};
|
|
12809
|
-
md[LEAF_BLOCK_KEY][name] = handler;
|
|
12810
|
-
md.blockDirectives[name] = getBlockDefaultHandler(md, name);
|
|
12811
|
-
}
|
|
12812
|
-
function registerContainerDirective(md, nameOrConfig, maybeHandler) {
|
|
12813
|
-
const [name, handler] = isString(nameOrConfig) ? [nameOrConfig, maybeHandler] : [
|
|
12814
|
-
nameOrConfig.name,
|
|
12815
|
-
nameOrConfig.type === "code_block" ? buildCodeContainerHandler(nameOrConfig) : buildContainerHandler(nameOrConfig)
|
|
12816
|
-
];
|
|
12817
|
-
md[CONTAINER_KEY] ||= {};
|
|
12818
|
-
md[CONTAINER_KEY][name] = handler;
|
|
12819
|
-
md.blockDirectives[name] = getBlockDefaultHandler(md, name);
|
|
12534
|
+
function registerContainerDirective(md, nameOrConfig, maybeHandler) {
|
|
12535
|
+
const [name, handler] = isString(nameOrConfig) ? [nameOrConfig, maybeHandler] : [
|
|
12536
|
+
nameOrConfig.name,
|
|
12537
|
+
nameOrConfig.type === "code_block" ? buildCodeContainerHandler(nameOrConfig) : buildContainerHandler(nameOrConfig)
|
|
12538
|
+
];
|
|
12539
|
+
md[CONTAINER_KEY] ||= {};
|
|
12540
|
+
md[CONTAINER_KEY][name] = handler;
|
|
12541
|
+
md.blockDirectives[name] = getBlockDefaultHandler(md, name);
|
|
12820
12542
|
}
|
|
12821
12543
|
function getBlockDefaultHandler(md, name) {
|
|
12822
12544
|
return (args) => {
|
|
@@ -18339,7 +18061,7 @@ module.exports = code;
|
|
|
18339
18061
|
58285: (function (module, __unused_webpack_exports, __webpack_require__) {
|
|
18340
18062
|
"use strict";
|
|
18341
18063
|
|
|
18342
|
-
const cut_extension_1 = __webpack_require__(
|
|
18064
|
+
const cut_extension_1 = __webpack_require__(4103);
|
|
18343
18065
|
module.exports = (0, cut_extension_1.transform)({ bundle: false, directiveSyntax: 'disabled' });
|
|
18344
18066
|
//# sourceMappingURL=cut.js.map
|
|
18345
18067
|
|
|
@@ -21292,6 +21014,284 @@ function getRealPath(symlinkPath) {
|
|
|
21292
21014
|
exports.getRealPath = getRealPath;
|
|
21293
21015
|
//# sourceMappingURL=utilsFS.js.map
|
|
21294
21016
|
|
|
21017
|
+
}),
|
|
21018
|
+
4103: (function (module, __unused_webpack_exports, __webpack_require__) {
|
|
21019
|
+
"use strict";
|
|
21020
|
+
|
|
21021
|
+
var __defProp = Object.defineProperty;
|
|
21022
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
21023
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
21024
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
21025
|
+
var __export = (target, all) => {
|
|
21026
|
+
for (var name in all)
|
|
21027
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
21028
|
+
};
|
|
21029
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21030
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
21031
|
+
for (let key of __getOwnPropNames(from))
|
|
21032
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21033
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21034
|
+
}
|
|
21035
|
+
return to;
|
|
21036
|
+
};
|
|
21037
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21038
|
+
|
|
21039
|
+
// src/plugin/index.ts
|
|
21040
|
+
var plugin_exports = {};
|
|
21041
|
+
__export(plugin_exports, {
|
|
21042
|
+
TokenType: () => TokenType,
|
|
21043
|
+
transform: () => transform
|
|
21044
|
+
});
|
|
21045
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
21046
|
+
|
|
21047
|
+
// src/plugin/plugin.ts
|
|
21048
|
+
var import_utils = __webpack_require__(87910);
|
|
21049
|
+
|
|
21050
|
+
// src/plugin/const.ts
|
|
21051
|
+
var ENV_FLAG_NAME = "has-yfm-cut";
|
|
21052
|
+
var TokenType = {
|
|
21053
|
+
Cut: "yfm_cut",
|
|
21054
|
+
CutOpen: "yfm_cut_open",
|
|
21055
|
+
CutClose: "yfm_cut_close",
|
|
21056
|
+
Title: "yfm_cut_title",
|
|
21057
|
+
TitleOpen: "yfm_cut_title_open",
|
|
21058
|
+
TitleClose: "yfm_cut_title_close",
|
|
21059
|
+
Content: "yfm_cut_content",
|
|
21060
|
+
ContentOpen: "yfm_cut_content_open",
|
|
21061
|
+
ContentClose: "yfm_cut_content_close"
|
|
21062
|
+
};
|
|
21063
|
+
var ClassNames = {
|
|
21064
|
+
Cut: "yfm-cut",
|
|
21065
|
+
Title: "yfm-cut-title",
|
|
21066
|
+
Content: "yfm-cut-content"
|
|
21067
|
+
};
|
|
21068
|
+
|
|
21069
|
+
// src/plugin/helpers.ts
|
|
21070
|
+
var CUT_REGEXP = /^{%\s*cut\s*["|'](.*)["|']\s*%}(.*)?$/;
|
|
21071
|
+
function matchOpenToken(tokens, i) {
|
|
21072
|
+
return tokens[i].type === "paragraph_open" && tokens[i + 1].type === "inline" && tokens[i + 1].content.match(CUT_REGEXP);
|
|
21073
|
+
}
|
|
21074
|
+
function matchCloseToken(tokens, i) {
|
|
21075
|
+
return tokens[i].type === "paragraph_open" && tokens[i + 1].type === "inline" && tokens[i + 1].content.trim() === "{% endcut %}";
|
|
21076
|
+
}
|
|
21077
|
+
function findCloseTokenIdx(tokens, idx) {
|
|
21078
|
+
let level = 0;
|
|
21079
|
+
let i = idx;
|
|
21080
|
+
while (i < tokens.length) {
|
|
21081
|
+
if (matchOpenToken(tokens, i)) {
|
|
21082
|
+
level++;
|
|
21083
|
+
} else if (matchCloseToken(tokens, i)) {
|
|
21084
|
+
if (level === 0) {
|
|
21085
|
+
return i;
|
|
21086
|
+
}
|
|
21087
|
+
level--;
|
|
21088
|
+
}
|
|
21089
|
+
i++;
|
|
21090
|
+
}
|
|
21091
|
+
return null;
|
|
21092
|
+
}
|
|
21093
|
+
|
|
21094
|
+
// src/plugin/plugin.ts
|
|
21095
|
+
var cutPlugin = (md) => {
|
|
21096
|
+
const rule = (state) => {
|
|
21097
|
+
const tokens = state.tokens;
|
|
21098
|
+
let i = 0;
|
|
21099
|
+
while (i < tokens.length) {
|
|
21100
|
+
const match = matchOpenToken(tokens, i);
|
|
21101
|
+
if (match) {
|
|
21102
|
+
const closeTokenIdx = findCloseTokenIdx(tokens, i + 4);
|
|
21103
|
+
if (!closeTokenIdx) {
|
|
21104
|
+
i += 3;
|
|
21105
|
+
continue;
|
|
21106
|
+
}
|
|
21107
|
+
const title = match[1];
|
|
21108
|
+
const attrs = match[2] || "";
|
|
21109
|
+
if (typeof title === "undefined") {
|
|
21110
|
+
throw new Error(`No title provided for cut ${match[0]}`);
|
|
21111
|
+
}
|
|
21112
|
+
const attrsParser = new import_utils.AttrsParser(attrs);
|
|
21113
|
+
const newOpenToken = new state.Token(TokenType.CutOpen, "details", 1);
|
|
21114
|
+
newOpenToken.attrSet("class", ClassNames.Cut);
|
|
21115
|
+
newOpenToken.map = tokens[i].map;
|
|
21116
|
+
newOpenToken.markup = "{%";
|
|
21117
|
+
attrsParser.apply(newOpenToken);
|
|
21118
|
+
const titleOpen = new state.Token(TokenType.TitleOpen, "summary", 1);
|
|
21119
|
+
titleOpen.attrSet("class", ClassNames.Title);
|
|
21120
|
+
const titleInline = state.md.parseInline(title, state.env)[0];
|
|
21121
|
+
const titleClose = new state.Token(TokenType.TitleClose, "summary", -1);
|
|
21122
|
+
const contentOpen = new state.Token(TokenType.ContentOpen, "div", 1);
|
|
21123
|
+
contentOpen.attrSet("class", ClassNames.Content);
|
|
21124
|
+
if (newOpenToken.map) {
|
|
21125
|
+
const contentOpenStart = newOpenToken.map[0] + 1;
|
|
21126
|
+
const contentOpenEnd = newOpenToken.map[0] + 2;
|
|
21127
|
+
contentOpen.map = [contentOpenStart, contentOpenEnd];
|
|
21128
|
+
}
|
|
21129
|
+
const contentClose = new state.Token(TokenType.ContentClose, "div", -1);
|
|
21130
|
+
const newCloseToken = new state.Token(TokenType.CutClose, "details", -1);
|
|
21131
|
+
newCloseToken.map = tokens[closeTokenIdx].map;
|
|
21132
|
+
const insideTokens = [
|
|
21133
|
+
newOpenToken,
|
|
21134
|
+
titleOpen,
|
|
21135
|
+
titleInline,
|
|
21136
|
+
titleClose,
|
|
21137
|
+
contentOpen,
|
|
21138
|
+
...tokens.slice(i + 3, closeTokenIdx),
|
|
21139
|
+
contentClose,
|
|
21140
|
+
newCloseToken
|
|
21141
|
+
];
|
|
21142
|
+
tokens.splice(i, closeTokenIdx - i + 3, ...insideTokens);
|
|
21143
|
+
state.env ??= {};
|
|
21144
|
+
state.env[ENV_FLAG_NAME] = true;
|
|
21145
|
+
i++;
|
|
21146
|
+
} else {
|
|
21147
|
+
i++;
|
|
21148
|
+
}
|
|
21149
|
+
}
|
|
21150
|
+
};
|
|
21151
|
+
try {
|
|
21152
|
+
md.core.ruler.before("curly_attributes", "cut", rule);
|
|
21153
|
+
} catch (e) {
|
|
21154
|
+
md.core.ruler.push("cut", rule);
|
|
21155
|
+
}
|
|
21156
|
+
};
|
|
21157
|
+
|
|
21158
|
+
// src/plugin/utils.ts
|
|
21159
|
+
function hidden(box, field, value) {
|
|
21160
|
+
if (!(field in box)) {
|
|
21161
|
+
Object.defineProperty(box, field, {
|
|
21162
|
+
enumerable: false,
|
|
21163
|
+
value
|
|
21164
|
+
});
|
|
21165
|
+
}
|
|
21166
|
+
return box;
|
|
21167
|
+
}
|
|
21168
|
+
function copyRuntime({ runtime, output }, cache) {
|
|
21169
|
+
const PATH_TO_RUNTIME = "../runtime";
|
|
21170
|
+
const { join, resolve } = dynrequire("node:path");
|
|
21171
|
+
const runtimeFiles = {
|
|
21172
|
+
"index.js": runtime.script,
|
|
21173
|
+
"index.css": runtime.style
|
|
21174
|
+
};
|
|
21175
|
+
for (const [originFile, outputFile] of Object.entries(runtimeFiles)) {
|
|
21176
|
+
const file = join(PATH_TO_RUNTIME, originFile);
|
|
21177
|
+
if (!cache.has(file)) {
|
|
21178
|
+
cache.add(file);
|
|
21179
|
+
copy(resolve(__dirname, file), join(output, outputFile));
|
|
21180
|
+
}
|
|
21181
|
+
}
|
|
21182
|
+
}
|
|
21183
|
+
function copy(from, to) {
|
|
21184
|
+
const { mkdirSync, copyFileSync } = dynrequire("node:fs");
|
|
21185
|
+
const { dirname } = dynrequire("node:path");
|
|
21186
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
21187
|
+
copyFileSync(from, to);
|
|
21188
|
+
}
|
|
21189
|
+
function dynrequire(module) {
|
|
21190
|
+
return eval(`require('${module}')`);
|
|
21191
|
+
}
|
|
21192
|
+
|
|
21193
|
+
// src/plugin/directive.ts
|
|
21194
|
+
var import_directive = __webpack_require__(86224);
|
|
21195
|
+
var cutDirective = (md) => {
|
|
21196
|
+
md.use((0, import_directive.directiveParser)());
|
|
21197
|
+
(0, import_directive.registerContainerDirective)(md, {
|
|
21198
|
+
name: "cut",
|
|
21199
|
+
match(_params, state) {
|
|
21200
|
+
state.env ??= {};
|
|
21201
|
+
state.env[ENV_FLAG_NAME] = true;
|
|
21202
|
+
return true;
|
|
21203
|
+
},
|
|
21204
|
+
container: {
|
|
21205
|
+
tag: "details",
|
|
21206
|
+
token: TokenType.Cut,
|
|
21207
|
+
attrs: {
|
|
21208
|
+
class: ClassNames.Cut
|
|
21209
|
+
}
|
|
21210
|
+
},
|
|
21211
|
+
inlineContent: {
|
|
21212
|
+
required: false,
|
|
21213
|
+
tag: "summary",
|
|
21214
|
+
token: TokenType.Title,
|
|
21215
|
+
attrs: {
|
|
21216
|
+
class: ClassNames.Title
|
|
21217
|
+
}
|
|
21218
|
+
},
|
|
21219
|
+
content: {
|
|
21220
|
+
tag: "div",
|
|
21221
|
+
token: TokenType.Content,
|
|
21222
|
+
attrs: {
|
|
21223
|
+
class: ClassNames.Content
|
|
21224
|
+
}
|
|
21225
|
+
}
|
|
21226
|
+
});
|
|
21227
|
+
};
|
|
21228
|
+
|
|
21229
|
+
// src/plugin/transform.ts
|
|
21230
|
+
var registerTransform = (md, {
|
|
21231
|
+
runtime,
|
|
21232
|
+
bundle,
|
|
21233
|
+
output,
|
|
21234
|
+
directiveSyntax
|
|
21235
|
+
}) => {
|
|
21236
|
+
if (directiveSyntax === "disabled" || directiveSyntax === "enabled") {
|
|
21237
|
+
md.use(cutPlugin);
|
|
21238
|
+
}
|
|
21239
|
+
if (directiveSyntax === "enabled" || directiveSyntax === "only") {
|
|
21240
|
+
md.use(cutDirective);
|
|
21241
|
+
}
|
|
21242
|
+
md.core.ruler.push("yfm_cut_after", ({ env }) => {
|
|
21243
|
+
hidden(env, "bundled", /* @__PURE__ */ new Set());
|
|
21244
|
+
if (env?.[ENV_FLAG_NAME]) {
|
|
21245
|
+
env.meta = env.meta || {};
|
|
21246
|
+
env.meta.script = env.meta.script || [];
|
|
21247
|
+
env.meta.script.push(runtime.script);
|
|
21248
|
+
env.meta.style = env.meta.style || [];
|
|
21249
|
+
env.meta.style.push(runtime.style);
|
|
21250
|
+
if (bundle) {
|
|
21251
|
+
copyRuntime({ runtime, output }, env.bundled);
|
|
21252
|
+
}
|
|
21253
|
+
}
|
|
21254
|
+
});
|
|
21255
|
+
};
|
|
21256
|
+
function transform(options = {}) {
|
|
21257
|
+
const { bundle = true } = options;
|
|
21258
|
+
if (bundle && typeof options.runtime === "string") {
|
|
21259
|
+
throw new TypeError("Option `runtime` should be record when `bundle` is enabled.");
|
|
21260
|
+
}
|
|
21261
|
+
const directiveSyntax = options.directiveSyntax || "disabled";
|
|
21262
|
+
const runtime = typeof options.runtime === "string" ? { script: options.runtime, style: options.runtime } : options.runtime || {
|
|
21263
|
+
script: "_assets/cut-extension.js",
|
|
21264
|
+
style: "_assets/cut-extension.css"
|
|
21265
|
+
};
|
|
21266
|
+
const plugin = function(md, { output = "." } = {}) {
|
|
21267
|
+
registerTransform(md, {
|
|
21268
|
+
directiveSyntax,
|
|
21269
|
+
runtime,
|
|
21270
|
+
bundle,
|
|
21271
|
+
output
|
|
21272
|
+
});
|
|
21273
|
+
};
|
|
21274
|
+
Object.assign(plugin, {
|
|
21275
|
+
collect(input, { destRoot = "." }) {
|
|
21276
|
+
const MdIt = dynrequire("markdown-it");
|
|
21277
|
+
const md = new MdIt().use((md2) => {
|
|
21278
|
+
registerTransform(md2, {
|
|
21279
|
+
directiveSyntax,
|
|
21280
|
+
runtime,
|
|
21281
|
+
bundle,
|
|
21282
|
+
output: destRoot
|
|
21283
|
+
});
|
|
21284
|
+
});
|
|
21285
|
+
md.parse(input, {});
|
|
21286
|
+
}
|
|
21287
|
+
});
|
|
21288
|
+
return plugin;
|
|
21289
|
+
}
|
|
21290
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21291
|
+
0 && 0;
|
|
21292
|
+
//# sourceMappingURL=index.js.map
|
|
21293
|
+
|
|
21294
|
+
|
|
21295
21295
|
}),
|
|
21296
21296
|
87910: (function (module) {
|
|
21297
21297
|
"use strict";
|