@mintlify/cli 4.0.1776 → 4.0.1777
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/bin/vendor/converter.js +247 -230
- package/package.json +3 -3
package/bin/vendor/converter.js
CHANGED
|
@@ -6608,19 +6608,19 @@ var serializeDatabaseSql = (sql) => {
|
|
|
6608
6608
|
return `${DATABASE_SQL_ATTR}='${sql}'`;
|
|
6609
6609
|
}
|
|
6610
6610
|
const body = sql.replace(TEMPLATE_UNSAFE, (match) => {
|
|
6611
|
-
var
|
|
6612
|
-
return (
|
|
6611
|
+
var _a2;
|
|
6612
|
+
return (_a2 = TEMPLATE_ESCAPES[match]) !== null && _a2 !== void 0 ? _a2 : match;
|
|
6613
6613
|
});
|
|
6614
6614
|
return `${DATABASE_SQL_ATTR}={\`${body}\`}`;
|
|
6615
6615
|
};
|
|
6616
6616
|
var isSqlAttribute = (attribute) => attribute.type === "mdxJsxAttribute" && attribute.name === DATABASE_SQL_ATTR;
|
|
6617
6617
|
var attributeString = (attribute) => {
|
|
6618
|
-
var
|
|
6618
|
+
var _a2, _b, _c;
|
|
6619
6619
|
var _d;
|
|
6620
6620
|
const { value } = attribute;
|
|
6621
6621
|
if (typeof value === "string")
|
|
6622
6622
|
return value;
|
|
6623
|
-
const statement = (_b = (
|
|
6623
|
+
const statement = (_b = (_a2 = value === null || value === void 0 ? void 0 : value.data) === null || _a2 === void 0 ? void 0 : _a2.estree) === null || _b === void 0 ? void 0 : _b.body[0];
|
|
6624
6624
|
if ((statement === null || statement === void 0 ? void 0 : statement.type) !== "ExpressionStatement")
|
|
6625
6625
|
return null;
|
|
6626
6626
|
const { expression } = statement;
|
|
@@ -6632,14 +6632,14 @@ var attributeString = (attribute) => {
|
|
|
6632
6632
|
return (_d = (_c = expression.quasis[0]) === null || _c === void 0 ? void 0 : _c.value.cooked) !== null && _d !== void 0 ? _d : null;
|
|
6633
6633
|
};
|
|
6634
6634
|
var readDatabaseSql = (attributes) => {
|
|
6635
|
-
var
|
|
6635
|
+
var _a2;
|
|
6636
6636
|
const matches = attributes.filter(isSqlAttribute);
|
|
6637
6637
|
const [attribute] = matches;
|
|
6638
6638
|
if (!attribute)
|
|
6639
6639
|
return null;
|
|
6640
6640
|
if (matches.length > 1)
|
|
6641
6641
|
return INVALID_DATABASE_SQL;
|
|
6642
|
-
return (
|
|
6642
|
+
return (_a2 = attributeString(attribute)) !== null && _a2 !== void 0 ? _a2 : INVALID_DATABASE_SQL;
|
|
6643
6643
|
};
|
|
6644
6644
|
var withoutDatabaseSql = (attributes) => attributes.filter((attribute) => !isSqlAttribute(attribute));
|
|
6645
6645
|
|
|
@@ -6681,7 +6681,7 @@ function parseFrontmatterYaml(value) {
|
|
|
6681
6681
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
6682
6682
|
return parsed;
|
|
6683
6683
|
}
|
|
6684
|
-
} catch (
|
|
6684
|
+
} catch (_a2) {
|
|
6685
6685
|
}
|
|
6686
6686
|
return {};
|
|
6687
6687
|
}
|
|
@@ -6752,8 +6752,8 @@ function getMarks(node) {
|
|
|
6752
6752
|
return marks2;
|
|
6753
6753
|
}
|
|
6754
6754
|
function isInlineNode(node, schema) {
|
|
6755
|
-
var
|
|
6756
|
-
return ((
|
|
6755
|
+
var _a2;
|
|
6756
|
+
return ((_a2 = schema.nodes[node.type]) === null || _a2 === void 0 ? void 0 : _a2.isInline) === true;
|
|
6757
6757
|
}
|
|
6758
6758
|
function normalizeBlockContent(nodes2, schema) {
|
|
6759
6759
|
const normalized = [];
|
|
@@ -6787,7 +6787,7 @@ import { Node as Node3 } from "prosemirror-model";
|
|
|
6787
6787
|
import { visit as visit3 } from "unist-util-visit";
|
|
6788
6788
|
|
|
6789
6789
|
// ../editor/dist/converter/parse/mdx-to-mdast.js
|
|
6790
|
-
import { preprocessCustomHeadingIds, unwrapCurrencyMath } from "@mintlify/common";
|
|
6790
|
+
import { isMdxJsxElement, preprocessCustomHeadingIds, unwrapCurrencyMath } from "@mintlify/common";
|
|
6791
6791
|
import { remark } from "remark";
|
|
6792
6792
|
import remarkFrontmatter from "remark-frontmatter";
|
|
6793
6793
|
import remarkGfm from "remark-gfm";
|
|
@@ -11822,12 +11822,12 @@ function createExpressionParser(source) {
|
|
|
11822
11822
|
let previousOptions = "";
|
|
11823
11823
|
return {
|
|
11824
11824
|
parse(input, options = {}) {
|
|
11825
|
-
var
|
|
11826
|
-
return JavaScriptParser.parse(input, Object.assign(Object.assign({}, options), { ecmaVersion: (
|
|
11825
|
+
var _a2;
|
|
11826
|
+
return JavaScriptParser.parse(input, Object.assign(Object.assign({}, options), { ecmaVersion: (_a2 = options.ecmaVersion) !== null && _a2 !== void 0 ? _a2 : "latest" }));
|
|
11827
11827
|
},
|
|
11828
11828
|
parseExpressionAt(input, offset2, inputOptions = {}) {
|
|
11829
|
-
var
|
|
11830
|
-
const options = Object.assign(Object.assign({}, inputOptions), { ecmaVersion: (
|
|
11829
|
+
var _a2;
|
|
11830
|
+
const options = Object.assign(Object.assign({}, inputOptions), { ecmaVersion: (_a2 = inputOptions.ecmaVersion) !== null && _a2 !== void 0 ? _a2 : "latest" });
|
|
11831
11831
|
const currentOptions = JSON.stringify(Object.assign(Object.assign({}, options), { onComment: void 0, onToken: void 0 }));
|
|
11832
11832
|
if (currentOptions !== previousOptions) {
|
|
11833
11833
|
incompleteGroup = "";
|
|
@@ -11882,33 +11882,29 @@ function convertHtmlCommentsToJsx(mdx) {
|
|
|
11882
11882
|
return parts.map((part, i) => i % 2 === 0 ? part.replace(/<!--([\s\S]*?)-->/g, (_m, c) => `{/* ${c} */}`) : part).join("");
|
|
11883
11883
|
}
|
|
11884
11884
|
function preprocessMdxSource(mdx, options = {}) {
|
|
11885
|
-
var
|
|
11886
|
-
const sanitized = ((
|
|
11885
|
+
var _a2;
|
|
11886
|
+
const sanitized = ((_a2 = options.omitHtmlComments) !== null && _a2 !== void 0 ? _a2 : true) ? convertHtmlCommentsToJsx(mdx) : mdx;
|
|
11887
11887
|
return {
|
|
11888
11888
|
sanitized,
|
|
11889
11889
|
preprocessed: preprocessCustomHeadingIds(sanitized, { preserveOriginal: true })
|
|
11890
11890
|
};
|
|
11891
11891
|
}
|
|
11892
|
-
var
|
|
11893
|
-
|
|
11894
|
-
function markClosedVideos(root, text) {
|
|
11892
|
+
var recordsClosingTag = (node) => node.children.length === 0 || node.name === "video";
|
|
11893
|
+
function markClosingTags(root, text) {
|
|
11895
11894
|
visit(root, (node) => {
|
|
11896
|
-
var
|
|
11897
|
-
if (!
|
|
11895
|
+
var _a2;
|
|
11896
|
+
if (!isMdxJsxElement(node) || !recordsClosingTag(node))
|
|
11898
11897
|
return;
|
|
11899
|
-
const
|
|
11900
|
-
|
|
11901
|
-
if (start === void 0 || end === void 0)
|
|
11898
|
+
const end = (_a2 = node.position) === null || _a2 === void 0 ? void 0 : _a2.end.offset;
|
|
11899
|
+
if (end === void 0 || text.endsWith("/>", end))
|
|
11902
11900
|
return;
|
|
11903
|
-
|
|
11904
|
-
node.data = Object.assign(Object.assign({}, node.data), { closingTag: true });
|
|
11905
|
-
}
|
|
11901
|
+
node.data = Object.assign(Object.assign({}, node.data), { closingTag: true });
|
|
11906
11902
|
});
|
|
11907
11903
|
}
|
|
11908
11904
|
function parsePreprocessedMdx(preprocessed, math = true) {
|
|
11909
11905
|
const options = { acorn: createExpressionParser(preprocessed) };
|
|
11910
11906
|
const root = (math ? mathRemark : coreRemark)().use(remarkMdx, options).parse(preprocessed);
|
|
11911
|
-
|
|
11907
|
+
markClosingTags(root, preprocessed);
|
|
11912
11908
|
if (math)
|
|
11913
11909
|
unwrapCurrencyMath(root, preprocessed);
|
|
11914
11910
|
return root;
|
|
@@ -11925,7 +11921,7 @@ var NAMED_EXPRESSION_ATTRS_KEY = "__namedExpressionAttributes";
|
|
|
11925
11921
|
var EXTRA_ATTRS_KEY = "__mintlifyExtraAttrs";
|
|
11926
11922
|
var UNSUPPORTED_ESTREE = Symbol("unsupported-estree");
|
|
11927
11923
|
function convertEstreeLiteral(node, staticOnly) {
|
|
11928
|
-
var
|
|
11924
|
+
var _a2;
|
|
11929
11925
|
var _b;
|
|
11930
11926
|
if (!node)
|
|
11931
11927
|
return UNSUPPORTED_ESTREE;
|
|
@@ -11934,7 +11930,7 @@ function convertEstreeLiteral(node, staticOnly) {
|
|
|
11934
11930
|
return node.value;
|
|
11935
11931
|
case "TemplateLiteral":
|
|
11936
11932
|
if (node.expressions.length === 0) {
|
|
11937
|
-
return (_b = (
|
|
11933
|
+
return (_b = (_a2 = node.quasis[0]) === null || _a2 === void 0 ? void 0 : _a2.value.cooked) !== null && _b !== void 0 ? _b : "";
|
|
11938
11934
|
}
|
|
11939
11935
|
return UNSUPPORTED_ESTREE;
|
|
11940
11936
|
case "Identifier":
|
|
@@ -12006,7 +12002,7 @@ function parseOrderedListStart(attributes = []) {
|
|
|
12006
12002
|
return 1;
|
|
12007
12003
|
}
|
|
12008
12004
|
function parseMdxAttributes(attributes = [], options = {}) {
|
|
12009
|
-
var
|
|
12005
|
+
var _a2;
|
|
12010
12006
|
var _b, _c;
|
|
12011
12007
|
const parsed = {};
|
|
12012
12008
|
const expressionAttrs = [];
|
|
@@ -12021,7 +12017,7 @@ function parseMdxAttributes(attributes = [], options = {}) {
|
|
|
12021
12017
|
const raw = value.value;
|
|
12022
12018
|
if (typeof raw === "string") {
|
|
12023
12019
|
namedExpressionAttrs[attr.name] = raw;
|
|
12024
|
-
parsed[attr.name] = parseExpressionValue(raw, "data" in value ? (_b = (
|
|
12020
|
+
parsed[attr.name] = parseExpressionValue(raw, "data" in value ? (_b = (_a2 = value.data) === null || _a2 === void 0 ? void 0 : _a2.estree) !== null && _b !== void 0 ? _b : void 0 : void 0, (_c = options.staticOnly) !== null && _c !== void 0 ? _c : false);
|
|
12025
12021
|
} else {
|
|
12026
12022
|
parsed[attr.name] = raw;
|
|
12027
12023
|
}
|
|
@@ -12045,7 +12041,7 @@ function parseExpressionAttribute(raw) {
|
|
|
12045
12041
|
if ((node === null || node === void 0 ? void 0 : node.type) !== "mdxJsxFlowElement" || node.attributes.length !== 1)
|
|
12046
12042
|
return raw;
|
|
12047
12043
|
return parseMdxAttributes(node.attributes).value;
|
|
12048
|
-
} catch (
|
|
12044
|
+
} catch (_a2) {
|
|
12049
12045
|
return raw;
|
|
12050
12046
|
}
|
|
12051
12047
|
}
|
|
@@ -12094,10 +12090,10 @@ import { parseTitleMarkdown } from "@mintlify/common/title-markdown";
|
|
|
12094
12090
|
// ../editor/dist/converter/parse/handlers/callout.js
|
|
12095
12091
|
var CALLOUT_NON_TYPE_ATTRS = CALLOUT_ATTRS.filter((d) => d.name !== "type");
|
|
12096
12092
|
function canonicalCalloutType(value) {
|
|
12097
|
-
var
|
|
12093
|
+
var _a2;
|
|
12098
12094
|
if (typeof value !== "string")
|
|
12099
12095
|
return null;
|
|
12100
|
-
return (
|
|
12096
|
+
return (_a2 = CALLOUT_TYPES.find((t) => t.toLowerCase() === value.toLowerCase())) !== null && _a2 !== void 0 ? _a2 : null;
|
|
12101
12097
|
}
|
|
12102
12098
|
function parseCalloutAttrs(name, parsed) {
|
|
12103
12099
|
if (name !== "Callout") {
|
|
@@ -12156,7 +12152,7 @@ function isVideoSourceElement(child) {
|
|
|
12156
12152
|
return (child.type === "mdxJsxTextElement" || child.type === "mdxJsxFlowElement") && child.name === "source";
|
|
12157
12153
|
}
|
|
12158
12154
|
function parseVideoNode(node) {
|
|
12159
|
-
var
|
|
12155
|
+
var _a2;
|
|
12160
12156
|
const editable = node.children.every((child) => isVideoSourceElement(child) || child.type === "text" && child.value.trim() === "");
|
|
12161
12157
|
if (!editable) {
|
|
12162
12158
|
return {
|
|
@@ -12169,7 +12165,7 @@ function parseVideoNode(node) {
|
|
|
12169
12165
|
return {
|
|
12170
12166
|
type: BLOCK_TYPES.video,
|
|
12171
12167
|
attrs: {
|
|
12172
|
-
videoAttributes: ((
|
|
12168
|
+
videoAttributes: ((_a2 = node.data) === null || _a2 === void 0 ? void 0 : _a2.closingTag) === true ? Object.assign(Object.assign({}, videoAttributes), { [CLOSING_TAG_KEY]: true }) : videoAttributes,
|
|
12173
12169
|
sources: sources.length > 0 ? sources : null
|
|
12174
12170
|
}
|
|
12175
12171
|
};
|
|
@@ -12177,13 +12173,13 @@ function parseVideoNode(node) {
|
|
|
12177
12173
|
var DARK_ONLY_CLASSES = /* @__PURE__ */ new Set(["hidden", "dark:block"]);
|
|
12178
12174
|
var LIGHT_ONLY_CLASSES = /* @__PURE__ */ new Set(["dark:hidden"]);
|
|
12179
12175
|
function readImageAttributes(node) {
|
|
12180
|
-
var
|
|
12181
|
-
const attributes = (
|
|
12176
|
+
var _a2;
|
|
12177
|
+
const attributes = (_a2 = node.attrs) === null || _a2 === void 0 ? void 0 : _a2.imgAttributes;
|
|
12182
12178
|
return isAttributeRecord(attributes) ? attributes : null;
|
|
12183
12179
|
}
|
|
12184
12180
|
function getImageClassName(node) {
|
|
12185
|
-
var
|
|
12186
|
-
const className = (
|
|
12181
|
+
var _a2;
|
|
12182
|
+
const className = (_a2 = readImageAttributes(node)) === null || _a2 === void 0 ? void 0 : _a2.className;
|
|
12187
12183
|
return typeof className === "string" ? className : void 0;
|
|
12188
12184
|
}
|
|
12189
12185
|
function isDarkOnlyImage(node) {
|
|
@@ -12225,7 +12221,7 @@ function canMergeAsThemePair(lightImgAttrs, darkImgAttrs, lightClassName, darkCl
|
|
|
12225
12221
|
return lightEntries.length === darkEntries.length && JSON.stringify(lightEntries) === JSON.stringify(darkEntries);
|
|
12226
12222
|
}
|
|
12227
12223
|
function mergeDarkLightImagePairs(nodes2) {
|
|
12228
|
-
var
|
|
12224
|
+
var _a2, _b, _c, _d;
|
|
12229
12225
|
var _e, _f;
|
|
12230
12226
|
const result = [];
|
|
12231
12227
|
let i = 0;
|
|
@@ -12261,7 +12257,7 @@ function mergeDarkLightImagePairs(nodes2) {
|
|
|
12261
12257
|
imgAttributes: mergedImgAttrs,
|
|
12262
12258
|
lightSrc,
|
|
12263
12259
|
darkSrc,
|
|
12264
|
-
align: (_e = (
|
|
12260
|
+
align: (_e = (_a2 = lightNode.attrs) === null || _a2 === void 0 ? void 0 : _a2.align) !== null && _e !== void 0 ? _e : (_b = darkNode.attrs) === null || _b === void 0 ? void 0 : _b.align,
|
|
12265
12261
|
width: (_f = (_c = lightNode.attrs) === null || _c === void 0 ? void 0 : _c.width) !== null && _f !== void 0 ? _f : (_d = darkNode.attrs) === null || _d === void 0 ? void 0 : _d.width
|
|
12266
12262
|
}
|
|
12267
12263
|
});
|
|
@@ -12276,7 +12272,7 @@ function mergeDarkLightImagePairs(nodes2) {
|
|
|
12276
12272
|
return result;
|
|
12277
12273
|
}
|
|
12278
12274
|
function convertToInlineImage(node) {
|
|
12279
|
-
var
|
|
12275
|
+
var _a2, _b;
|
|
12280
12276
|
if (!node)
|
|
12281
12277
|
return null;
|
|
12282
12278
|
if (node.type === "image") {
|
|
@@ -12285,7 +12281,7 @@ function convertToInlineImage(node) {
|
|
|
12285
12281
|
attrs: {
|
|
12286
12282
|
imgAttributes: {
|
|
12287
12283
|
src: node.url,
|
|
12288
|
-
alt: (
|
|
12284
|
+
alt: (_a2 = node.alt) !== null && _a2 !== void 0 ? _a2 : void 0,
|
|
12289
12285
|
title: (_b = node.title) !== null && _b !== void 0 ? _b : void 0
|
|
12290
12286
|
},
|
|
12291
12287
|
width: 100
|
|
@@ -12313,11 +12309,11 @@ function convertToInlineImage(node) {
|
|
|
12313
12309
|
// ../editor/dist/converter/parse/handlers/prompt.js
|
|
12314
12310
|
import { SKIP, visit as visit2 } from "unist-util-visit";
|
|
12315
12311
|
function handlePrompt(node, ctx, transformNode2) {
|
|
12316
|
-
var
|
|
12312
|
+
var _a2;
|
|
12317
12313
|
const icon = readPromptAttr(node, "icon");
|
|
12318
12314
|
const iconType = readPromptAttr(node, "iconType");
|
|
12319
12315
|
const actions = readPromptActions(node);
|
|
12320
|
-
const description = (
|
|
12316
|
+
const description = (_a2 = readPromptAttr(node, "description")) !== null && _a2 !== void 0 ? _a2 : "";
|
|
12321
12317
|
let descriptionContent = [{ type: "paragraph" }];
|
|
12322
12318
|
if (description) {
|
|
12323
12319
|
try {
|
|
@@ -12380,8 +12376,8 @@ function readPromptActions(node) {
|
|
|
12380
12376
|
}
|
|
12381
12377
|
function stripAutolinks(tree) {
|
|
12382
12378
|
visit2(tree, "link", (node, index, parent) => {
|
|
12383
|
-
var
|
|
12384
|
-
if (parent && typeof index === "number" && node.children.length === 1 && ((
|
|
12379
|
+
var _a2;
|
|
12380
|
+
if (parent && typeof index === "number" && node.children.length === 1 && ((_a2 = node.children[0]) === null || _a2 === void 0 ? void 0 : _a2.type) === "text" && node.children[0].value === node.url) {
|
|
12385
12381
|
parent.children[index] = { type: "text", value: node.url };
|
|
12386
12382
|
return SKIP;
|
|
12387
12383
|
}
|
|
@@ -12389,7 +12385,7 @@ function stripAutolinks(tree) {
|
|
|
12389
12385
|
});
|
|
12390
12386
|
}
|
|
12391
12387
|
function extractPromptRawChildren(node, source) {
|
|
12392
|
-
var
|
|
12388
|
+
var _a2, _b;
|
|
12393
12389
|
if (!node.position || !source)
|
|
12394
12390
|
return "";
|
|
12395
12391
|
const startOffset = node.position.start.offset;
|
|
@@ -12405,7 +12401,7 @@ function extractPromptRawChildren(node, source) {
|
|
|
12405
12401
|
let inString = false;
|
|
12406
12402
|
let inTemplateLiteral = false;
|
|
12407
12403
|
for (let i = 1; i < nodeSource.length; i++) {
|
|
12408
|
-
const ch = (
|
|
12404
|
+
const ch = (_a2 = nodeSource[i]) !== null && _a2 !== void 0 ? _a2 : "";
|
|
12409
12405
|
const prev = (_b = nodeSource[i - 1]) !== null && _b !== void 0 ? _b : "";
|
|
12410
12406
|
if (inTemplateLiteral) {
|
|
12411
12407
|
if (ch === "`" && prev !== "\\")
|
|
@@ -12466,8 +12462,8 @@ var BLOCK_TYPE_KNOWN_ATTRS = {
|
|
|
12466
12462
|
[BLOCK_TYPES.visibility]: VISIBILITY_ATTRS
|
|
12467
12463
|
};
|
|
12468
12464
|
function partitionForBlockType(parsed, blockType) {
|
|
12469
|
-
var
|
|
12470
|
-
return partitionAttrs(parsed, (
|
|
12465
|
+
var _a2;
|
|
12466
|
+
return partitionAttrs(parsed, (_a2 = BLOCK_TYPE_KNOWN_ATTRS[blockType]) !== null && _a2 !== void 0 ? _a2 : []);
|
|
12471
12467
|
}
|
|
12472
12468
|
var STRUCTURED_FLOW_COMPONENTS = /* @__PURE__ */ new Map([
|
|
12473
12469
|
[BLOCK_TYPES.callout, true],
|
|
@@ -12491,9 +12487,9 @@ var STRUCTURED_FLOW_COMPONENTS = /* @__PURE__ */ new Map([
|
|
|
12491
12487
|
[BLOCK_TYPES.tabs, false]
|
|
12492
12488
|
]);
|
|
12493
12489
|
function isContainerOnlyComponent(name, schema) {
|
|
12494
|
-
var
|
|
12490
|
+
var _a2;
|
|
12495
12491
|
const type = schema.nodes[name];
|
|
12496
|
-
return !!type && !type.isInline && !((
|
|
12492
|
+
return !!type && !type.isInline && !((_a2 = type.spec.group) !== null && _a2 !== void 0 ? _a2 : "").split(" ").includes("block");
|
|
12497
12493
|
}
|
|
12498
12494
|
var withRequiredContent = (nodeType, content) => STRUCTURED_FLOW_COMPONENTS.get(nodeType) && content.length === 0 ? [{ type: "paragraph" }] : content;
|
|
12499
12495
|
function handleFlowJsx(node, ctx, transformNode2, mapJsxChildren2) {
|
|
@@ -12501,12 +12497,12 @@ function handleFlowJsx(node, ctx, transformNode2, mapJsxChildren2) {
|
|
|
12501
12497
|
return [];
|
|
12502
12498
|
try {
|
|
12503
12499
|
return handleFlowJsxInner(node, ctx, transformNode2, mapJsxChildren2);
|
|
12504
|
-
} catch (
|
|
12500
|
+
} catch (_a2) {
|
|
12505
12501
|
return [];
|
|
12506
12502
|
}
|
|
12507
12503
|
}
|
|
12508
12504
|
function handleFlowJsxInner(node, ctx, transformNode2, mapJsxChildren2) {
|
|
12509
|
-
var
|
|
12505
|
+
var _a2, _b;
|
|
12510
12506
|
if (!node.name)
|
|
12511
12507
|
return [];
|
|
12512
12508
|
if (/^h[1-6]$/.test(node.name)) {
|
|
@@ -12514,7 +12510,7 @@ function handleFlowJsxInner(node, ctx, transformNode2, mapJsxChildren2) {
|
|
|
12514
12510
|
const attrKeys = Object.keys(attrs2);
|
|
12515
12511
|
const hasOnlyId = attrKeys.length === 1 && attrKeys[0] === "id";
|
|
12516
12512
|
if (hasOnlyId) {
|
|
12517
|
-
const level = parseInt((
|
|
12513
|
+
const level = parseInt((_a2 = node.name[1]) !== null && _a2 !== void 0 ? _a2 : "1", 10);
|
|
12518
12514
|
const inlineChildren = node.children.flatMap((child) => child.type === "paragraph" ? child.children : [child]);
|
|
12519
12515
|
return {
|
|
12520
12516
|
type: "heading",
|
|
@@ -12705,7 +12701,7 @@ function handleCard(node, ctx, transformNode2, mapJsxChildren2) {
|
|
|
12705
12701
|
};
|
|
12706
12702
|
}
|
|
12707
12703
|
function handleToggleContent(node, ctx, transformNode2, mapJsxChildren2) {
|
|
12708
|
-
var
|
|
12704
|
+
var _a2, _b, _c, _d, _e;
|
|
12709
12705
|
const toggleContent = {
|
|
12710
12706
|
[BLOCK_TYPES.tabs]: BLOCK_TYPES.tab,
|
|
12711
12707
|
[BLOCK_TYPES.codeGroup]: BLOCK_TYPES.codeBlock,
|
|
@@ -12716,12 +12712,12 @@ function handleToggleContent(node, ctx, transformNode2, mapJsxChildren2) {
|
|
|
12716
12712
|
const partitionWrapper = (parsed) => node.name === BLOCK_TYPES.tabs ? partitionAttrs(parsed, TABS_ATTRS) : partitionAttrs(parsed, []);
|
|
12717
12713
|
if (codeChildren.length > 0) {
|
|
12718
12714
|
return {
|
|
12719
|
-
type: (
|
|
12715
|
+
type: (_a2 = node.name) !== null && _a2 !== void 0 ? _a2 : BLOCK_TYPES.codeGroup,
|
|
12720
12716
|
attrs: Object.assign(Object.assign({}, partitionWrapper(parseMdxAttributes(node.attributes))), ctx.hasGroupParent && { __hasGroupParent: true }),
|
|
12721
12717
|
content: codeChildren.map((child, index) => {
|
|
12722
|
-
var
|
|
12718
|
+
var _a3;
|
|
12723
12719
|
const result = transformNode2(child, Object.assign(Object.assign({}, ctx), { hasGroupParent: true, isHidden: index !== 0 }));
|
|
12724
|
-
return Array.isArray(result) ? (
|
|
12720
|
+
return Array.isArray(result) ? (_a3 = result[0]) !== null && _a3 !== void 0 ? _a3 : { type: "paragraph" } : result;
|
|
12725
12721
|
})
|
|
12726
12722
|
};
|
|
12727
12723
|
}
|
|
@@ -12756,8 +12752,8 @@ function handleToggleContent(node, ctx, transformNode2, mapJsxChildren2) {
|
|
|
12756
12752
|
function handleColumns(node, ctx, mapJsxChildren2) {
|
|
12757
12753
|
const attrs2 = partitionAttrs(parseMdxAttributes(node.attributes), COLUMNS_ATTRS);
|
|
12758
12754
|
const content = mapJsxChildren2(node, Object.assign(Object.assign({}, ctx), { hasGroupParent: true })).map((child) => {
|
|
12759
|
-
var
|
|
12760
|
-
return child.type === BLOCK_TYPES.column ? Object.assign(Object.assign({}, child), { content: withRequiredContent(BLOCK_TYPES.column, (
|
|
12755
|
+
var _a2;
|
|
12756
|
+
return child.type === BLOCK_TYPES.column ? Object.assign(Object.assign({}, child), { content: withRequiredContent(BLOCK_TYPES.column, (_a2 = child.content) !== null && _a2 !== void 0 ? _a2 : []) }) : child;
|
|
12761
12757
|
});
|
|
12762
12758
|
return {
|
|
12763
12759
|
type: BLOCK_TYPES.columns,
|
|
@@ -12830,10 +12826,10 @@ function handleTree(node) {
|
|
|
12830
12826
|
}
|
|
12831
12827
|
var DATABASE_VIEW_PROPS = ["view", "sort", "filter", "groupBy"];
|
|
12832
12828
|
function handleDatabase(node, ctx) {
|
|
12833
|
-
var
|
|
12829
|
+
var _a2;
|
|
12834
12830
|
const sql = readDatabaseSql(node.attributes);
|
|
12835
12831
|
const parsed = parseMdxAttributes(withoutDatabaseSql(node.attributes));
|
|
12836
|
-
const isValid = ctx.databases === true && sql !== INVALID_DATABASE_SQL && !!((
|
|
12832
|
+
const isValid = ctx.databases === true && sql !== INVALID_DATABASE_SQL && !!((_a2 = ctx.schema) !== null && _a2 !== void 0 ? _a2 : mintlifySchema).nodes[BLOCK_TYPES.database] && node.children.length === 0 && !(EXPRESSION_ATTRS_KEY in parsed) && !(NAMED_EXPRESSION_ATTRS_KEY in parsed) && isDatabaseId(parsed.id) && DATABASE_VIEW_PROPS.every((key) => parsed[key] === void 0 || typeof parsed[key] === "string");
|
|
12837
12833
|
if (!isValid)
|
|
12838
12834
|
return { type: BLOCK_TYPES.unknownTag, attrs: { mdxJsxNode: node } };
|
|
12839
12835
|
return { type: BLOCK_TYPES.database, attrs: Object.assign(Object.assign({}, partitionAttrs(parsed, DATABASE_ATTRS)), { sql }) };
|
|
@@ -12870,7 +12866,7 @@ function handleHtmlTable(node, ctx, transformNode2, mapJsxChildren2) {
|
|
|
12870
12866
|
return {
|
|
12871
12867
|
type: "tableRow",
|
|
12872
12868
|
content: cells.map((cell, cellIndex) => {
|
|
12873
|
-
var
|
|
12869
|
+
var _a2;
|
|
12874
12870
|
const isHeader = cell.name === "th" || rowIndex === 0;
|
|
12875
12871
|
const colwidth = colWidths[cellIndex];
|
|
12876
12872
|
const attrs2 = parseMdxAttributes(cell.attributes);
|
|
@@ -12880,7 +12876,7 @@ function handleHtmlTable(node, ctx, transformNode2, mapJsxChildren2) {
|
|
|
12880
12876
|
const content = convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2);
|
|
12881
12877
|
return {
|
|
12882
12878
|
type: isHeader ? "tableHeader" : "tableCell",
|
|
12883
|
-
attrs: { align: (
|
|
12879
|
+
attrs: { align: (_a2 = alignMatch === null || alignMatch === void 0 ? void 0 : alignMatch[1]) !== null && _a2 !== void 0 ? _a2 : null, colwidth: colwidth ? [colwidth] : null },
|
|
12884
12880
|
content: content.length > 0 ? content : [{ type: "paragraph" }]
|
|
12885
12881
|
};
|
|
12886
12882
|
})
|
|
@@ -12898,11 +12894,11 @@ function collectJsxElementsNamed(children, name) {
|
|
|
12898
12894
|
return unwrapParagraphs(children).filter((child) => isJsxElementNamed(child, name));
|
|
12899
12895
|
}
|
|
12900
12896
|
function parseColWidth(col) {
|
|
12901
|
-
var
|
|
12897
|
+
var _a2;
|
|
12902
12898
|
var _b;
|
|
12903
12899
|
const attrs2 = parseMdxAttributes(col.attributes);
|
|
12904
12900
|
const style = attrs2.style;
|
|
12905
|
-
const styleWidth = typeof style === "string" ? (
|
|
12901
|
+
const styleWidth = typeof style === "string" ? (_a2 = style.match(/(?:^|;)\s*width:\s*([^;]+)/i)) === null || _a2 === void 0 ? void 0 : _a2[1] : style && typeof style === "object" ? style.width : void 0;
|
|
12906
12902
|
const raw = (_b = attrs2.width) !== null && _b !== void 0 ? _b : styleWidth;
|
|
12907
12903
|
if (typeof raw === "number")
|
|
12908
12904
|
return raw > 0 ? raw : null;
|
|
@@ -12947,7 +12943,7 @@ function isTableCellJsxNode(node) {
|
|
|
12947
12943
|
return (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && (node.name === "td" || node.name === "th");
|
|
12948
12944
|
}
|
|
12949
12945
|
function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2) {
|
|
12950
|
-
var
|
|
12946
|
+
var _a2, _b, _c;
|
|
12951
12947
|
const result = [];
|
|
12952
12948
|
for (const child of cell.children) {
|
|
12953
12949
|
if (child.type !== "mdxJsxFlowElement" && child.type !== "mdxJsxTextElement") {
|
|
@@ -12962,7 +12958,7 @@ function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2
|
|
|
12962
12958
|
continue;
|
|
12963
12959
|
}
|
|
12964
12960
|
if (child.name && /^h[1-6]$/.test(child.name)) {
|
|
12965
|
-
const level = parseInt((
|
|
12961
|
+
const level = parseInt((_a2 = child.name[1]) !== null && _a2 !== void 0 ? _a2 : "1", 10);
|
|
12966
12962
|
const headingAttrs = parseMdxAttributes(child.attributes);
|
|
12967
12963
|
result.push({
|
|
12968
12964
|
type: "heading",
|
|
@@ -12997,8 +12993,8 @@ function convertHtmlTableCellChildren(cell, ctx, transformNode2, mapJsxChildren2
|
|
|
12997
12993
|
function mapTableJsxElementChildren(node, ctx, transformNode2, mapJsxChildren2) {
|
|
12998
12994
|
if (node.type === "mdxJsxFlowElement") {
|
|
12999
12995
|
return mapJsxChildren2(node, ctx).flatMap((child) => {
|
|
13000
|
-
var
|
|
13001
|
-
return child.type === "paragraph" ? (
|
|
12996
|
+
var _a2;
|
|
12997
|
+
return child.type === "paragraph" ? (_a2 = child.content) !== null && _a2 !== void 0 ? _a2 : [] : [child];
|
|
13002
12998
|
});
|
|
13003
12999
|
}
|
|
13004
13000
|
return node.children.flatMap((child) => flattenPmContent(transformNode2(child, ctx)));
|
|
@@ -13006,7 +13002,7 @@ function mapTableJsxElementChildren(node, ctx, transformNode2, mapJsxChildren2)
|
|
|
13006
13002
|
|
|
13007
13003
|
// ../editor/dist/converter/parse/handlers/inline-jsx.js
|
|
13008
13004
|
function handleInlineJsx(node, ctx, mapChildren2) {
|
|
13009
|
-
var
|
|
13005
|
+
var _a2, _b;
|
|
13010
13006
|
if (node.name === "Tooltip") {
|
|
13011
13007
|
const attrs2 = partitionAttrs(parseMdxAttributes(node.attributes), TOOLTIP_ATTRS);
|
|
13012
13008
|
const content = mapChildren2(node, ctx);
|
|
@@ -13065,7 +13061,7 @@ function handleInlineJsx(node, ctx, mapChildren2) {
|
|
|
13065
13061
|
name: node.name,
|
|
13066
13062
|
attributes: parseMdxAttributes(node.attributes)
|
|
13067
13063
|
},
|
|
13068
|
-
content: normalizeBlockContent(mapChildren2(node, ctx), (
|
|
13064
|
+
content: normalizeBlockContent(mapChildren2(node, ctx), (_a2 = ctx.schema) !== null && _a2 !== void 0 ? _a2 : mintlifySchema)
|
|
13069
13065
|
};
|
|
13070
13066
|
}
|
|
13071
13067
|
if (node.name && HTML_ELEMENTS.has(node.name)) {
|
|
@@ -13141,24 +13137,24 @@ var tokenize = (meta) => {
|
|
|
13141
13137
|
return tokens;
|
|
13142
13138
|
};
|
|
13143
13139
|
var stripWrapping = (raw) => {
|
|
13144
|
-
var
|
|
13140
|
+
var _a2;
|
|
13145
13141
|
const braceMatch = raw.match(/^\{(.*)\}$/);
|
|
13146
13142
|
if (braceMatch)
|
|
13147
|
-
return (
|
|
13143
|
+
return (_a2 = braceMatch[1]) !== null && _a2 !== void 0 ? _a2 : "";
|
|
13148
13144
|
return extractValue(raw);
|
|
13149
13145
|
};
|
|
13150
13146
|
var unescapeQuoted = (value) => value.replace(/\\(["'\\])/g, "$1");
|
|
13151
13147
|
var extractValue = (raw) => {
|
|
13152
|
-
var
|
|
13148
|
+
var _a2;
|
|
13153
13149
|
const match = raw.match(/^(['"])(.*)\1$/);
|
|
13154
13150
|
if (match)
|
|
13155
|
-
return unescapeQuoted((
|
|
13151
|
+
return unescapeQuoted((_a2 = match[2]) !== null && _a2 !== void 0 ? _a2 : "");
|
|
13156
13152
|
if (raw.startsWith('"') || raw.startsWith("'"))
|
|
13157
13153
|
return raw.slice(1);
|
|
13158
13154
|
return raw;
|
|
13159
13155
|
};
|
|
13160
13156
|
var parseMetaString = (meta) => {
|
|
13161
|
-
var
|
|
13157
|
+
var _a2, _b, _c, _d, _e;
|
|
13162
13158
|
if (!meta)
|
|
13163
13159
|
return {};
|
|
13164
13160
|
const result = {};
|
|
@@ -13167,7 +13163,7 @@ var parseMetaString = (meta) => {
|
|
|
13167
13163
|
for (const token of tokens) {
|
|
13168
13164
|
const highlightMatch = token.match(/^highlight=(.+)$/);
|
|
13169
13165
|
if (highlightMatch) {
|
|
13170
|
-
const val = stripWrapping((
|
|
13166
|
+
const val = stripWrapping((_a2 = highlightMatch[1]) !== null && _a2 !== void 0 ? _a2 : "");
|
|
13171
13167
|
if (val)
|
|
13172
13168
|
result.highlight = val;
|
|
13173
13169
|
continue;
|
|
@@ -13212,13 +13208,13 @@ var parseMetaString = (meta) => {
|
|
|
13212
13208
|
return result;
|
|
13213
13209
|
};
|
|
13214
13210
|
function extractDiffMarkers(code) {
|
|
13215
|
-
var
|
|
13211
|
+
var _a2, _b, _c;
|
|
13216
13212
|
const lines = code.split("\n");
|
|
13217
13213
|
const addLines = [];
|
|
13218
13214
|
const removeLines = [];
|
|
13219
13215
|
const cleanedLines = [];
|
|
13220
13216
|
for (let i = 0; i < lines.length; i++) {
|
|
13221
|
-
const line = (
|
|
13217
|
+
const line = (_a2 = lines[i]) !== null && _a2 !== void 0 ? _a2 : "";
|
|
13222
13218
|
const addMatch = line.match(/^(.*?)\s*(?:\/\/|\/\*|#|--|<!--)\s*\[!code \+\+\]\s*(?:\*\/|-->)?\s*$/);
|
|
13223
13219
|
const removeMatch = line.match(/^(.*?)\s*(?:\/\/|\/\*|#|--|<!--)\s*\[!code --\]\s*(?:\*\/|-->)?\s*$/);
|
|
13224
13220
|
if (addMatch) {
|
|
@@ -13238,7 +13234,7 @@ function extractDiffMarkers(code) {
|
|
|
13238
13234
|
};
|
|
13239
13235
|
}
|
|
13240
13236
|
function parseLineRanges(str) {
|
|
13241
|
-
var
|
|
13237
|
+
var _a2, _b;
|
|
13242
13238
|
if (!str)
|
|
13243
13239
|
return [];
|
|
13244
13240
|
const result = [];
|
|
@@ -13247,7 +13243,7 @@ function parseLineRanges(str) {
|
|
|
13247
13243
|
const trimmed = part.trim();
|
|
13248
13244
|
const rangeMatch = trimmed.match(/^(\d+)-(\d+)$/);
|
|
13249
13245
|
if (rangeMatch) {
|
|
13250
|
-
const start = parseInt((
|
|
13246
|
+
const start = parseInt((_a2 = rangeMatch[1]) !== null && _a2 !== void 0 ? _a2 : "0", 10);
|
|
13251
13247
|
const end = parseInt((_b = rangeMatch[2]) !== null && _b !== void 0 ? _b : "0", 10);
|
|
13252
13248
|
for (let i = start; i <= end; i++) {
|
|
13253
13249
|
result.push(i);
|
|
@@ -13262,12 +13258,12 @@ function parseLineRanges(str) {
|
|
|
13262
13258
|
return result;
|
|
13263
13259
|
}
|
|
13264
13260
|
function formatLineRanges(lines) {
|
|
13265
|
-
var
|
|
13261
|
+
var _a2, _b;
|
|
13266
13262
|
if (lines.length === 0)
|
|
13267
13263
|
return "";
|
|
13268
13264
|
const sorted = [...new Set(lines)].sort((a, b) => a - b);
|
|
13269
13265
|
const ranges = [];
|
|
13270
|
-
let start = (
|
|
13266
|
+
let start = (_a2 = sorted[0]) !== null && _a2 !== void 0 ? _a2 : 0;
|
|
13271
13267
|
let end = start;
|
|
13272
13268
|
for (let i = 1; i < sorted.length; i++) {
|
|
13273
13269
|
const current2 = (_b = sorted[i]) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -13351,7 +13347,7 @@ function buildParagraphFromTableInlineChildren(children, ctx, transformNode2) {
|
|
|
13351
13347
|
};
|
|
13352
13348
|
}
|
|
13353
13349
|
function buildMarkdownTableCellContent(children, ctx, transformNode2) {
|
|
13354
|
-
var
|
|
13350
|
+
var _a2;
|
|
13355
13351
|
const hasBlockJsx = children.some((child) => child.type === "mdxJsxTextElement" && child.name != null && TABLE_BLOCK_JSX_NAMES.has(child.name));
|
|
13356
13352
|
if (hasBlockJsx) {
|
|
13357
13353
|
const cellContent = [];
|
|
@@ -13367,7 +13363,7 @@ function buildMarkdownTableCellContent(children, ctx, transformNode2) {
|
|
|
13367
13363
|
if (child.type === "mdxJsxTextElement" && child.name != null && TABLE_BLOCK_JSX_NAMES.has(child.name)) {
|
|
13368
13364
|
flushInlineChildren();
|
|
13369
13365
|
if (/^h[1-6]$/.test(child.name)) {
|
|
13370
|
-
const level = parseInt((
|
|
13366
|
+
const level = parseInt((_a2 = child.name[1]) !== null && _a2 !== void 0 ? _a2 : "1", 10);
|
|
13371
13367
|
cellContent.push({
|
|
13372
13368
|
type: "heading",
|
|
13373
13369
|
attrs: { level },
|
|
@@ -13408,8 +13404,8 @@ function buildMarkdownTableCellContent(children, ctx, transformNode2) {
|
|
|
13408
13404
|
return children.flatMap((child) => flattenNodeContent(transformNode2(child, ctx)));
|
|
13409
13405
|
}
|
|
13410
13406
|
function handleParagraph(node, ctx, transformNode2, mapChildren2) {
|
|
13411
|
-
var
|
|
13412
|
-
const schema = (
|
|
13407
|
+
var _a2;
|
|
13408
|
+
const schema = (_a2 = ctx.schema) !== null && _a2 !== void 0 ? _a2 : mintlifySchema;
|
|
13413
13409
|
const hasImages = node.children.some((child) => child.type === "image" || child.type === "mdxJsxTextElement" && child.name === "img");
|
|
13414
13410
|
if (hasImages) {
|
|
13415
13411
|
const hasTextContent = node.children.some((child) => child.type === "text" || child.type === "emphasis" || child.type === "strong" || child.type === "link" || child.type === "linkReference" || child.type === "inlineCode" || child.type === "delete" || child.type === "mdxJsxTextElement" && child.name !== "img");
|
|
@@ -13451,17 +13447,17 @@ function handleParagraph(node, ctx, transformNode2, mapChildren2) {
|
|
|
13451
13447
|
}
|
|
13452
13448
|
function splitParagraphAroundBlocks(content, schema) {
|
|
13453
13449
|
return normalizeBlockContent(mergeDarkLightImagePairs(content), schema).map((block) => block.type === "paragraph" ? trimParagraph(block) : block).filter((block) => {
|
|
13454
|
-
var
|
|
13450
|
+
var _a2;
|
|
13455
13451
|
var _b;
|
|
13456
|
-
return block.type !== "paragraph" || ((_b = (
|
|
13452
|
+
return block.type !== "paragraph" || ((_b = (_a2 = block.content) === null || _a2 === void 0 ? void 0 : _a2.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
13457
13453
|
});
|
|
13458
13454
|
}
|
|
13459
13455
|
function trimParagraph(paragraph) {
|
|
13460
|
-
var
|
|
13456
|
+
var _a2, _b;
|
|
13461
13457
|
var _c;
|
|
13462
13458
|
const content = [...(_c = paragraph.content) !== null && _c !== void 0 ? _c : []];
|
|
13463
13459
|
const first = content[0];
|
|
13464
|
-
if ((first === null || first === void 0 ? void 0 : first.type) === "text" && first.text && !((
|
|
13460
|
+
if ((first === null || first === void 0 ? void 0 : first.type) === "text" && first.text && !((_a2 = first.marks) === null || _a2 === void 0 ? void 0 : _a2.some((mark) => mark.type === "code"))) {
|
|
13465
13461
|
content[0] = Object.assign(Object.assign({}, first), { text: first.text.replace(/^\s+/, "") });
|
|
13466
13462
|
}
|
|
13467
13463
|
const lastIndex = content.length - 1;
|
|
@@ -13472,11 +13468,11 @@ function trimParagraph(paragraph) {
|
|
|
13472
13468
|
return Object.assign(Object.assign({}, paragraph), { content: content.filter((n) => n.type !== "text" || n.text !== "") });
|
|
13473
13469
|
}
|
|
13474
13470
|
function handleTable(node, ctx, transformNode2) {
|
|
13475
|
-
var
|
|
13471
|
+
var _a2;
|
|
13476
13472
|
var _b;
|
|
13477
13473
|
const rows = node.children;
|
|
13478
13474
|
const alignments = node.align || [];
|
|
13479
|
-
const columnCount = (_b = (
|
|
13475
|
+
const columnCount = (_b = (_a2 = rows[0]) === null || _a2 === void 0 ? void 0 : _a2.children.length) !== null && _b !== void 0 ? _b : 0;
|
|
13480
13476
|
const tableContent = rows.map((row, rowIndex) => {
|
|
13481
13477
|
const width = row.children.reduce((w, cell, i) => cell.children.length > 0 ? Math.max(w, i + 1) : w, columnCount);
|
|
13482
13478
|
const cells = row.children.slice(0, width);
|
|
@@ -13534,8 +13530,8 @@ function handleCode(node, ctx) {
|
|
|
13534
13530
|
|
|
13535
13531
|
// ../editor/dist/converter/parse/mdast-to-pm.js
|
|
13536
13532
|
function mdastToPm(mdast, source = "", options) {
|
|
13537
|
-
var
|
|
13538
|
-
const schema = (
|
|
13533
|
+
var _a2, _b;
|
|
13534
|
+
const schema = (_a2 = options === null || options === void 0 ? void 0 : options.schema) !== null && _a2 !== void 0 ? _a2 : mintlifySchema;
|
|
13539
13535
|
const frontmatter = extractFrontmatter(mdast);
|
|
13540
13536
|
const definitions = /* @__PURE__ */ new Map();
|
|
13541
13537
|
visit3(mdast, (node) => {
|
|
@@ -13565,7 +13561,7 @@ function mdastToPm(mdast, source = "", options) {
|
|
|
13565
13561
|
return { doc, frontmatter };
|
|
13566
13562
|
}
|
|
13567
13563
|
function transformNode(node, ctx) {
|
|
13568
|
-
var
|
|
13564
|
+
var _a2;
|
|
13569
13565
|
var _b, _c, _d, _e, _f;
|
|
13570
13566
|
if (!node)
|
|
13571
13567
|
return [];
|
|
@@ -13613,7 +13609,7 @@ function transformNode(node, ctx) {
|
|
|
13613
13609
|
return {
|
|
13614
13610
|
type: "listItem",
|
|
13615
13611
|
attrs: { checked: (_c = node.checked) !== null && _c !== void 0 ? _c : null },
|
|
13616
|
-
content: ((
|
|
13612
|
+
content: ((_a2 = content[0]) === null || _a2 === void 0 ? void 0 : _a2.type) === "paragraph" ? content : [{ type: "paragraph", content: [] }, ...content]
|
|
13617
13613
|
};
|
|
13618
13614
|
}
|
|
13619
13615
|
case "table":
|
|
@@ -13765,9 +13761,9 @@ function convertInlineContent(children, parentMarks, ctx) {
|
|
|
13765
13761
|
return results;
|
|
13766
13762
|
}
|
|
13767
13763
|
function getLinkReferenceMark(node, ctx) {
|
|
13768
|
-
var
|
|
13764
|
+
var _a2;
|
|
13769
13765
|
var _b, _c, _d;
|
|
13770
|
-
const definition = (
|
|
13766
|
+
const definition = (_a2 = ctx.definitions) === null || _a2 === void 0 ? void 0 : _a2.get(node.identifier);
|
|
13771
13767
|
if (!definition)
|
|
13772
13768
|
return void 0;
|
|
13773
13769
|
return {
|
|
@@ -13780,27 +13776,27 @@ function getLinkReferenceMark(node, ctx) {
|
|
|
13780
13776
|
};
|
|
13781
13777
|
}
|
|
13782
13778
|
function convertLinkComponent(node, parentMarks, ctx) {
|
|
13783
|
-
var
|
|
13779
|
+
var _a2;
|
|
13784
13780
|
const mark = getLinkComponentMark(node, ctx);
|
|
13785
13781
|
if (!mark)
|
|
13786
13782
|
return void 0;
|
|
13787
13783
|
const content = convertInlineContent(node.children, [...parentMarks, mark], ctx);
|
|
13788
|
-
const schema = (
|
|
13784
|
+
const schema = (_a2 = ctx.schema) !== null && _a2 !== void 0 ? _a2 : mintlifySchema;
|
|
13789
13785
|
const hasSerializableContent = content.every((child) => {
|
|
13790
|
-
var
|
|
13786
|
+
var _a3, _b, _c;
|
|
13791
13787
|
var _d;
|
|
13792
13788
|
if (!isInlineNode(child, schema))
|
|
13793
13789
|
return false;
|
|
13794
13790
|
if (child.type !== "text" && child.type !== BLOCK_TYPES.inlineImage && child.type !== BLOCK_TYPES.inlineUnknownTag) {
|
|
13795
13791
|
return false;
|
|
13796
13792
|
}
|
|
13797
|
-
const linkMarks = (_d = (
|
|
13793
|
+
const linkMarks = (_d = (_a3 = child.marks) === null || _a3 === void 0 ? void 0 : _a3.filter((childMark) => childMark.type === "link")) !== null && _d !== void 0 ? _d : [];
|
|
13798
13794
|
return linkMarks.length === 1 && ((_c = (_b = linkMarks[0]) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.mdxLinkAttributes) !== void 0;
|
|
13799
13795
|
});
|
|
13800
13796
|
return content.length > 0 && hasSerializableContent ? content : void 0;
|
|
13801
13797
|
}
|
|
13802
13798
|
function getLinkComponentMark(node, ctx) {
|
|
13803
|
-
var
|
|
13799
|
+
var _a2;
|
|
13804
13800
|
if (node.name !== "Link")
|
|
13805
13801
|
return void 0;
|
|
13806
13802
|
if (node.attributes.some((attribute) => attribute.type === "mdxJsxExpressionAttribute")) {
|
|
@@ -13810,7 +13806,7 @@ function getLinkComponentMark(node, ctx) {
|
|
|
13810
13806
|
if (!hrefAttribute || typeof hrefAttribute.value !== "string")
|
|
13811
13807
|
return void 0;
|
|
13812
13808
|
const attributes = parseMdxAttributes(node.attributes);
|
|
13813
|
-
const mdxLinkId = (
|
|
13809
|
+
const mdxLinkId = (_a2 = ctx.nextMdxLinkId) !== null && _a2 !== void 0 ? _a2 : 0;
|
|
13814
13810
|
ctx.nextMdxLinkId = mdxLinkId + 1;
|
|
13815
13811
|
return {
|
|
13816
13812
|
type: "link",
|
|
@@ -13827,14 +13823,14 @@ function mapChildren(node, ctx) {
|
|
|
13827
13823
|
return mergeDarkLightImagePairs(nodes2);
|
|
13828
13824
|
}
|
|
13829
13825
|
function mapJsxChildren(node, ctx) {
|
|
13830
|
-
var
|
|
13826
|
+
var _a2;
|
|
13831
13827
|
const nodes2 = flattenJsxParagraphs({ children: node.children }).children.flatMap((child) => {
|
|
13832
13828
|
if (child.type === "mdxJsxFlowElement") {
|
|
13833
13829
|
return handleFlowJsx(child, ctx, transformNode, mapJsxChildren);
|
|
13834
13830
|
}
|
|
13835
13831
|
return transformNode(child, ctx);
|
|
13836
13832
|
}).filter(Boolean);
|
|
13837
|
-
return normalizeBlockContent(mergeDarkLightImagePairs(nodes2), (
|
|
13833
|
+
return normalizeBlockContent(mergeDarkLightImagePairs(nodes2), (_a2 = ctx.schema) !== null && _a2 !== void 0 ? _a2 : mintlifySchema);
|
|
13838
13834
|
}
|
|
13839
13835
|
|
|
13840
13836
|
// ../editor/dist/converter/parse/mdx-to-pm.js
|
|
@@ -13910,7 +13906,7 @@ function expressionsToText(root) {
|
|
|
13910
13906
|
function htmlToMdast(html) {
|
|
13911
13907
|
try {
|
|
13912
13908
|
return mdxToMdast(html.replace(VOID_TAG, "<$1$2 />")).children;
|
|
13913
|
-
} catch (
|
|
13909
|
+
} catch (_a2) {
|
|
13914
13910
|
const text = html.replace(ANY_TAG, "").trim();
|
|
13915
13911
|
return text ? [{ type: "paragraph", children: [{ type: "text", value: text }] }] : [];
|
|
13916
13912
|
}
|
|
@@ -13929,12 +13925,12 @@ function blockHtml(html) {
|
|
|
13929
13925
|
if (parts.length === 1)
|
|
13930
13926
|
return htmlToMdast(html);
|
|
13931
13927
|
return parts.flatMap((part, i) => {
|
|
13932
|
-
var
|
|
13928
|
+
var _a2;
|
|
13933
13929
|
if (i % 2 === 0)
|
|
13934
13930
|
return part.trim() ? markdownToMdast(part).children : [];
|
|
13935
13931
|
const summary = SUMMARY_TAG.exec(part);
|
|
13936
13932
|
if (summary)
|
|
13937
|
-
return [{ summary: ((
|
|
13933
|
+
return [{ summary: ((_a2 = summary[1]) !== null && _a2 !== void 0 ? _a2 : "").replace(ANY_TAG, "").trim() }];
|
|
13938
13934
|
if (part.startsWith("</"))
|
|
13939
13935
|
return [{ close: true }];
|
|
13940
13936
|
return [{ open: /^<aside/i.test(part) ? "aside" : "details" }];
|
|
@@ -13944,9 +13940,9 @@ function groupContainers(items) {
|
|
|
13944
13940
|
const root = [];
|
|
13945
13941
|
const stack = [];
|
|
13946
13942
|
const current2 = () => {
|
|
13947
|
-
var
|
|
13943
|
+
var _a2;
|
|
13948
13944
|
var _b;
|
|
13949
|
-
return (_b = (
|
|
13945
|
+
return (_b = (_a2 = stack.at(-1)) === null || _a2 === void 0 ? void 0 : _a2.children) !== null && _b !== void 0 ? _b : root;
|
|
13950
13946
|
};
|
|
13951
13947
|
const close = () => {
|
|
13952
13948
|
const frame = stack.pop();
|
|
@@ -13973,9 +13969,9 @@ function groupContainers(items) {
|
|
|
13973
13969
|
return root;
|
|
13974
13970
|
}
|
|
13975
13971
|
function pairedInlineHtml(children, index, md) {
|
|
13976
|
-
var
|
|
13972
|
+
var _a2, _b, _c, _d;
|
|
13977
13973
|
const open = children[index];
|
|
13978
|
-
const tag = (open === null || open === void 0 ? void 0 : open.type) === "html" ? (
|
|
13974
|
+
const tag = (open === null || open === void 0 ? void 0 : open.type) === "html" ? (_a2 = OPENING_TAG.exec(open.value)) === null || _a2 === void 0 ? void 0 : _a2[1] : void 0;
|
|
13979
13975
|
const start = (_b = open === null || open === void 0 ? void 0 : open.position) === null || _b === void 0 ? void 0 : _b.start.offset;
|
|
13980
13976
|
if (!tag || start === void 0)
|
|
13981
13977
|
return void 0;
|
|
@@ -13986,7 +13982,7 @@ function pairedInlineHtml(children, index, md) {
|
|
|
13986
13982
|
return { nodes: inlineHtml(md.slice(start, end)), skip: closeIndex - index };
|
|
13987
13983
|
}
|
|
13988
13984
|
function normalizeHtml(parent, md) {
|
|
13989
|
-
var
|
|
13985
|
+
var _a2, _b;
|
|
13990
13986
|
const phrasing = PHRASING_PARENTS.has(parent.type);
|
|
13991
13987
|
const items = [];
|
|
13992
13988
|
for (let i = 0; i < parent.children.length; i++) {
|
|
@@ -13999,7 +13995,7 @@ function normalizeHtml(parent, md) {
|
|
|
13999
13995
|
items.push(...blockHtml(child.value));
|
|
14000
13996
|
else {
|
|
14001
13997
|
const paired = pairedInlineHtml(parent.children, i, md);
|
|
14002
|
-
items.push(...(
|
|
13998
|
+
items.push(...(_a2 = paired === null || paired === void 0 ? void 0 : paired.nodes) !== null && _a2 !== void 0 ? _a2 : inlineHtml(child.value));
|
|
14003
13999
|
i += (_b = paired === null || paired === void 0 ? void 0 : paired.skip) !== null && _b !== void 0 ? _b : 0;
|
|
14004
14000
|
}
|
|
14005
14001
|
}
|
|
@@ -14017,7 +14013,7 @@ function mdToMdast(md) {
|
|
|
14017
14013
|
promoteHtmlContainers(root);
|
|
14018
14014
|
expressionsToText(root);
|
|
14019
14015
|
return root;
|
|
14020
|
-
} catch (
|
|
14016
|
+
} catch (_a2) {
|
|
14021
14017
|
return markdownToMdast(md);
|
|
14022
14018
|
}
|
|
14023
14019
|
}
|
|
@@ -14061,7 +14057,7 @@ var FRONTMATTER_ATTRIBUTES_WITH_ARRAY_VALUES = Array.from(FRONTMATTER_ARRAY_KEYS
|
|
|
14061
14057
|
function safeJsonParse(value) {
|
|
14062
14058
|
try {
|
|
14063
14059
|
return JSON.parse(value);
|
|
14064
|
-
} catch (
|
|
14060
|
+
} catch (_a2) {
|
|
14065
14061
|
return value;
|
|
14066
14062
|
}
|
|
14067
14063
|
}
|
|
@@ -14105,6 +14101,7 @@ function formatFrontmatterValue(key, value) {
|
|
|
14105
14101
|
}
|
|
14106
14102
|
|
|
14107
14103
|
// ../editor/dist/converter/serialize/handlers/components.js
|
|
14104
|
+
import { isMdxJsxElement as isMdxJsxElement2 } from "@mintlify/common";
|
|
14108
14105
|
import { titleMarkdownToText } from "@mintlify/common/title-markdown";
|
|
14109
14106
|
import remarkGfm3 from "remark-gfm";
|
|
14110
14107
|
import remarkMath3 from "remark-math";
|
|
@@ -14122,7 +14119,7 @@ function isJSXContent(str) {
|
|
|
14122
14119
|
sourceType: "module"
|
|
14123
14120
|
});
|
|
14124
14121
|
return expression.type === "JSXElement" && expression.end === str.length;
|
|
14125
|
-
} catch (
|
|
14122
|
+
} catch (_a2) {
|
|
14126
14123
|
return false;
|
|
14127
14124
|
}
|
|
14128
14125
|
}
|
|
@@ -14159,7 +14156,7 @@ function serializePropValue(v) {
|
|
|
14159
14156
|
return `{${JSON.stringify(v)}}`;
|
|
14160
14157
|
}
|
|
14161
14158
|
function serializeJsValue(value) {
|
|
14162
|
-
var
|
|
14159
|
+
var _a2;
|
|
14163
14160
|
if (value === null || value === void 0)
|
|
14164
14161
|
return "null";
|
|
14165
14162
|
if (typeof value === "string")
|
|
@@ -14170,7 +14167,7 @@ function serializeJsValue(value) {
|
|
|
14170
14167
|
return `[${value.map(serializeJsValue).join(",")}]`;
|
|
14171
14168
|
if (typeof value === "object")
|
|
14172
14169
|
return serializeJsObjectLiteral(value, false);
|
|
14173
|
-
return (
|
|
14170
|
+
return (_a2 = JSON.stringify(value)) !== null && _a2 !== void 0 ? _a2 : "null";
|
|
14174
14171
|
}
|
|
14175
14172
|
function serializeJsObjectLiteral(value, outermost) {
|
|
14176
14173
|
const entries = Object.entries(value).filter(([, entry]) => entry !== void 0).map(([key, entry]) => {
|
|
@@ -14201,8 +14198,8 @@ var ATTRIBUTE_VALUE_ESCAPES = {
|
|
|
14201
14198
|
"~": "~"
|
|
14202
14199
|
};
|
|
14203
14200
|
var escapeAttributeValue = (value) => value.replace(/[&"<>\n\r`~]/g, (char) => {
|
|
14204
|
-
var
|
|
14205
|
-
return (
|
|
14201
|
+
var _a2;
|
|
14202
|
+
return (_a2 = ATTRIBUTE_VALUE_ESCAPES[char]) !== null && _a2 !== void 0 ? _a2 : char;
|
|
14206
14203
|
});
|
|
14207
14204
|
var READABLE_ESCAPES = Object.assign(Object.assign({}, ATTRIBUTE_VALUE_ESCAPES), { "'": "'", "*": "*", "{": "{", "}": "}" });
|
|
14208
14205
|
var READABLE_UNSAFE = /&(?=#?[A-Za-z0-9]+;)|<(?=[A-Za-z/!?])|(?<=\/)\*|\*(?=\/)|[\n\r`~{}]/g;
|
|
@@ -14211,8 +14208,8 @@ function serializeReadableJsxAttribute(key, value) {
|
|
|
14211
14208
|
return null;
|
|
14212
14209
|
const quote = value.includes('"') ? "'" : '"';
|
|
14213
14210
|
const escaped = value.replace(new RegExp(`${READABLE_UNSAFE.source}|${quote}`, "g"), (char) => {
|
|
14214
|
-
var
|
|
14215
|
-
return (
|
|
14211
|
+
var _a2;
|
|
14212
|
+
return (_a2 = READABLE_ESCAPES[char]) !== null && _a2 !== void 0 ? _a2 : char;
|
|
14216
14213
|
});
|
|
14217
14214
|
return `${key}=${quote}${escaped}${quote}`;
|
|
14218
14215
|
}
|
|
@@ -14242,7 +14239,7 @@ function isWordChar(ch) {
|
|
|
14242
14239
|
}
|
|
14243
14240
|
var SerializerState = class {
|
|
14244
14241
|
constructor(options = {}) {
|
|
14245
|
-
var
|
|
14242
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
14246
14243
|
this.chunks = [];
|
|
14247
14244
|
this.chunkStarts = [];
|
|
14248
14245
|
this.outLength = 0;
|
|
@@ -14260,7 +14257,7 @@ var SerializerState = class {
|
|
|
14260
14257
|
this.sourceMap = null;
|
|
14261
14258
|
this.nodePath = [];
|
|
14262
14259
|
this.options = {
|
|
14263
|
-
tightLists: (
|
|
14260
|
+
tightLists: (_a2 = options.tightLists) !== null && _a2 !== void 0 ? _a2 : false,
|
|
14264
14261
|
indentSize: (_b = options.indentSize) !== null && _b !== void 0 ? _b : 2,
|
|
14265
14262
|
listIndentSize: (_c = options.listIndentSize) !== null && _c !== void 0 ? _c : 0,
|
|
14266
14263
|
removeTrailingNewline: (_d = options.removeTrailingNewline) !== null && _d !== void 0 ? _d : true,
|
|
@@ -14272,13 +14269,13 @@ var SerializerState = class {
|
|
|
14272
14269
|
}
|
|
14273
14270
|
/** The serialized output */
|
|
14274
14271
|
get out() {
|
|
14275
|
-
var
|
|
14272
|
+
var _a2;
|
|
14276
14273
|
if (this.chunks.length > 1) {
|
|
14277
14274
|
const joined = this.chunks.join("");
|
|
14278
14275
|
this.chunks = [joined];
|
|
14279
14276
|
this.chunkStarts = [0];
|
|
14280
14277
|
}
|
|
14281
|
-
return (
|
|
14278
|
+
return (_a2 = this.chunks[0]) !== null && _a2 !== void 0 ? _a2 : "";
|
|
14282
14279
|
}
|
|
14283
14280
|
set out(value) {
|
|
14284
14281
|
this.chunks = [];
|
|
@@ -14296,12 +14293,12 @@ var SerializerState = class {
|
|
|
14296
14293
|
}
|
|
14297
14294
|
/** Output written at or after `offset`. */
|
|
14298
14295
|
sliceFrom(offset2) {
|
|
14299
|
-
var
|
|
14296
|
+
var _a2, _b;
|
|
14300
14297
|
let lo = 0;
|
|
14301
14298
|
let hi = this.chunkStarts.length - 1;
|
|
14302
14299
|
while (lo < hi) {
|
|
14303
14300
|
const mid = lo + hi + 1 >> 1;
|
|
14304
|
-
if (((
|
|
14301
|
+
if (((_a2 = this.chunkStarts[mid]) !== null && _a2 !== void 0 ? _a2 : 0) <= offset2)
|
|
14305
14302
|
lo = mid;
|
|
14306
14303
|
else
|
|
14307
14304
|
hi = mid - 1;
|
|
@@ -14313,10 +14310,10 @@ var SerializerState = class {
|
|
|
14313
14310
|
}
|
|
14314
14311
|
/** Drop the last `count` characters of the output. */
|
|
14315
14312
|
truncate(count) {
|
|
14316
|
-
var
|
|
14313
|
+
var _a2, _b, _c;
|
|
14317
14314
|
let remaining = count;
|
|
14318
14315
|
while (remaining > 0 && this.chunks.length > 0) {
|
|
14319
|
-
const last = (
|
|
14316
|
+
const last = (_a2 = this.chunks[this.chunks.length - 1]) !== null && _a2 !== void 0 ? _a2 : "";
|
|
14320
14317
|
if (last.length <= remaining) {
|
|
14321
14318
|
remaining -= last.length;
|
|
14322
14319
|
this.chunks.pop();
|
|
@@ -14372,12 +14369,12 @@ var SerializerState = class {
|
|
|
14372
14369
|
return this.outLength;
|
|
14373
14370
|
}
|
|
14374
14371
|
endBlock(start) {
|
|
14375
|
-
var
|
|
14372
|
+
var _a2;
|
|
14376
14373
|
var _b;
|
|
14377
14374
|
if (!this.sourceMap)
|
|
14378
14375
|
return;
|
|
14379
14376
|
if (this.nodePath.length === 1) {
|
|
14380
|
-
const lead = (_b = (
|
|
14377
|
+
const lead = (_b = (_a2 = this.topLevelLead) === null || _a2 === void 0 ? void 0 : _a2.lead) !== null && _b !== void 0 ? _b : 0;
|
|
14381
14378
|
this.topLevelLead = null;
|
|
14382
14379
|
this.sourceMap.push({
|
|
14383
14380
|
path: [...this.nodePath],
|
|
@@ -14882,11 +14879,11 @@ function renderImage(state, node) {
|
|
|
14882
14879
|
state.closeBlock();
|
|
14883
14880
|
}
|
|
14884
14881
|
function addAlignClass(existing, align, extra) {
|
|
14885
|
-
var
|
|
14882
|
+
var _a2;
|
|
14886
14883
|
let classes = existing ? existing.trim() : "";
|
|
14887
14884
|
if (align && align in IMAGE_ALIGN_CLASSES) {
|
|
14888
14885
|
classes = classes.split(" ").filter((c) => !c.match(/mr-auto|ml-auto|mx-auto/)).join(" ");
|
|
14889
|
-
const alignClass = (
|
|
14886
|
+
const alignClass = (_a2 = IMAGE_ALIGN_CLASSES[align]) !== null && _a2 !== void 0 ? _a2 : "";
|
|
14890
14887
|
classes = classes ? `${classes} ${alignClass}` : alignClass;
|
|
14891
14888
|
}
|
|
14892
14889
|
if (extra) {
|
|
@@ -14950,8 +14947,8 @@ function fitsMarkdownImageSyntax(node, attrs2) {
|
|
|
14950
14947
|
return Object.entries(attrs2).every(([key, value]) => key === "src" || key === "alt" || key === "title" || value == null);
|
|
14951
14948
|
}
|
|
14952
14949
|
function renderInlineImage(state, node) {
|
|
14953
|
-
var
|
|
14954
|
-
const imgAttributes = (
|
|
14950
|
+
var _a2;
|
|
14951
|
+
const imgAttributes = (_a2 = node.attrs.imgAttributes) !== null && _a2 !== void 0 ? _a2 : {};
|
|
14955
14952
|
if (fitsMarkdownImageSyntax(node, imgAttributes)) {
|
|
14956
14953
|
writeMarkdownImage(state, imgAttributes, imgAttributes["src"]);
|
|
14957
14954
|
return;
|
|
@@ -14970,8 +14967,8 @@ function renderInlineImage(state, node) {
|
|
|
14970
14967
|
state.write(" />");
|
|
14971
14968
|
}
|
|
14972
14969
|
function renderVideo(state, node) {
|
|
14973
|
-
var
|
|
14974
|
-
const videoAttributes = (
|
|
14970
|
+
var _a2, _b;
|
|
14971
|
+
const videoAttributes = (_a2 = node.attrs.videoAttributes) !== null && _a2 !== void 0 ? _a2 : {};
|
|
14975
14972
|
const sources = (_b = node.attrs.sources) !== null && _b !== void 0 ? _b : [];
|
|
14976
14973
|
state.write("<video");
|
|
14977
14974
|
writeJsxAttributesInline(state, videoAttributes);
|
|
@@ -15013,10 +15010,10 @@ var offsetMapperForLines = (source, parentContentStarts) => {
|
|
|
15013
15010
|
sourceLineStarts.push(index + 1);
|
|
15014
15011
|
}
|
|
15015
15012
|
return (offset2) => {
|
|
15016
|
-
var
|
|
15013
|
+
var _a2, _b, _c, _d;
|
|
15017
15014
|
const clamped = Math.min(Math.max(offset2, 0), source.length);
|
|
15018
15015
|
let lineIndex = sourceLineStarts.length - 1;
|
|
15019
|
-
while (lineIndex > 0 && ((
|
|
15016
|
+
while (lineIndex > 0 && ((_a2 = sourceLineStarts[lineIndex]) !== null && _a2 !== void 0 ? _a2 : 0) > clamped)
|
|
15020
15017
|
lineIndex--;
|
|
15021
15018
|
const sourceLineStart = (_b = sourceLineStarts[lineIndex]) !== null && _b !== void 0 ? _b : 0;
|
|
15022
15019
|
const parentLineStart = (_d = (_c = parentContentStarts[lineIndex]) !== null && _c !== void 0 ? _c : parentContentStarts.at(-1)) !== null && _d !== void 0 ? _d : 0;
|
|
@@ -15024,7 +15021,7 @@ var offsetMapperForLines = (source, parentContentStarts) => {
|
|
|
15024
15021
|
};
|
|
15025
15022
|
};
|
|
15026
15023
|
function renderBlockquote(state, node, renderNode2) {
|
|
15027
|
-
var
|
|
15024
|
+
var _a2, _b;
|
|
15028
15025
|
for (let i = 0; i < node.childCount; i++) {
|
|
15029
15026
|
const child = node.child(i);
|
|
15030
15027
|
const childState = new SerializerState(state.options);
|
|
@@ -15034,7 +15031,7 @@ function renderBlockquote(state, node, renderNode2) {
|
|
|
15034
15031
|
const lines = childOutput.split("\n");
|
|
15035
15032
|
const parentContentStarts = [];
|
|
15036
15033
|
for (let j = 0; j < lines.length; j++) {
|
|
15037
|
-
const line = (
|
|
15034
|
+
const line = (_a2 = lines[j]) !== null && _a2 !== void 0 ? _a2 : "";
|
|
15038
15035
|
state.write(line.length > 0 ? "> " : ">");
|
|
15039
15036
|
parentContentStarts.push(state.length);
|
|
15040
15037
|
state.write(line);
|
|
@@ -15049,7 +15046,7 @@ function renderBlockquote(state, node, renderNode2) {
|
|
|
15049
15046
|
state.closeBlock();
|
|
15050
15047
|
}
|
|
15051
15048
|
function renderList(state, node, ordered, renderContent2) {
|
|
15052
|
-
var
|
|
15049
|
+
var _a2, _b;
|
|
15053
15050
|
const start = typeof node.attrs.start === "number" ? node.attrs.start : 1;
|
|
15054
15051
|
const isTight = typeof node.attrs.tight === "boolean" ? node.attrs.tight : state.options.tightLists;
|
|
15055
15052
|
for (let i = 0; i < node.childCount; i++) {
|
|
@@ -15066,7 +15063,7 @@ function renderList(state, node, ordered, renderContent2) {
|
|
|
15066
15063
|
const parentContentStarts = [];
|
|
15067
15064
|
let lineStart = 0;
|
|
15068
15065
|
for (let j = 0; j < lines.length; j++) {
|
|
15069
|
-
const line = (
|
|
15066
|
+
const line = (_a2 = lines[j]) !== null && _a2 !== void 0 ? _a2 : "";
|
|
15070
15067
|
const keepsBlankLine = !isTight || itemState.keptBlankLines.has(lineStart);
|
|
15071
15068
|
lineStart += line.length + 1;
|
|
15072
15069
|
if (j === 0) {
|
|
@@ -15137,12 +15134,12 @@ function isPipeTable(table) {
|
|
|
15137
15134
|
return getColumnWidths(table).every((width) => width === null);
|
|
15138
15135
|
}
|
|
15139
15136
|
function getColumnWidths(table) {
|
|
15140
|
-
var
|
|
15137
|
+
var _a2;
|
|
15141
15138
|
const widths = [];
|
|
15142
|
-
(
|
|
15143
|
-
var
|
|
15139
|
+
(_a2 = table.firstChild) === null || _a2 === void 0 ? void 0 : _a2.forEach((cell) => {
|
|
15140
|
+
var _a3;
|
|
15144
15141
|
const colwidth = cell.attrs.colwidth;
|
|
15145
|
-
const colspan = (
|
|
15142
|
+
const colspan = (_a3 = cell.attrs.colspan) !== null && _a3 !== void 0 ? _a3 : 1;
|
|
15146
15143
|
for (let i = 0; i < colspan; i++) {
|
|
15147
15144
|
const width = colwidth === null || colwidth === void 0 ? void 0 : colwidth[i];
|
|
15148
15145
|
widths.push(typeof width === "number" && width > 0 ? width : null);
|
|
@@ -15272,8 +15269,8 @@ function renderTableBlockContent(node, options, renderInline2, renderNode2, html
|
|
|
15272
15269
|
return renderTableNodeContent(node, options, renderNode2, htmlTable);
|
|
15273
15270
|
}
|
|
15274
15271
|
function renderImageInTableCell(node) {
|
|
15275
|
-
var
|
|
15276
|
-
const imgAttributes = (
|
|
15272
|
+
var _a2;
|
|
15273
|
+
const imgAttributes = (_a2 = node.attrs.imgAttributes) !== null && _a2 !== void 0 ? _a2 : {};
|
|
15277
15274
|
const lightSrc = node.attrs.lightSrc;
|
|
15278
15275
|
const darkSrc = node.attrs.darkSrc;
|
|
15279
15276
|
const width = node.attrs.width;
|
|
@@ -15393,6 +15390,7 @@ var __rest = function(s, e) {
|
|
|
15393
15390
|
}
|
|
15394
15391
|
return t;
|
|
15395
15392
|
};
|
|
15393
|
+
var _a;
|
|
15396
15394
|
var titleMarkdownSpecialCharacters = /[\\`*_[\]~&]/g;
|
|
15397
15395
|
function hasInlineMarks(node) {
|
|
15398
15396
|
for (let index = 0; index < node.childCount; index += 1) {
|
|
@@ -15404,9 +15402,9 @@ function hasInlineMarks(node) {
|
|
|
15404
15402
|
var BADGE_DEFAULTS = toDefaults(BADGE_ATTRS);
|
|
15405
15403
|
var TOOLTIP_DEFAULTS = toDefaults(TOOLTIP_ATTRS);
|
|
15406
15404
|
function renderCallout(state, node, renderContent2) {
|
|
15407
|
-
var
|
|
15405
|
+
var _a2;
|
|
15408
15406
|
const _b = node.attrs, { type } = _b, attrs2 = __rest(_b, ["type"]);
|
|
15409
|
-
const name = (
|
|
15407
|
+
const name = (_a2 = CALLOUT_TYPES.find((t) => t === type)) !== null && _a2 !== void 0 ? _a2 : "Callout";
|
|
15410
15408
|
renderComponentWithAttrs(state, node, name, attrs2, renderContent2);
|
|
15411
15409
|
}
|
|
15412
15410
|
function renderTitledComponent(state, node, name, renderContent2, renderInline2, excludeAttrs = []) {
|
|
@@ -15483,13 +15481,13 @@ function renderCodeGroup(state, node, name) {
|
|
|
15483
15481
|
state.closeBlock();
|
|
15484
15482
|
}
|
|
15485
15483
|
function renderCustomComponent(state, node, renderContent2) {
|
|
15486
|
-
var
|
|
15484
|
+
var _a2;
|
|
15487
15485
|
const name = node.attrs.name || "CustomComponent";
|
|
15488
15486
|
if (name === "CodeBlock") {
|
|
15489
15487
|
renderCodeBlock(state, node);
|
|
15490
15488
|
return;
|
|
15491
15489
|
}
|
|
15492
|
-
const customAttrs = (
|
|
15490
|
+
const customAttrs = (_a2 = node.attrs.attributes) !== null && _a2 !== void 0 ? _a2 : {};
|
|
15493
15491
|
renderComponentWithAttrs(state, node, name, customAttrs, renderContent2);
|
|
15494
15492
|
}
|
|
15495
15493
|
function renderIcon(state, node) {
|
|
@@ -15543,7 +15541,7 @@ function renderTooltip(state, node, renderInline2) {
|
|
|
15543
15541
|
}
|
|
15544
15542
|
}
|
|
15545
15543
|
function renderStaticHTML(state, node, renderContent2) {
|
|
15546
|
-
var
|
|
15544
|
+
var _a2;
|
|
15547
15545
|
const inline = state.inTable || node.type.name === BLOCK_TYPES.inlineStaticHTML;
|
|
15548
15546
|
const escapeTablePipes = (value) => state.escapesPipes ? value.replace(/\|/g, "|") : value;
|
|
15549
15547
|
const mdxJsxNode = node.attrs.mdxJsxNode;
|
|
@@ -15561,7 +15559,7 @@ function renderStaticHTML(state, node, renderContent2) {
|
|
|
15561
15559
|
}
|
|
15562
15560
|
}
|
|
15563
15561
|
const tagName = node.attrs.tagName || "div";
|
|
15564
|
-
const attributes = (
|
|
15562
|
+
const attributes = (_a2 = node.attrs.attributes) !== null && _a2 !== void 0 ? _a2 : {};
|
|
15565
15563
|
const namedAttrs = Object.entries(attributes).filter(([_, value]) => value !== null && value !== void 0).map(([key, value]) => {
|
|
15566
15564
|
if (HIDDEN_NODE_ATTRS.has(key))
|
|
15567
15565
|
return null;
|
|
@@ -15585,13 +15583,13 @@ function renderStaticHTML(state, node, renderContent2) {
|
|
|
15585
15583
|
var EXPRESSION_CONTINUATION_INDENT = 2;
|
|
15586
15584
|
var JSX_CHILD_INDENT = 2;
|
|
15587
15585
|
var shiftContinuationLines = (value, columns) => value.split("\n").map((line, index) => {
|
|
15588
|
-
var
|
|
15586
|
+
var _a2;
|
|
15589
15587
|
var _b;
|
|
15590
15588
|
if (index === 0 || line === "")
|
|
15591
15589
|
return line;
|
|
15592
15590
|
if (columns >= 0)
|
|
15593
15591
|
return `${" ".repeat(columns)}${line}`;
|
|
15594
|
-
const removable = Math.min(-columns, (_b = (
|
|
15592
|
+
const removable = Math.min(-columns, (_b = (_a2 = line.match(/^ */)) === null || _a2 === void 0 ? void 0 : _a2[0].length) !== null && _b !== void 0 ? _b : 0);
|
|
15595
15593
|
return line.slice(removable);
|
|
15596
15594
|
}).join("\n");
|
|
15597
15595
|
var alignFlowExpressions = (node, jsxDepth) => {
|
|
@@ -15620,7 +15618,7 @@ function renderUnknownTag(state, node) {
|
|
|
15620
15618
|
const str = stringifyMdxNode([mdxJsxNode]);
|
|
15621
15619
|
const content = node.type.name === BLOCK_TYPES.inlineUnknownTag ? str.replace(/\n$/, "") : str;
|
|
15622
15620
|
state.write(content);
|
|
15623
|
-
} catch (
|
|
15621
|
+
} catch (_a2) {
|
|
15624
15622
|
state.write("<!-- unknown tag -->");
|
|
15625
15623
|
}
|
|
15626
15624
|
}
|
|
@@ -15634,7 +15632,7 @@ function renderMdxEsm(state, node) {
|
|
|
15634
15632
|
try {
|
|
15635
15633
|
const str = stringifyMdxNode([mdastNode]);
|
|
15636
15634
|
state.write(str);
|
|
15637
|
-
} catch (
|
|
15635
|
+
} catch (_a2) {
|
|
15638
15636
|
state.write("<!-- esm node -->");
|
|
15639
15637
|
}
|
|
15640
15638
|
}
|
|
@@ -15648,10 +15646,29 @@ function unescapeIntrawordUnderscores(text) {
|
|
|
15648
15646
|
return prev !== void 0 && WORD_CHAR2.test(prev) && next !== void 0 && WORD_CHAR2.test(next) ? "_" : match;
|
|
15649
15647
|
});
|
|
15650
15648
|
}
|
|
15651
|
-
var
|
|
15652
|
-
|
|
15653
|
-
|
|
15649
|
+
var findMdxJsxHandle = (extensions) => {
|
|
15650
|
+
var _a2;
|
|
15651
|
+
var _b, _c;
|
|
15652
|
+
for (const extension of extensions) {
|
|
15653
|
+
const handle = (_b = (_a2 = extension.handlers) === null || _a2 === void 0 ? void 0 : _a2.mdxJsxFlowElement) !== null && _b !== void 0 ? _b : findMdxJsxHandle((_c = extension.extensions) !== null && _c !== void 0 ? _c : []);
|
|
15654
|
+
if (handle)
|
|
15655
|
+
return handle;
|
|
15656
|
+
}
|
|
15657
|
+
return void 0;
|
|
15658
|
+
};
|
|
15659
|
+
var isEmptyClosedElement = (value) => {
|
|
15660
|
+
var _a2;
|
|
15661
|
+
return isMdxJsxElement2(value) && value.name !== null && value.children.length === 0 && ((_a2 = value.data) === null || _a2 === void 0 ? void 0 : _a2.closingTag) === true;
|
|
15662
|
+
};
|
|
15663
|
+
var keepClosingTag = (handle) => (node, parent, state, info) => {
|
|
15664
|
+
const element = handle(node, parent, state, info);
|
|
15665
|
+
return isEmptyClosedElement(node) ? element.replace(/ ?\/>$/, `></${node.name}>`) : element;
|
|
15654
15666
|
};
|
|
15667
|
+
var mdxJsxHandle = findMdxJsxHandle((_a = unified().use(remarkMdx2).freeze().data("toMarkdownExtensions")) !== null && _a !== void 0 ? _a : []);
|
|
15668
|
+
var stringifyHandlers = Object.assign({ text: (node, _parent, state, info) => unescapeIntrawordUnderscores(state.safe(node.value, info)), inlineMath: (node) => `$$${node.value}$$` }, mdxJsxHandle && {
|
|
15669
|
+
mdxJsxFlowElement: keepClosingTag(mdxJsxHandle),
|
|
15670
|
+
mdxJsxTextElement: keepClosingTag(mdxJsxHandle)
|
|
15671
|
+
});
|
|
15655
15672
|
function stringifyMdxNode(children) {
|
|
15656
15673
|
const wrapped = structuredClone(children).map((child) => (child === null || child === void 0 ? void 0 : child.type) === "mdxJsxTextElement" ? { type: "paragraph", children: [child] } : child);
|
|
15657
15674
|
for (const child of wrapped)
|
|
@@ -15734,9 +15751,9 @@ function serializeColorItemTag(item) {
|
|
|
15734
15751
|
return `<Color.Item${parts.length ? " " + parts.join(" ") : ""} />`;
|
|
15735
15752
|
}
|
|
15736
15753
|
function renderColor(state, node) {
|
|
15737
|
-
var
|
|
15754
|
+
var _a2;
|
|
15738
15755
|
const variant = node.attrs.variant;
|
|
15739
|
-
const colorData = (
|
|
15756
|
+
const colorData = (_a2 = node.attrs.colorData) !== null && _a2 !== void 0 ? _a2 : [];
|
|
15740
15757
|
const variantProp = variant ? ` variant="${variant}"` : "";
|
|
15741
15758
|
state.write(`<Color${variantProp}${extraAttrsPropString(node.attrs)}>`);
|
|
15742
15759
|
state.ensureNewLine();
|
|
@@ -15821,8 +15838,8 @@ function renderDatabase(state, node) {
|
|
|
15821
15838
|
state.closeBlock();
|
|
15822
15839
|
}
|
|
15823
15840
|
function renderTree(state, node) {
|
|
15824
|
-
var
|
|
15825
|
-
const treeData = (
|
|
15841
|
+
var _a2;
|
|
15842
|
+
const treeData = (_a2 = node.attrs.treeData) !== null && _a2 !== void 0 ? _a2 : [];
|
|
15826
15843
|
const extraTreeAttrs = extraAttrsPropString(node.attrs);
|
|
15827
15844
|
if (treeData.length === 0) {
|
|
15828
15845
|
state.write(`<Tree${extraTreeAttrs} />`);
|
|
@@ -15950,9 +15967,9 @@ function drainSerialization(steps) {
|
|
|
15950
15967
|
return step.value;
|
|
15951
15968
|
}
|
|
15952
15969
|
function* serializeDoc(doc, options, sourceMap) {
|
|
15953
|
-
var
|
|
15970
|
+
var _a2;
|
|
15954
15971
|
const { frontmatter } = options, serializerOptions = __rest2(options, ["frontmatter"]);
|
|
15955
|
-
const state = new SerializerState(Object.assign(Object.assign({}, serializerOptions), { hasReferenceDefinitions: (
|
|
15972
|
+
const state = new SerializerState(Object.assign(Object.assign({}, serializerOptions), { hasReferenceDefinitions: (_a2 = serializerOptions.hasReferenceDefinitions) !== null && _a2 !== void 0 ? _a2 : hasReferenceDefinitions(doc) }));
|
|
15956
15973
|
state.sourceMap = sourceMap;
|
|
15957
15974
|
if (frontmatter && Object.keys(frontmatter).length > 0) {
|
|
15958
15975
|
const entries = Object.entries(filterFrontmatterRecord(frontmatter));
|
|
@@ -16222,7 +16239,7 @@ import { Fragment } from "prosemirror-model";
|
|
|
16222
16239
|
import { parse as parseYaml2 } from "yaml";
|
|
16223
16240
|
|
|
16224
16241
|
// ../editor/dist/converter/diff/node-utils.js
|
|
16225
|
-
import { isMdxJsxElement } from "@mintlify/common";
|
|
16242
|
+
import { isMdxJsxElement as isMdxJsxElement3 } from "@mintlify/common";
|
|
16226
16243
|
var deepEqual = (a, b) => {
|
|
16227
16244
|
if (a === b)
|
|
16228
16245
|
return true;
|
|
@@ -16267,7 +16284,7 @@ var attrsEqual = (a, b) => {
|
|
|
16267
16284
|
}
|
|
16268
16285
|
return true;
|
|
16269
16286
|
};
|
|
16270
|
-
var isHtmlSource = (value) =>
|
|
16287
|
+
var isHtmlSource = (value) => isMdxJsxElement3(value) && !!value.name && HTML_ELEMENTS.has(value.name);
|
|
16271
16288
|
var omitsHtmlSource = (a, b) => a === null && isHtmlSource(b) || b === null && isHtmlSource(a);
|
|
16272
16289
|
var isMdastPosition = (v) => v !== null && typeof v === "object" && "start" in v && "end" in v;
|
|
16273
16290
|
var isEstreeLoc = (v) => v !== null && typeof v === "object" && "start" in v && "end" in v;
|
|
@@ -16355,7 +16372,7 @@ var textSimilarity = (a, b) => {
|
|
|
16355
16372
|
return Math.max(prefixRatio, wordRatio);
|
|
16356
16373
|
};
|
|
16357
16374
|
var nodesMatch = (a, b, schema) => {
|
|
16358
|
-
var
|
|
16375
|
+
var _a2, _b;
|
|
16359
16376
|
if (a.type !== b.type)
|
|
16360
16377
|
return false;
|
|
16361
16378
|
if (a.text != null)
|
|
@@ -16368,7 +16385,7 @@ var nodesMatch = (a, b, schema) => {
|
|
|
16368
16385
|
const textB2 = extractText(b);
|
|
16369
16386
|
if (textA2.length === 0 || textB2.length === 0)
|
|
16370
16387
|
return true;
|
|
16371
|
-
const threshold = a.type === "heading" && ((
|
|
16388
|
+
const threshold = a.type === "heading" && ((_a2 = a.attrs) === null || _a2 === void 0 ? void 0 : _a2.level) === ((_b = b.attrs) === null || _b === void 0 ? void 0 : _b.level) ? 0.15 : 0.3;
|
|
16372
16389
|
return textSimilarity(textA2, textB2) > threshold;
|
|
16373
16390
|
}
|
|
16374
16391
|
const textA = extractText(a);
|
|
@@ -16378,19 +16395,19 @@ var nodesMatch = (a, b, schema) => {
|
|
|
16378
16395
|
return textSimilarity(textA, textB) > 0.15;
|
|
16379
16396
|
};
|
|
16380
16397
|
var isTextblock = (nodeType, schema) => {
|
|
16381
|
-
var
|
|
16398
|
+
var _a2;
|
|
16382
16399
|
const spec = schema.nodes[nodeType];
|
|
16383
|
-
return (
|
|
16400
|
+
return (_a2 = spec === null || spec === void 0 ? void 0 : spec.isTextblock) !== null && _a2 !== void 0 ? _a2 : false;
|
|
16384
16401
|
};
|
|
16385
16402
|
var isLeaf = (nodeType, schema) => {
|
|
16386
|
-
var
|
|
16403
|
+
var _a2;
|
|
16387
16404
|
const spec = schema.nodes[nodeType];
|
|
16388
|
-
return (
|
|
16405
|
+
return (_a2 = spec === null || spec === void 0 ? void 0 : spec.isLeaf) !== null && _a2 !== void 0 ? _a2 : false;
|
|
16389
16406
|
};
|
|
16390
16407
|
var isCode = (nodeType, schema) => {
|
|
16391
|
-
var
|
|
16408
|
+
var _a2;
|
|
16392
16409
|
const spec = schema.nodes[nodeType];
|
|
16393
|
-
return (
|
|
16410
|
+
return (_a2 = spec === null || spec === void 0 ? void 0 : spec.spec.code) !== null && _a2 !== void 0 ? _a2 : false;
|
|
16394
16411
|
};
|
|
16395
16412
|
|
|
16396
16413
|
// ../editor/dist/converter/serialize/pm-to-mdx-preserving.js
|
|
@@ -16526,10 +16543,10 @@ ${frame.indent}`;
|
|
|
16526
16543
|
return /^[ \t]*$/.test(prefix) ? prefix : this.frame.indent;
|
|
16527
16544
|
}
|
|
16528
16545
|
verbatim(index) {
|
|
16529
|
-
var
|
|
16546
|
+
var _a2, _b;
|
|
16530
16547
|
var _c, _d;
|
|
16531
16548
|
const child = this.src[index];
|
|
16532
|
-
this.sep(index, (_c = (
|
|
16549
|
+
this.sep(index, (_c = (_a2 = child.node) === null || _a2 === void 0 ? void 0 : _a2.type.name) !== null && _c !== void 0 ? _c : null, false);
|
|
16533
16550
|
this.out += this.source.slice(child.start, child.end);
|
|
16534
16551
|
this.prevSrc = index;
|
|
16535
16552
|
this.prevType = (_d = (_b = child.node) === null || _b === void 0 ? void 0 : _b.type.name) !== null && _d !== void 0 ? _d : null;
|
|
@@ -16688,7 +16705,7 @@ ${prefix}`;
|
|
|
16688
16705
|
try {
|
|
16689
16706
|
const wrapped = this.wrapperOpen(level, start, first) + text + level.close;
|
|
16690
16707
|
parsed = mdxToPm(wrapped, Object.assign(Object.assign({}, this.parseOptions), { schema: this.schema })).doc;
|
|
16691
|
-
} catch (
|
|
16708
|
+
} catch (_a2) {
|
|
16692
16709
|
return null;
|
|
16693
16710
|
}
|
|
16694
16711
|
let current2 = parsed;
|
|
@@ -16709,12 +16726,12 @@ ${prefix}`;
|
|
|
16709
16726
|
child.nodes = nodes2;
|
|
16710
16727
|
}
|
|
16711
16728
|
coalesce(level, src, matches) {
|
|
16712
|
-
var
|
|
16729
|
+
var _a2, _b;
|
|
16713
16730
|
let merged = false;
|
|
16714
16731
|
for (let i = src.length - 2; i >= 0; i--) {
|
|
16715
16732
|
const a = src[i];
|
|
16716
16733
|
const b = src[i + 1];
|
|
16717
|
-
if (!((
|
|
16734
|
+
if (!((_a2 = a.keys) === null || _a2 === void 0 ? void 0 : _a2.length) || !((_b = b.keys) === null || _b === void 0 ? void 0 : _b.length))
|
|
16718
16735
|
continue;
|
|
16719
16736
|
if (matches[i] !== null || matches[i + 1] !== null)
|
|
16720
16737
|
continue;
|
|
@@ -16752,20 +16769,20 @@ ${prefix}`;
|
|
|
16752
16769
|
const pending = [];
|
|
16753
16770
|
let liveIndex = 0;
|
|
16754
16771
|
const flushZeroKeys = (upTo) => {
|
|
16755
|
-
var
|
|
16772
|
+
var _a2;
|
|
16756
16773
|
for (let p = 0; p < upTo; p++) {
|
|
16757
16774
|
const index = pending[p];
|
|
16758
|
-
if (((
|
|
16775
|
+
if (((_a2 = src[index].keys) === null || _a2 === void 0 ? void 0 : _a2.length) === 0)
|
|
16759
16776
|
writer.verbatim(index);
|
|
16760
16777
|
}
|
|
16761
16778
|
};
|
|
16762
16779
|
const emitLive = (node) => {
|
|
16763
|
-
var
|
|
16780
|
+
var _a2;
|
|
16764
16781
|
const type = node.type.name;
|
|
16765
16782
|
const pairAt = pending.findIndex((index2) => {
|
|
16766
|
-
var
|
|
16783
|
+
var _a3;
|
|
16767
16784
|
const child = src[index2];
|
|
16768
|
-
return child.keys !== null && child.keys.length > 0 && ((
|
|
16785
|
+
return child.keys !== null && child.keys.length > 0 && ((_a3 = child.node) === null || _a3 === void 0 ? void 0 : _a3.type.name) === type;
|
|
16769
16786
|
});
|
|
16770
16787
|
if (pairAt === -1) {
|
|
16771
16788
|
writer.canonical(this.renderCanonical(node, liveIndex, frame), type);
|
|
@@ -16774,7 +16791,7 @@ ${prefix}`;
|
|
|
16774
16791
|
flushZeroKeys(pairAt);
|
|
16775
16792
|
const index = pending[pairAt];
|
|
16776
16793
|
pending.splice(0, pairAt + 1);
|
|
16777
|
-
const localized = (
|
|
16794
|
+
const localized = (_a2 = this.tryRecurse(level, node, src[index], frame)) !== null && _a2 !== void 0 ? _a2 : this.tryPatchParagraph(level, node, src[index], index === 0);
|
|
16778
16795
|
if (localized !== null)
|
|
16779
16796
|
writer.recursed(index, localized, type);
|
|
16780
16797
|
else
|
|
@@ -16821,7 +16838,7 @@ ${prefix}`;
|
|
|
16821
16838
|
return writer.finish();
|
|
16822
16839
|
}
|
|
16823
16840
|
tryRecurse(level, live, child, frame) {
|
|
16824
|
-
var
|
|
16841
|
+
var _a2;
|
|
16825
16842
|
const base = child.node;
|
|
16826
16843
|
if (!base || base.type.name !== live.type.name)
|
|
16827
16844
|
return null;
|
|
@@ -16872,7 +16889,7 @@ ${prefix}`;
|
|
|
16872
16889
|
kind,
|
|
16873
16890
|
open,
|
|
16874
16891
|
close,
|
|
16875
|
-
indent: continuation !== null && continuation !== void 0 ? continuation : kind === "jsx" && !/^[ \t]*$/.test(prefix) ? containerIndent + " ".repeat((
|
|
16892
|
+
indent: continuation !== null && continuation !== void 0 ? continuation : kind === "jsx" && !/^[ \t]*$/.test(prefix) ? containerIndent + " ".repeat((_a2 = this.ser.indentSize) !== null && _a2 !== void 0 ? _a2 : 2) : prefix.replace(/\S/g, " "),
|
|
16876
16893
|
containerIndent,
|
|
16877
16894
|
sepBody: this.separatorBody(srcKids, kind),
|
|
16878
16895
|
list
|
|
@@ -16951,11 +16968,11 @@ ${prefix}`;
|
|
|
16951
16968
|
return Object.assign(Object.assign({ mdast: element }, span), { keys: child.keys, node: child.node, nodes: child.nodes });
|
|
16952
16969
|
}
|
|
16953
16970
|
separatorBody(srcKids, kind) {
|
|
16954
|
-
var
|
|
16971
|
+
var _a2;
|
|
16955
16972
|
var _b;
|
|
16956
16973
|
if (srcKids.length >= 2) {
|
|
16957
16974
|
const between = this.source.slice(srcKids[0].end, srcKids[1].start);
|
|
16958
|
-
const newlines = (_b = (
|
|
16975
|
+
const newlines = (_b = (_a2 = between.match(/\n/g)) === null || _a2 === void 0 ? void 0 : _a2.length) !== null && _b !== void 0 ? _b : 0;
|
|
16959
16976
|
if (newlines >= 1)
|
|
16960
16977
|
return newlines >= 2 ? "\n\n" : "\n";
|
|
16961
16978
|
}
|
|
@@ -16999,11 +17016,11 @@ ${prefix}`;
|
|
|
16999
17016
|
return null;
|
|
17000
17017
|
}
|
|
17001
17018
|
renderCanonical(node, liveIndex, frame) {
|
|
17002
|
-
var
|
|
17019
|
+
var _a2;
|
|
17003
17020
|
if (!frame.list)
|
|
17004
17021
|
return serializeNodeWithDelim(node, this.ser, frame.indent);
|
|
17005
17022
|
const { list } = frame;
|
|
17006
|
-
const number = (
|
|
17023
|
+
const number = (_a2 = list.fixedNumber) !== null && _a2 !== void 0 ? _a2 : list.start + liveIndex;
|
|
17007
17024
|
const checked = node.attrs.checked;
|
|
17008
17025
|
const task = checked == null ? "" : checked ? "[x] " : "[ ] ";
|
|
17009
17026
|
const prefix = (list.ordered ? `${number}${list.delimiter} ` : `${list.delimiter} `) + task;
|
|
@@ -17013,7 +17030,7 @@ ${prefix}`;
|
|
|
17013
17030
|
return prefix + body;
|
|
17014
17031
|
}
|
|
17015
17032
|
emitTable(live, child) {
|
|
17016
|
-
var
|
|
17033
|
+
var _a2;
|
|
17017
17034
|
const base = child.node;
|
|
17018
17035
|
const rows = child.mdast.children;
|
|
17019
17036
|
if (!rows || rows.length === 0 || rows.length !== base.childCount || live.childCount === 0) {
|
|
@@ -17050,7 +17067,7 @@ ${prefix}`;
|
|
|
17050
17067
|
const header = srcRows[0];
|
|
17051
17068
|
const indent = this.linePrefix(header.start).replace(/\S/g, " ");
|
|
17052
17069
|
const afterHeader = this.source.slice(header.end, srcRows.length >= 2 ? srcRows[1].start : child.end);
|
|
17053
|
-
const delimiter = (
|
|
17070
|
+
const delimiter = (_a2 = /^\n[^\n]*/.exec(afterHeader)) === null || _a2 === void 0 ? void 0 : _a2[0];
|
|
17054
17071
|
if (!delimiter)
|
|
17055
17072
|
return null;
|
|
17056
17073
|
const afterDelimiter = header.end + delimiter.length;
|
|
@@ -17142,11 +17159,11 @@ function appendYamlLines(yaml2, lines) {
|
|
|
17142
17159
|
return `${yaml2.slice(0, fence.index)}${newline}${lines.replace(/\n/g, newline)}${yaml2.slice(fence.index)}`;
|
|
17143
17160
|
}
|
|
17144
17161
|
function verifiedYamlAppend(yaml2, lines, record) {
|
|
17145
|
-
var
|
|
17162
|
+
var _a2;
|
|
17146
17163
|
const appended = appendYamlLines(yaml2, lines);
|
|
17147
17164
|
if (appended === null || record === void 0)
|
|
17148
17165
|
return null;
|
|
17149
|
-
const body = (
|
|
17166
|
+
const body = (_a2 = /^---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*$/.exec(appended)) === null || _a2 === void 0 ? void 0 : _a2[1];
|
|
17150
17167
|
if (body === void 0)
|
|
17151
17168
|
return null;
|
|
17152
17169
|
let parsed;
|
|
@@ -17229,7 +17246,7 @@ function blockKey(node, serializerOptions) {
|
|
|
17229
17246
|
try {
|
|
17230
17247
|
const wrapped = node.type.schema.topNodeType.create(null, [node]);
|
|
17231
17248
|
return pmToMdx(wrapped, Object.assign(Object.assign({}, serializerOptions), { removeTrailingNewline: true }));
|
|
17232
|
-
} catch (
|
|
17249
|
+
} catch (_a2) {
|
|
17233
17250
|
return JSON.stringify(node.toJSON());
|
|
17234
17251
|
}
|
|
17235
17252
|
}
|
|
@@ -17242,7 +17259,7 @@ function computeLineStarts(source) {
|
|
|
17242
17259
|
return starts;
|
|
17243
17260
|
}
|
|
17244
17261
|
function buildLineMap(sanitized, preprocessed) {
|
|
17245
|
-
var
|
|
17262
|
+
var _a2, _b;
|
|
17246
17263
|
const from = sanitized.split("\n");
|
|
17247
17264
|
const to = preprocessed.split("\n");
|
|
17248
17265
|
const map = [];
|
|
@@ -17254,7 +17271,7 @@ function buildLineMap(sanitized, preprocessed) {
|
|
|
17254
17271
|
j++;
|
|
17255
17272
|
continue;
|
|
17256
17273
|
}
|
|
17257
|
-
if (JSX_HEADING_OPEN.test((
|
|
17274
|
+
if (JSX_HEADING_OPEN.test((_a2 = to[j]) !== null && _a2 !== void 0 ? _a2 : "") && JSX_HEADING_CLOSE.test((_b = to[j + 2]) !== null && _b !== void 0 ? _b : "")) {
|
|
17258
17275
|
map.push(i, i, i);
|
|
17259
17276
|
i++;
|
|
17260
17277
|
j += 3;
|
|
@@ -17332,10 +17349,10 @@ function mdastToMdx(mdast) {
|
|
|
17332
17349
|
|
|
17333
17350
|
// ../editor/dist/converter/diff/diff-docs.js
|
|
17334
17351
|
var diffDocs = (oldDoc, newDoc, schema) => {
|
|
17335
|
-
var
|
|
17352
|
+
var _a2, _b;
|
|
17336
17353
|
if (deepEqual(oldDoc, newDoc))
|
|
17337
17354
|
return [];
|
|
17338
|
-
const oldChildren = (
|
|
17355
|
+
const oldChildren = (_a2 = oldDoc.content) !== null && _a2 !== void 0 ? _a2 : [];
|
|
17339
17356
|
const newChildren = (_b = newDoc.content) !== null && _b !== void 0 ? _b : [];
|
|
17340
17357
|
const steps = diffChildLists(oldChildren, newChildren, 0, schema);
|
|
17341
17358
|
return mergeAdjacentSteps(steps);
|
|
@@ -17439,12 +17456,12 @@ var alignmentToSteps = (alignment, oldNodes, newNodes, baseOffset, schema) => {
|
|
|
17439
17456
|
return steps;
|
|
17440
17457
|
};
|
|
17441
17458
|
var diffSingleNode = (oldNode, newNode, oldPos, schema) => {
|
|
17442
|
-
var
|
|
17459
|
+
var _a2, _b;
|
|
17443
17460
|
if (oldNode.type !== newNode.type)
|
|
17444
17461
|
return null;
|
|
17445
17462
|
if (isLeaf(oldNode.type, schema) || isTextblock(oldNode.type, schema))
|
|
17446
17463
|
return null;
|
|
17447
|
-
const oldContent = (
|
|
17464
|
+
const oldContent = (_a2 = oldNode.content) !== null && _a2 !== void 0 ? _a2 : [];
|
|
17448
17465
|
const newContent = (_b = newNode.content) !== null && _b !== void 0 ? _b : [];
|
|
17449
17466
|
if (!attrsEqual(oldNode.attrs, newNode.attrs))
|
|
17450
17467
|
return null;
|
|
@@ -17459,9 +17476,9 @@ var alignNodes = (oldNodes, newNodes, schema) => {
|
|
|
17459
17476
|
const n = newNodes.length;
|
|
17460
17477
|
const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
|
|
17461
17478
|
const cell = (r, c) => {
|
|
17462
|
-
var
|
|
17479
|
+
var _a2;
|
|
17463
17480
|
var _b;
|
|
17464
|
-
return (_b = (
|
|
17481
|
+
return (_b = (_a2 = dp[r]) === null || _a2 === void 0 ? void 0 : _a2[c]) !== null && _b !== void 0 ? _b : 0;
|
|
17465
17482
|
};
|
|
17466
17483
|
for (let i2 = 1; i2 <= m; i2++) {
|
|
17467
17484
|
const row = dp[i2];
|
|
@@ -17516,12 +17533,12 @@ var mergeAdjacentSteps = (steps) => {
|
|
|
17516
17533
|
|
|
17517
17534
|
// ../editor/dist/converter/merge/merge-remote-into-live-doc.js
|
|
17518
17535
|
function cloneNode(node) {
|
|
17519
|
-
var
|
|
17520
|
-
return Object.assign(Object.assign({}, node), { attrs: node.attrs ? Object.assign({}, node.attrs) : void 0, marks: (
|
|
17536
|
+
var _a2, _b;
|
|
17537
|
+
return Object.assign(Object.assign({}, node), { attrs: node.attrs ? Object.assign({}, node.attrs) : void 0, marks: (_a2 = node.marks) === null || _a2 === void 0 ? void 0 : _a2.map((mark) => Object.assign(Object.assign({}, mark), { attrs: mark.attrs ? Object.assign({}, mark.attrs) : void 0 })), content: (_b = node.content) === null || _b === void 0 ? void 0 : _b.map((child) => cloneNode(child)) });
|
|
17521
17538
|
}
|
|
17522
17539
|
function cloneNodeShell(node) {
|
|
17523
|
-
var
|
|
17524
|
-
return Object.assign({ type: node.type, attrs: node.attrs ? Object.assign({}, node.attrs) : void 0, marks: (
|
|
17540
|
+
var _a2;
|
|
17541
|
+
return Object.assign({ type: node.type, attrs: node.attrs ? Object.assign({}, node.attrs) : void 0, marks: (_a2 = node.marks) === null || _a2 === void 0 ? void 0 : _a2.map((mark) => Object.assign(Object.assign({}, mark), { attrs: mark.attrs ? Object.assign({}, mark.attrs) : void 0 })) }, node.text != null ? { text: node.text } : {});
|
|
17525
17542
|
}
|
|
17526
17543
|
function getNodeTextSimilarity(a, b) {
|
|
17527
17544
|
return textSimilarity(extractText(a), extractText(b));
|
|
@@ -17583,9 +17600,9 @@ function shiftAnnotations(annotations, childIndex) {
|
|
|
17583
17600
|
return annotations.map((annotation) => Object.assign({ path: [childIndex, ...annotation.path], type: annotation.type }, annotation.hunk ? { hunk: annotation.hunk } : {}));
|
|
17584
17601
|
}
|
|
17585
17602
|
function mergeTextblockNodes(baseNode, localNode, remoteNode) {
|
|
17586
|
-
var
|
|
17603
|
+
var _a2, _b;
|
|
17587
17604
|
var _c, _d;
|
|
17588
|
-
const localContent = (_c = (
|
|
17605
|
+
const localContent = (_c = (_a2 = localNode.content) === null || _a2 === void 0 ? void 0 : _a2.map((child) => cloneNode(child))) !== null && _c !== void 0 ? _c : [];
|
|
17589
17606
|
const remoteContent = (_d = (_b = remoteNode.content) === null || _b === void 0 ? void 0 : _b.map((child) => cloneNode(child))) !== null && _d !== void 0 ? _d : [];
|
|
17590
17607
|
const localText = extractText(localNode);
|
|
17591
17608
|
const remoteText = extractText(remoteNode);
|
|
@@ -17682,7 +17699,7 @@ function blockContentKey(block, schema, cache) {
|
|
|
17682
17699
|
let key;
|
|
17683
17700
|
try {
|
|
17684
17701
|
key = pmToMdx(schema.nodeFromJSON({ type: "doc", content: [block] }));
|
|
17685
|
-
} catch (
|
|
17702
|
+
} catch (_a2) {
|
|
17686
17703
|
key = JSON.stringify(block);
|
|
17687
17704
|
}
|
|
17688
17705
|
cache.set(block, key);
|
|
@@ -17714,14 +17731,14 @@ function buildLongestCommonSubsequenceLengths(localRange, remoteRange, schema, c
|
|
|
17714
17731
|
return longestCommonSubsequenceLengths;
|
|
17715
17732
|
}
|
|
17716
17733
|
function shouldPreferLocalInsertion(longestCommonSubsequenceLengths, localIndex, remoteIndex) {
|
|
17717
|
-
var
|
|
17734
|
+
var _a2, _b;
|
|
17718
17735
|
var _c, _d;
|
|
17719
|
-
const skipLocalScore = (_c = (
|
|
17736
|
+
const skipLocalScore = (_c = (_a2 = longestCommonSubsequenceLengths[localIndex + 1]) === null || _a2 === void 0 ? void 0 : _a2[remoteIndex]) !== null && _c !== void 0 ? _c : 0;
|
|
17720
17737
|
const skipRemoteScore = (_d = (_b = longestCommonSubsequenceLengths[localIndex]) === null || _b === void 0 ? void 0 : _b[remoteIndex + 1]) !== null && _d !== void 0 ? _d : 0;
|
|
17721
17738
|
return skipLocalScore >= skipRemoteScore;
|
|
17722
17739
|
}
|
|
17723
17740
|
function mergeChildren(baseChildren, localChildren, remoteChildren, schema) {
|
|
17724
|
-
var
|
|
17741
|
+
var _a2, _b;
|
|
17725
17742
|
const nodes2 = [];
|
|
17726
17743
|
const annotations = [];
|
|
17727
17744
|
const contentKeyCache = /* @__PURE__ */ new Map();
|
|
@@ -17786,7 +17803,7 @@ function mergeChildren(baseChildren, localChildren, remoteChildren, schema) {
|
|
|
17786
17803
|
let remoteCursor = 0;
|
|
17787
17804
|
for (let i = 0; i < baseChildren.length; i += 1) {
|
|
17788
17805
|
const baseChild = baseChildren[i];
|
|
17789
|
-
const localMatch = (
|
|
17806
|
+
const localMatch = (_a2 = localMatches[i]) !== null && _a2 !== void 0 ? _a2 : null;
|
|
17790
17807
|
const remoteMatch = (_b = remoteMatches[i]) !== null && _b !== void 0 ? _b : null;
|
|
17791
17808
|
appendMergedRange(localCursor, localMatch !== null && localMatch !== void 0 ? localMatch : localCursor, remoteCursor, remoteMatch !== null && remoteMatch !== void 0 ? remoteMatch : remoteCursor);
|
|
17792
17809
|
const localNode = localMatch == null ? void 0 : localChildren[localMatch];
|
|
@@ -17803,9 +17820,9 @@ function mergeChildren(baseChildren, localChildren, remoteChildren, schema) {
|
|
|
17803
17820
|
return { nodes: nodes2, annotations };
|
|
17804
17821
|
}
|
|
17805
17822
|
function mergeRemoteIntoLiveDoc(params) {
|
|
17806
|
-
var
|
|
17823
|
+
var _a2, _b, _c;
|
|
17807
17824
|
const { baseDoc, localDoc, remoteDoc, schema } = params;
|
|
17808
|
-
const baseChildren = (
|
|
17825
|
+
const baseChildren = (_a2 = baseDoc.content) !== null && _a2 !== void 0 ? _a2 : [];
|
|
17809
17826
|
const localChildren = (_b = localDoc.content) !== null && _b !== void 0 ? _b : [];
|
|
17810
17827
|
const remoteChildren = (_c = remoteDoc.content) !== null && _c !== void 0 ? _c : [];
|
|
17811
17828
|
const mergedChildren = mergeChildren(baseChildren, localChildren, remoteChildren, schema);
|