@qualcomm-ui/mdx-vite 2.15.0 → 2.16.0
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/dist/ai-knowledge/generator/doc-props-plugin.d.ts +1 -1
- package/dist/ai-knowledge/generator/doc-props-plugin.d.ts.map +1 -1
- package/dist/ai-knowledge/generator/section-extractor.d.ts +2 -3
- package/dist/ai-knowledge/generator/section-extractor.d.ts.map +1 -1
- package/dist/ai-knowledge/generator/section.types.d.ts +20 -7
- package/dist/ai-knowledge/generator/section.types.d.ts.map +1 -1
- package/dist/cli.js +69 -59
- package/dist/cli.js.map +3 -3
- package/dist/docs-plugin/remark/remark-extract-meta.d.ts +15 -3
- package/dist/docs-plugin/remark/remark-extract-meta.d.ts.map +1 -1
- package/dist/index.js +69 -59
- package/dist/index.js.map +3 -3
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,6 @@ export declare class PropFormatter {
|
|
|
11
11
|
* Creates a remark plugin that replaces TypeDocProps JSX elements with
|
|
12
12
|
* Markdown tables containing component prop documentation.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
propsToMarkdownList(): Plugin;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=doc-props-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-props-plugin.d.ts","sourceRoot":"","sources":["../../../src/ai-knowledge/generator/doc-props-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAWnC,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EAER,cAAc,EACf,MAAM,mBAAmB,CAAA;AAoD1B,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAwB;IAElC,YAAY,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAqC9C,OAAO,CAAC,kBAAkB;IAsC1B,OAAO,CAAC,aAAa;IAoCrB,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,GAAG,cAAc,EAAE;IA0BzE,OAAO,CAAC,eAAe;IAiBvB;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"doc-props-plugin.d.ts","sourceRoot":"","sources":["../../../src/ai-knowledge/generator/doc-props-plugin.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAWnC,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EAER,cAAc,EACf,MAAM,mBAAmB,CAAA;AAoD1B,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAwB;IAElC,YAAY,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAqC9C,OAAO,CAAC,kBAAkB;IAsC1B,OAAO,CAAC,aAAa;IAoCrB,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,GAAG,cAAc,EAAE;IA0BzE,OAAO,CAAC,eAAe;IAiBvB;;;OAGG;IACH,mBAAmB,IAAI,MAAM;CA8F9B"}
|
|
@@ -31,9 +31,8 @@ export declare class SectionExtractor {
|
|
|
31
31
|
extract(tree: Root, pageInfo: PageInfo): SectionEntry[];
|
|
32
32
|
private getHeadingText;
|
|
33
33
|
private buildSectionEntry;
|
|
34
|
-
private
|
|
35
|
-
private
|
|
36
|
-
private parseValue;
|
|
34
|
+
private extractTerms;
|
|
35
|
+
private parseTermsBlock;
|
|
37
36
|
/**
|
|
38
37
|
* Convert links to inline code. URLs are not relevant for text embeddings
|
|
39
38
|
* and will muddy the vector storage.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-extractor.d.ts","sourceRoot":"","sources":["../../../src/ai-knowledge/generator/section-extractor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA8B,IAAI,EAAoB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"section-extractor.d.ts","sourceRoot":"","sources":["../../../src/ai-knowledge/generator/section-extractor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAA8B,IAAI,EAAoB,MAAM,OAAO,CAAA;AAQ/E,OAAO,KAAK,EAAc,YAAY,EAAe,MAAM,iBAAiB,CAAA;AAG5E,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IAEjB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAaD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;gBAE7B,OAAO,CAAC,EAAE,uBAAuB;IAM7C;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,YAAY,EAAE;IAyDvD,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iBAAiB;IAgEzB,OAAO,CAAC,YAAY;IAwCpB,OAAO,CAAC,eAAe;IAYvB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,gBAAgB;CAGzB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SimplifiedProp } from "./generator.types";
|
|
1
2
|
/**
|
|
2
3
|
* A code example extracted from a section.
|
|
3
4
|
*/
|
|
@@ -12,16 +13,24 @@ export interface CodeExample {
|
|
|
12
13
|
language: string;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
* Metadata extracted from :::
|
|
16
|
+
* Metadata extracted from ::: terms ::: blocks within a section.
|
|
16
17
|
*/
|
|
17
18
|
export interface SectionMetadata {
|
|
18
19
|
[key: string]: string | string[] | undefined;
|
|
19
20
|
category?: string;
|
|
20
21
|
component?: string;
|
|
21
|
-
keywords?: string[];
|
|
22
|
-
props?: string[];
|
|
23
22
|
type?: string;
|
|
24
23
|
}
|
|
24
|
+
export interface SectionTypes {
|
|
25
|
+
/**
|
|
26
|
+
* Props extracted from the TypeDoc code block.
|
|
27
|
+
*/
|
|
28
|
+
props: SimplifiedProp[];
|
|
29
|
+
/**
|
|
30
|
+
* Name of the type, interface, or class.
|
|
31
|
+
*/
|
|
32
|
+
type: string;
|
|
33
|
+
}
|
|
25
34
|
/**
|
|
26
35
|
* A single section entry extracted from documentation.
|
|
27
36
|
*/
|
|
@@ -44,10 +53,6 @@ export interface SectionEntry {
|
|
|
44
53
|
* @example ["Button", "Examples", "Variants"]
|
|
45
54
|
*/
|
|
46
55
|
headerPath: string[];
|
|
47
|
-
/**
|
|
48
|
-
* Metadata extracted from ::: meta ::: blocks within this section.
|
|
49
|
-
*/
|
|
50
|
-
metadata?: SectionMetadata;
|
|
51
56
|
/**
|
|
52
57
|
* Frontmatter from the source page.
|
|
53
58
|
*/
|
|
@@ -65,6 +70,14 @@ export interface SectionEntry {
|
|
|
65
70
|
* @example "button-examples-variants"
|
|
66
71
|
*/
|
|
67
72
|
sectionId: string;
|
|
73
|
+
/**
|
|
74
|
+
* Search terms extracted from ::: terms ::: blocks within this section.
|
|
75
|
+
*/
|
|
76
|
+
terms?: string[];
|
|
77
|
+
/**
|
|
78
|
+
* Name of the types or interfaces described by typeDocProps in this section.
|
|
79
|
+
*/
|
|
80
|
+
types?: SectionTypes[];
|
|
68
81
|
/**
|
|
69
82
|
* URL with anchor to this specific section.
|
|
70
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section.types.d.ts","sourceRoot":"","sources":["../../../src/ai-knowledge/generator/section.types.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,
|
|
1
|
+
{"version":3,"file":"section.types.d.ts","sourceRoot":"","sources":["../../../src/ai-knowledge/generator/section.types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAA;AAErD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,cAAc,EAAE,CAAA;IAEvB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;IAE5B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,UAAU,EAAE,MAAM,EAAE,CAAA;IAEpB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAEzC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,YAAY,EAAE,CAAA;IAEtB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,CAAC,CAAA;CACX"}
|
package/dist/cli.js
CHANGED
|
@@ -5441,6 +5441,9 @@ function parseMetaContent(content) {
|
|
|
5441
5441
|
}
|
|
5442
5442
|
return result;
|
|
5443
5443
|
}
|
|
5444
|
+
function parseTermsContent(content) {
|
|
5445
|
+
return content.split("\n").map((line) => line.trim()).filter((line) => line && line !== ":::");
|
|
5446
|
+
}
|
|
5444
5447
|
var remarkExtractMeta = (metadata = {}) => {
|
|
5445
5448
|
return (tree) => {
|
|
5446
5449
|
const nodesToRemove = [];
|
|
@@ -5453,16 +5456,27 @@ var remarkExtractMeta = (metadata = {}) => {
|
|
|
5453
5456
|
return;
|
|
5454
5457
|
}
|
|
5455
5458
|
const text = firstChild.value;
|
|
5456
|
-
const
|
|
5457
|
-
|
|
5459
|
+
const metaMatch = text.match(/^:::\s*meta\s*/);
|
|
5460
|
+
const termsMatch = text.match(/^:::\s*terms\s*/);
|
|
5461
|
+
if (!metaMatch && !termsMatch) {
|
|
5458
5462
|
return;
|
|
5459
5463
|
}
|
|
5464
|
+
const openMatch = metaMatch || termsMatch;
|
|
5465
|
+
const isTermsBlock = !!termsMatch;
|
|
5460
5466
|
if (text.includes(":::") && text.lastIndexOf(":::") > openMatch[0].length) {
|
|
5461
5467
|
const afterOpen = text.slice(openMatch[0].length);
|
|
5462
5468
|
const closeIndex = afterOpen.lastIndexOf(":::");
|
|
5463
5469
|
const content = afterOpen.slice(0, closeIndex);
|
|
5464
|
-
|
|
5465
|
-
|
|
5470
|
+
if (isTermsBlock) {
|
|
5471
|
+
const terms = parseTermsContent(content);
|
|
5472
|
+
if (terms.length > 0) {
|
|
5473
|
+
const existing = metadata.terms;
|
|
5474
|
+
metadata.terms = Array.isArray(existing) ? [...existing, ...terms] : terms;
|
|
5475
|
+
}
|
|
5476
|
+
} else {
|
|
5477
|
+
const parsed = parseMetaContent(content);
|
|
5478
|
+
Object.assign(metadata, parsed);
|
|
5479
|
+
}
|
|
5466
5480
|
nodesToRemove.push({ index, parent });
|
|
5467
5481
|
return SKIP;
|
|
5468
5482
|
}
|
|
@@ -5477,8 +5491,16 @@ var remarkExtractMeta = (metadata = {}) => {
|
|
|
5477
5491
|
const closeIndexFull = afterOpenFull.lastIndexOf(":::");
|
|
5478
5492
|
if (closeIndexFull !== -1) {
|
|
5479
5493
|
const content = afterOpenFull.slice(0, closeIndexFull);
|
|
5480
|
-
|
|
5481
|
-
|
|
5494
|
+
if (isTermsBlock) {
|
|
5495
|
+
const terms = parseTermsContent(content);
|
|
5496
|
+
if (terms.length > 0) {
|
|
5497
|
+
const existing = metadata.terms;
|
|
5498
|
+
metadata.terms = Array.isArray(existing) ? [...existing, ...terms] : terms;
|
|
5499
|
+
}
|
|
5500
|
+
} else {
|
|
5501
|
+
const parsed = parseMetaContent(content);
|
|
5502
|
+
Object.assign(metadata, parsed);
|
|
5503
|
+
}
|
|
5482
5504
|
nodesToRemove.push({ index, parent });
|
|
5483
5505
|
return SKIP;
|
|
5484
5506
|
}
|
|
@@ -5889,7 +5911,7 @@ ${tagContent.trim()}
|
|
|
5889
5911
|
* Creates a remark plugin that replaces TypeDocProps JSX elements with
|
|
5890
5912
|
* Markdown tables containing component prop documentation.
|
|
5891
5913
|
*/
|
|
5892
|
-
|
|
5914
|
+
propsToMarkdownList() {
|
|
5893
5915
|
return () => (tree, _file, done) => {
|
|
5894
5916
|
visit7(
|
|
5895
5917
|
tree,
|
|
@@ -5928,15 +5950,18 @@ ${tagContent.trim()}
|
|
|
5928
5950
|
}
|
|
5929
5951
|
return;
|
|
5930
5952
|
}
|
|
5931
|
-
const
|
|
5953
|
+
const propTypes = this.extractProps(
|
|
5954
|
+
componentProps,
|
|
5955
|
+
Boolean(isPartial)
|
|
5956
|
+
);
|
|
5932
5957
|
if (getConfig().verbose) {
|
|
5933
5958
|
console.log(
|
|
5934
5959
|
` Replaced TypeDocProps ${propsName} with API documentation`
|
|
5935
5960
|
);
|
|
5936
5961
|
}
|
|
5937
|
-
const regularProps =
|
|
5938
|
-
const inputs =
|
|
5939
|
-
const outputs =
|
|
5962
|
+
const regularProps = propTypes.filter((p) => p.propType === void 0);
|
|
5963
|
+
const inputs = propTypes.filter((p) => p.propType === "input");
|
|
5964
|
+
const outputs = propTypes.filter((p) => p.propType === "output");
|
|
5940
5965
|
const sections = [];
|
|
5941
5966
|
if (regularProps.length > 0) {
|
|
5942
5967
|
sections.push(propsToDefinitionList(regularProps));
|
|
@@ -5958,9 +5983,8 @@ ${propsToDefinitionList(outputs)}`);
|
|
|
5958
5983
|
}
|
|
5959
5984
|
return;
|
|
5960
5985
|
}
|
|
5961
|
-
const propNames = propsDoc.map((p) => p.name);
|
|
5962
5986
|
Object.assign(node, {
|
|
5963
|
-
data: { typeDocProps: { name: propsName, props:
|
|
5987
|
+
data: { typeDocProps: { name: propsName, props: propTypes } },
|
|
5964
5988
|
lang: null,
|
|
5965
5989
|
meta: null,
|
|
5966
5990
|
type: "code",
|
|
@@ -6161,19 +6185,19 @@ var SectionExtractor = class {
|
|
|
6161
6185
|
return text.trim();
|
|
6162
6186
|
}
|
|
6163
6187
|
buildSectionEntry(section, pageInfo) {
|
|
6164
|
-
const {
|
|
6188
|
+
const { nodes, terms } = this.extractTerms(section.nodes);
|
|
6165
6189
|
if (nodes.length === 0) {
|
|
6166
6190
|
return null;
|
|
6167
6191
|
}
|
|
6168
6192
|
const contentNodes = [];
|
|
6169
6193
|
const codeExamples = [];
|
|
6194
|
+
const sectionTypes = [];
|
|
6170
6195
|
for (const node of nodes) {
|
|
6171
6196
|
if (node.type === "code") {
|
|
6172
6197
|
const codeNode = node;
|
|
6173
6198
|
if (codeNode.data?.typeDocProps) {
|
|
6174
6199
|
const { name, props } = codeNode.data.typeDocProps;
|
|
6175
|
-
|
|
6176
|
-
metadata.type = name;
|
|
6200
|
+
sectionTypes.push({ props, type: name });
|
|
6177
6201
|
}
|
|
6178
6202
|
codeExamples.push({
|
|
6179
6203
|
code: codeNode.value,
|
|
@@ -6189,71 +6213,57 @@ var SectionExtractor = class {
|
|
|
6189
6213
|
const url = pageInfo.url ? `${pageInfo.url}#${this.generateAnchorId(section.headerPath.at(-1) ?? "")}` : void 0;
|
|
6190
6214
|
const hashData = {
|
|
6191
6215
|
headerPath: section.headerPath,
|
|
6192
|
-
metadata: Object.keys(metadata).length ? metadata : void 0,
|
|
6193
6216
|
pageFrontmatter: Object.keys(pageInfo.frontmatter).length ? pageInfo.frontmatter : void 0,
|
|
6194
6217
|
pageId: pageInfo.id,
|
|
6195
|
-
rawContent: rawContent.trim()
|
|
6218
|
+
rawContent: rawContent.trim(),
|
|
6219
|
+
terms: terms.length ? terms : void 0,
|
|
6220
|
+
types: sectionTypes.length ? sectionTypes : void 0,
|
|
6221
|
+
url
|
|
6196
6222
|
};
|
|
6197
|
-
const sectionHash = JSON.stringify(hashData);
|
|
6223
|
+
const sectionHash = computeMd5(JSON.stringify(hashData));
|
|
6198
6224
|
return {
|
|
6199
6225
|
...hashData,
|
|
6200
6226
|
codeExamples: codeExamples.length ? codeExamples : void 0,
|
|
6201
6227
|
content: content.trim(),
|
|
6202
6228
|
hash: sectionHash,
|
|
6203
|
-
sectionId
|
|
6204
|
-
url
|
|
6229
|
+
sectionId
|
|
6205
6230
|
};
|
|
6206
6231
|
}
|
|
6207
|
-
|
|
6208
|
-
const metadata = {};
|
|
6232
|
+
extractTerms(nodes) {
|
|
6209
6233
|
const filteredNodes = [];
|
|
6234
|
+
const terms = [];
|
|
6210
6235
|
for (const node of nodes) {
|
|
6211
6236
|
if (node.type === "paragraph") {
|
|
6212
|
-
const
|
|
6237
|
+
const children = node.children ?? [];
|
|
6238
|
+
const firstChild = children[0];
|
|
6213
6239
|
if (firstChild?.type === "text") {
|
|
6214
|
-
const
|
|
6215
|
-
const
|
|
6216
|
-
if (
|
|
6217
|
-
|
|
6218
|
-
|
|
6240
|
+
const firstText = firstChild.value;
|
|
6241
|
+
const termsMatch = firstText.match(/^:::\s*terms\s*/);
|
|
6242
|
+
if (termsMatch) {
|
|
6243
|
+
let fullText = firstText;
|
|
6244
|
+
for (let i = 1; i < children.length; i++) {
|
|
6245
|
+
const child = children[i];
|
|
6246
|
+
if (child.type === "text") {
|
|
6247
|
+
fullText += child.value;
|
|
6248
|
+
} else if (child.type === "softBreak") {
|
|
6249
|
+
fullText += "\n";
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6252
|
+
const parsedTerms = this.parseTermsBlock(fullText);
|
|
6253
|
+
terms.push(...parsedTerms);
|
|
6219
6254
|
continue;
|
|
6220
6255
|
}
|
|
6221
6256
|
}
|
|
6222
6257
|
}
|
|
6223
6258
|
filteredNodes.push(node);
|
|
6224
6259
|
}
|
|
6225
|
-
return {
|
|
6260
|
+
return { nodes: filteredNodes, terms };
|
|
6226
6261
|
}
|
|
6227
|
-
|
|
6228
|
-
const
|
|
6229
|
-
const afterOpen = text.replace(/^:::\s*meta\s*/, "");
|
|
6262
|
+
parseTermsBlock(text) {
|
|
6263
|
+
const afterOpen = text.replace(/^:::\s*terms\s*/, "");
|
|
6230
6264
|
const closeIndex = afterOpen.lastIndexOf(":::");
|
|
6231
6265
|
const content = closeIndex !== -1 ? afterOpen.slice(0, closeIndex) : afterOpen;
|
|
6232
|
-
|
|
6233
|
-
for (const line of lines) {
|
|
6234
|
-
const trimmed = line.trim();
|
|
6235
|
-
if (!trimmed) {
|
|
6236
|
-
continue;
|
|
6237
|
-
}
|
|
6238
|
-
const colonIndex = trimmed.indexOf(":");
|
|
6239
|
-
if (colonIndex === -1) {
|
|
6240
|
-
continue;
|
|
6241
|
-
}
|
|
6242
|
-
const key = trimmed.slice(0, colonIndex).trim();
|
|
6243
|
-
const value = trimmed.slice(colonIndex + 1).trim();
|
|
6244
|
-
if (key && value) {
|
|
6245
|
-
metadata[key] = this.parseValue(value);
|
|
6246
|
-
}
|
|
6247
|
-
}
|
|
6248
|
-
return metadata;
|
|
6249
|
-
}
|
|
6250
|
-
parseValue(value) {
|
|
6251
|
-
const trimmed = value.trim();
|
|
6252
|
-
if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
6253
|
-
const inner = trimmed.slice(1, -1);
|
|
6254
|
-
return inner.split(",").map((item) => item.trim()).filter(Boolean);
|
|
6255
|
-
}
|
|
6256
|
-
return trimmed;
|
|
6266
|
+
return content.split("\n").map((line) => line.trim()).filter((line) => line && line !== ":::");
|
|
6257
6267
|
}
|
|
6258
6268
|
/**
|
|
6259
6269
|
* Convert links to inline code. URLs are not relevant for text embeddings
|
|
@@ -6496,7 +6506,7 @@ var KnowledgeGenerator = class {
|
|
|
6496
6506
|
* into Markdown, resolving relative links, and cleaning up formatting.
|
|
6497
6507
|
*/
|
|
6498
6508
|
async processMdxContent(mdxContent, pageInfo, frontmatter) {
|
|
6499
|
-
const processor = unified5().use(remarkParse4).use(remarkMdx3).use(remarkFrontmatter2, ["yaml"]).use(this.propFormatter.
|
|
6509
|
+
const processor = unified5().use(remarkParse4).use(remarkMdx3).use(remarkFrontmatter2, ["yaml"]).use(this.propFormatter.propsToMarkdownList()).use(this.formatFrontmatterExpressions(frontmatter)).use(await formatThemeNodes()).use(formatDemos(pageInfo.demosFolder)).use(this.transformRelativeUrls(pageInfo.url));
|
|
6500
6510
|
this.applyPlugins(pageInfo, processor);
|
|
6501
6511
|
processor.use(remarkStringify4);
|
|
6502
6512
|
return await processor.run(processor.parse(mdxContent));
|