rspress-plugin-api-extractor 0.8.1 → 0.8.3
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/build-stages.js +2 -1
- package/config-helpers.js +2 -1
- package/llms-program.js +5 -3
- package/markdown/cross-linker.js +3 -2
- package/markdown/helpers.js +4 -2
- package/markdown/page-generators/class-page.js +12 -3
- package/markdown/page-generators/function-page.js +4 -1
- package/markdown/page-generators/interface-page.js +8 -2
- package/markdown/page-generators/namespace-page.js +5 -5
- package/markdown/page-generators/type-alias-page.js +4 -1
- package/markdown/page-generators/variable-page.js +4 -1
- package/observability/sinks/metrics-sink.js +1 -4
- package/package.json +9 -9
- package/plugin.js +2 -1
- package/runtime/components/MarkdownText/index.js +2 -1
- package/runtime/components/MemberSignature/index.css +5 -2
- package/runtime/components/MemberSignature/index.js +20 -17
- package/runtime/components/MemberSignature/index.module.js +1 -0
- package/runtime/components/SignatureBlock/index.css +6 -2
- package/runtime/components/SignatureBlock/index.js +20 -16
- package/runtime/components/SignatureBlock/index.module.js +1 -0
- package/runtime/components/SignatureToolbar/index.css +7 -4
- package/runtime/components/shared/variables.css +6 -2
- package/twoslash-transformer.js +2 -1
package/build-stages.js
CHANGED
|
@@ -355,7 +355,8 @@ function generateSinglePage(workItem, ctx) {
|
|
|
355
355
|
const existingContent = yield* fileSystem.readFileString(absolutePath).pipe(Effect.orElseSucceed(() => null));
|
|
356
356
|
if (existingContent !== null) {
|
|
357
357
|
const { data: existingFrontmatter, content: existingBody } = matter(existingContent);
|
|
358
|
-
const
|
|
358
|
+
const normalizedExistingBody = normalizeMarkdownSpacing(existingBody);
|
|
359
|
+
const existingContentHash = hashContent(normalizedExistingBody);
|
|
359
360
|
const existingFrontmatterHash = hashFrontmatter(existingFrontmatter);
|
|
360
361
|
if (existingContentHash === contentHash && existingFrontmatterHash === frontmatterHash) {
|
|
361
362
|
publishedTime = existingFrontmatter["article:published_time"] || buildTime;
|
package/config-helpers.js
CHANGED
|
@@ -37,7 +37,8 @@ function discoverDir(dir) {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
function resolveBaseRoute(baseRoute, info) {
|
|
40
|
-
|
|
40
|
+
const interpolated = (typeof baseRoute === "function" ? baseRoute(info) : baseRoute).replace(/\{dirname\}/g, info.dirname).replace(/\{packageName\}/g, info.packageName);
|
|
41
|
+
return normalizeBaseRoute(interpolated);
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
43
44
|
* Build a `MultiApiConfig` by discovering fields from a single package folder
|
package/llms-program.js
CHANGED
|
@@ -200,7 +200,7 @@ function processPrefix(fs, outDir, prefix, buildResults, apiRoutes, llmsPlugin,
|
|
|
200
200
|
const llmsFullTxtPath = path.join(prefixDir, "llms-full.txt");
|
|
201
201
|
const llmsFullTxtContent = (yield* fs.exists(llmsFullTxtPath).pipe(Effect.orElseSucceed(() => false))) ? yield* fs.readFileString(llmsFullTxtPath).pipe(Effect.orDie) : "";
|
|
202
202
|
if (llmsPlugin.scopes) {
|
|
203
|
-
const
|
|
203
|
+
const packageScopes = buildResults.map((r) => {
|
|
204
204
|
const pkgRoute = packageRoutes.get(r.packageName) ?? r.baseRoute;
|
|
205
205
|
return {
|
|
206
206
|
name: r.apiName ?? r.packageName,
|
|
@@ -210,10 +210,12 @@ function processPrefix(fs, outDir, prefix, buildResults, apiRoutes, llmsPlugin,
|
|
|
210
210
|
packageRoute: pkgRoute,
|
|
211
211
|
llmsApiTxtUrl: `${pkgRoute.endsWith("/") ? pkgRoute : `${pkgRoute}/`}llms-api.txt`
|
|
212
212
|
};
|
|
213
|
-
})
|
|
213
|
+
});
|
|
214
|
+
const structuredLlmsTxt = generateStructuredLlmsTxt(llmsTxtContent, apiRoutes, packageScopes);
|
|
214
215
|
yield* fs.writeFileString(llmsTxtPath, structuredLlmsTxt).pipe(Effect.orDie);
|
|
215
216
|
} else {
|
|
216
|
-
const
|
|
217
|
+
const pointers = buildPackagePointers(buildResults, prefix, packageRoutes);
|
|
218
|
+
const filteredLlmsTxt = filterLlmsTxt(llmsTxtContent, apiRoutes, pointers);
|
|
217
219
|
yield* fs.writeFileString(llmsTxtPath, filteredLlmsTxt).pipe(Effect.orDie);
|
|
218
220
|
}
|
|
219
221
|
if (llmsFullTxtContent) {
|
package/markdown/cross-linker.js
CHANGED
|
@@ -108,11 +108,12 @@ var MarkdownCrossLinker = class {
|
|
|
108
108
|
*/
|
|
109
109
|
addCrossLinks(text) {
|
|
110
110
|
if (this.apiItemRoutes.size === 0) return text;
|
|
111
|
-
|
|
111
|
+
const refs = Array.from(this.apiItemRoutes.keys()).map((name) => ({
|
|
112
112
|
name,
|
|
113
113
|
kind: "type",
|
|
114
114
|
slug: name.toLowerCase()
|
|
115
|
-
}))
|
|
115
|
+
}));
|
|
116
|
+
return new CrossLinker(refs, (ref) => this.apiItemRoutes.get(ref.name) ?? "").addLinks(text);
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
118
119
|
* Add cross-links to type references in code (HTML format)
|
package/markdown/helpers.js
CHANGED
|
@@ -270,7 +270,8 @@ function stripTwoslashDirectives(code) {
|
|
|
270
270
|
const cutRanges = [];
|
|
271
271
|
const cutStartStack = [];
|
|
272
272
|
for (let i = 0; i < lines.length; i++) {
|
|
273
|
-
const
|
|
273
|
+
const trimmed = lines[i].trim();
|
|
274
|
+
const cutType = classifyCutDirective(trimmed);
|
|
274
275
|
if (cutType === "cut-before") cutBeforeIndex = i;
|
|
275
276
|
else if (cutType === "cut-after") cutAfterIndex = i;
|
|
276
277
|
else if (cutType === "cut-start") cutStartStack.push(i);
|
|
@@ -293,7 +294,8 @@ function stripTwoslashDirectives(code) {
|
|
|
293
294
|
for (const [start, end] of cutRanges) for (let i = start; i <= end; i++) if (i >= 0 && i < filteredLines.length) excludedLines.add(i);
|
|
294
295
|
return filteredLines.filter((line, i) => {
|
|
295
296
|
if (excludedLines.has(i)) return false;
|
|
296
|
-
|
|
297
|
+
const trimmed = line.trim();
|
|
298
|
+
if (isTwoslashDirective(trimmed)) return false;
|
|
297
299
|
return true;
|
|
298
300
|
}).join("\n").trim();
|
|
299
301
|
}
|
|
@@ -231,7 +231,10 @@ var ClassPageGenerator = class {
|
|
|
231
231
|
const signature = this.typeFormatter.format(baseDecl.excerpt).trim();
|
|
232
232
|
let source = signature;
|
|
233
233
|
const apiPackage = apiClass.getAssociatedPackage?.();
|
|
234
|
-
if (apiPackage)
|
|
234
|
+
if (apiPackage) {
|
|
235
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(baseDecl);
|
|
236
|
+
source = prependHiddenImports(signature, imports);
|
|
237
|
+
}
|
|
235
238
|
const displayCode = stripTwoslashDirectives(source);
|
|
236
239
|
section += `<ApiSignature code={${JSON.stringify(displayCode)}} source={${JSON.stringify(source)}} apiScope={${JSON.stringify(apiScope)}} />\n\n`;
|
|
237
240
|
return section;
|
|
@@ -292,7 +295,10 @@ var ClassPageGenerator = class {
|
|
|
292
295
|
const memberSignature = memberItem.excerpt?.text ? this.typeFormatter.format(memberItem.excerpt).trim() : "";
|
|
293
296
|
const skeleton = `${declaration}\n${memberSignature}\n}`;
|
|
294
297
|
const apiPackage = apiClass.getAssociatedPackage?.();
|
|
295
|
-
if (apiPackage)
|
|
298
|
+
if (apiPackage) {
|
|
299
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(targetMember);
|
|
300
|
+
return prependHiddenImports(skeleton, imports);
|
|
301
|
+
}
|
|
296
302
|
return skeleton;
|
|
297
303
|
}
|
|
298
304
|
/**
|
|
@@ -302,7 +308,10 @@ var ClassPageGenerator = class {
|
|
|
302
308
|
generateClassSkeletonWithTwoslash(apiClass, packageName) {
|
|
303
309
|
const skeleton = this.generateClassSkeleton(apiClass);
|
|
304
310
|
const apiPackage = apiClass.getAssociatedPackage?.();
|
|
305
|
-
if (apiPackage)
|
|
311
|
+
if (apiPackage) {
|
|
312
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(apiClass);
|
|
313
|
+
return prependHiddenImports(skeleton, imports);
|
|
314
|
+
}
|
|
306
315
|
return skeleton;
|
|
307
316
|
}
|
|
308
317
|
/**
|
|
@@ -75,7 +75,10 @@ var FunctionPageGenerator = class {
|
|
|
75
75
|
const signature = this.typeFormatter.format(apiFunction.excerpt).trim();
|
|
76
76
|
let signatureWithImports = signature;
|
|
77
77
|
const apiPackage = apiFunction.getAssociatedPackage?.();
|
|
78
|
-
if (apiPackage)
|
|
78
|
+
if (apiPackage) {
|
|
79
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(apiFunction);
|
|
80
|
+
signatureWithImports = prependHiddenImports(signature, imports);
|
|
81
|
+
}
|
|
79
82
|
const displayCode = stripTwoslashDirectives(signatureWithImports);
|
|
80
83
|
content += `<ApiSignature code={${JSON.stringify(displayCode)}} source={${JSON.stringify(signatureWithImports)}} apiScope={${JSON.stringify(apiScope)}} hasParameters={${hasParameters}} />\n\n`;
|
|
81
84
|
}
|
|
@@ -230,7 +230,10 @@ var InterfacePageGenerator = class {
|
|
|
230
230
|
const memberSignature = memberItem.excerpt?.text ? this.typeFormatter.format(memberItem.excerpt).trim() : "";
|
|
231
231
|
const skeleton = `${declaration}\n${memberSignature}\n}`;
|
|
232
232
|
const apiPackage = apiInterface.getAssociatedPackage?.();
|
|
233
|
-
if (apiPackage)
|
|
233
|
+
if (apiPackage) {
|
|
234
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(targetMember);
|
|
235
|
+
return prependHiddenImports(skeleton, imports);
|
|
236
|
+
}
|
|
234
237
|
return skeleton;
|
|
235
238
|
}
|
|
236
239
|
/**
|
|
@@ -240,7 +243,10 @@ var InterfacePageGenerator = class {
|
|
|
240
243
|
generateInterfaceSkeletonWithTwoslash(apiInterface, packageName) {
|
|
241
244
|
const skeleton = this.generateInterfaceSkeleton(apiInterface);
|
|
242
245
|
const apiPackage = apiInterface.getAssociatedPackage?.();
|
|
243
|
-
if (apiPackage)
|
|
246
|
+
if (apiPackage) {
|
|
247
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(apiInterface);
|
|
248
|
+
return prependHiddenImports(skeleton, imports);
|
|
249
|
+
}
|
|
244
250
|
return skeleton;
|
|
245
251
|
}
|
|
246
252
|
/**
|
|
@@ -157,10 +157,7 @@ var NamespacePageGenerator = class {
|
|
|
157
157
|
case ApiItemKind.Enum:
|
|
158
158
|
enums.push(member);
|
|
159
159
|
break;
|
|
160
|
-
case ApiItemKind.Namespace:
|
|
161
|
-
namespaces.push(member);
|
|
162
|
-
break;
|
|
163
|
-
default: break;
|
|
160
|
+
case ApiItemKind.Namespace: namespaces.push(member);
|
|
164
161
|
}
|
|
165
162
|
return {
|
|
166
163
|
classes,
|
|
@@ -202,7 +199,10 @@ var NamespacePageGenerator = class {
|
|
|
202
199
|
generateNamespaceSkeletonWithTwoslash(apiNamespace, packageName) {
|
|
203
200
|
const skeleton = this.generateNamespaceSkeleton(apiNamespace);
|
|
204
201
|
const apiPackage = apiNamespace.getAssociatedPackage?.();
|
|
205
|
-
if (apiPackage)
|
|
202
|
+
if (apiPackage) {
|
|
203
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(apiNamespace);
|
|
204
|
+
return prependHiddenImports(skeleton, imports);
|
|
205
|
+
}
|
|
206
206
|
return skeleton;
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -71,7 +71,10 @@ var TypeAliasPageGenerator = class {
|
|
|
71
71
|
const signature = this.typeFormatter.format(apiTypeAlias.excerpt).trim();
|
|
72
72
|
let signatureWithImports = signature;
|
|
73
73
|
const apiPackage = apiTypeAlias.getAssociatedPackage?.();
|
|
74
|
-
if (apiPackage)
|
|
74
|
+
if (apiPackage) {
|
|
75
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(apiTypeAlias);
|
|
76
|
+
signatureWithImports = prependHiddenImports(signature, imports);
|
|
77
|
+
}
|
|
75
78
|
const displayCode = stripTwoslashDirectives(signatureWithImports);
|
|
76
79
|
content += `<ApiSignature code={${JSON.stringify(displayCode)}} source={${JSON.stringify(signatureWithImports)}} apiScope={${JSON.stringify(apiScope)}} />\n\n`;
|
|
77
80
|
}
|
|
@@ -71,7 +71,10 @@ var VariablePageGenerator = class {
|
|
|
71
71
|
const signature = this.typeFormatter.format(apiVariable.excerpt).trim();
|
|
72
72
|
let signatureWithImports = signature;
|
|
73
73
|
const apiPackage = apiVariable.getAssociatedPackage?.();
|
|
74
|
-
if (apiPackage)
|
|
74
|
+
if (apiPackage) {
|
|
75
|
+
const imports = new TypeReferenceExtractor(apiPackage, packageName).extractImportsForApiItem(apiVariable);
|
|
76
|
+
signatureWithImports = prependHiddenImports(signature, imports);
|
|
77
|
+
}
|
|
75
78
|
const displayCode = stripTwoslashDirectives(signatureWithImports);
|
|
76
79
|
content += `<ApiSignature code={${JSON.stringify(displayCode)}} source={${JSON.stringify(signatureWithImports)}} apiScope={${JSON.stringify(apiScope)}} />\n\n`;
|
|
77
80
|
}
|
|
@@ -58,10 +58,7 @@ function makeMetricsSink() {
|
|
|
58
58
|
case "PhaseCompleted":
|
|
59
59
|
Effect.runSync(Metric.update(BuildMetrics.phaseDuration, event.durationMs));
|
|
60
60
|
break;
|
|
61
|
-
case "DefaultApplied":
|
|
62
|
-
Effect.runSync(Metric.update(BuildMetrics.configDefaultsApplied, 1));
|
|
63
|
-
break;
|
|
64
|
-
default: break;
|
|
61
|
+
case "DefaultApplied": Effect.runSync(Metric.update(BuildMetrics.configDefaultsApplied, 1));
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rspress-plugin-api-extractor",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "RSPress plugin for generating API documentation from TypeScript API Extractor models",
|
|
6
6
|
"keywords": [
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@effect/platform-node": "4.0.0-beta.101",
|
|
41
41
|
"@effect/sql-sqlite-node": "4.0.0-beta.101",
|
|
42
|
-
"@effected/semver": "^0.
|
|
43
|
-
"@effected/store": "^0.1.
|
|
44
|
-
"@effected/tsconfig-json": "^0.4.
|
|
45
|
-
"@effected/xdg": "^0.1.
|
|
42
|
+
"@effected/semver": "^0.3.1",
|
|
43
|
+
"@effected/store": "^0.1.3",
|
|
44
|
+
"@effected/tsconfig-json": "^0.4.1",
|
|
45
|
+
"@effected/xdg": "^0.1.10",
|
|
46
46
|
"@microsoft/api-extractor-model": "^7.33.10",
|
|
47
|
-
"@shikijs/twoslash": "^4.
|
|
47
|
+
"@shikijs/twoslash": "^4.4.1",
|
|
48
48
|
"@typescript/vfs": "^1.6.4",
|
|
49
49
|
"api-extractor-llms": "^0.2.0",
|
|
50
50
|
"clsx": "^2.1.1",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"open": "^11.0.0",
|
|
59
59
|
"prettier": "^3.9.6",
|
|
60
60
|
"react-markdown": "^10.1.0",
|
|
61
|
-
"shiki": "^4.
|
|
62
|
-
"type-registry-effect": "^2.3.
|
|
61
|
+
"shiki": "^4.4.1",
|
|
62
|
+
"type-registry-effect": "^2.3.2",
|
|
63
63
|
"typescript": "^6.0.3",
|
|
64
64
|
"unist-util-visit": "^5.1.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@rspress/core": "^2.0.
|
|
67
|
+
"@rspress/core": "^2.0.19",
|
|
68
68
|
"react": "^19.2.0",
|
|
69
69
|
"react-dom": "^19.2.0"
|
|
70
70
|
},
|
package/plugin.js
CHANGED
|
@@ -163,10 +163,11 @@ function ApiExtractorPluginImpl(rawOptions) {
|
|
|
163
163
|
});
|
|
164
164
|
for (const dp of derivedPaths) fs.mkdirSync(dp.outputDir, { recursive: true });
|
|
165
165
|
} else if (options.apis) for (const api of options.apis) {
|
|
166
|
+
const baseRoute = normalizeBaseRoute(api.baseRoute ?? `/${unscopedName(api.packageName)}`);
|
|
166
167
|
const derivedPaths = deriveOutputPaths({
|
|
167
168
|
mode: "multi",
|
|
168
169
|
docsRoot: rspressRoot,
|
|
169
|
-
baseRoute
|
|
170
|
+
baseRoute,
|
|
170
171
|
apiFolder: api.apiFolder ?? "api",
|
|
171
172
|
locales: rspressLocales,
|
|
172
173
|
defaultLang: rspressLang,
|
|
@@ -6,7 +6,8 @@ import { Fragment, jsx } from "react/jsx-runtime";
|
|
|
6
6
|
* Only supports basic markdown links: [text](url)
|
|
7
7
|
*/
|
|
8
8
|
function MarkdownText({ children }) {
|
|
9
|
-
|
|
9
|
+
const parts = parseMarkdownLinks(children);
|
|
10
|
+
return /* @__PURE__ */ jsx(Fragment, { children: parts });
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Parse markdown links and return array of React nodes
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
.sBksbq_blockWrapper {
|
|
2
|
+
padding: var(--api-spacing-xl) 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.sBksbq_block {
|
|
2
|
-
margin: var(--api-spacing-xl) 0;
|
|
3
6
|
border-radius: var(--api-border-radius);
|
|
4
7
|
border: 1px solid var(--api-color-border);
|
|
5
8
|
position: relative;
|
|
@@ -13,7 +16,7 @@ html.sBksbq_rp-dark .sBksbq_block {
|
|
|
13
16
|
.sBksbq_hasParameters {
|
|
14
17
|
border-bottom-right-radius: 0;
|
|
15
18
|
border-bottom-left-radius: 0;
|
|
16
|
-
|
|
19
|
+
padding-bottom: 0;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
.sBksbq_hasParameters .api-signature-code {
|
|
@@ -24,23 +24,26 @@ function MemberSignature({ hast, memberName, id, summary, hasParameters = false
|
|
|
24
24
|
if (summary) markdown += `\n\n${summary}`;
|
|
25
25
|
return /* @__PURE__ */ jsx(Fragment, { children: markdown });
|
|
26
26
|
}
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
className: clsx(index_module_default.
|
|
29
|
-
children:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
return /* @__PURE__ */ jsx("section", {
|
|
28
|
+
className: clsx(index_module_default.blockWrapper, hasParameters && index_module_default.hasParameters),
|
|
29
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
30
|
+
className: index_module_default.block,
|
|
31
|
+
children: [/* @__PURE__ */ jsx(SignatureToolbar, {
|
|
32
|
+
heading: {
|
|
33
|
+
text: memberName,
|
|
34
|
+
...id != null ? { id } : {},
|
|
35
|
+
level: "h3"
|
|
36
|
+
},
|
|
37
|
+
...summary != null ? { summary } : {},
|
|
38
|
+
buttons: /* @__PURE__ */ jsx(WrapSignatureButton, {
|
|
39
|
+
wrapped,
|
|
40
|
+
onToggle: toggleWrap
|
|
41
|
+
})
|
|
42
|
+
}), /* @__PURE__ */ jsx(SignatureCode, {
|
|
43
|
+
hast,
|
|
44
|
+
wrapped
|
|
45
|
+
})]
|
|
46
|
+
})
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
49
|
/**
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
.PJvwTW_blockWrapper {
|
|
2
|
+
padding: var(--api-spacing-xl) 0;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.PJvwTW_block {
|
|
2
|
-
margin: var(--api-spacing-xl) 0;
|
|
3
6
|
border-radius: var(--api-border-radius);
|
|
4
7
|
border: 1px solid var(--api-color-border);
|
|
5
8
|
position: relative;
|
|
@@ -11,9 +14,10 @@ html.PJvwTW_rp-dark .PJvwTW_block {
|
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
.PJvwTW_hasParameters {
|
|
17
|
+
border-bottom-width: 0;
|
|
14
18
|
border-bottom-right-radius: 0;
|
|
15
19
|
border-bottom-left-radius: 0;
|
|
16
|
-
|
|
20
|
+
padding-bottom: 0;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
.PJvwTW_hasParameters .api-signature-code {
|
|
@@ -15,22 +15,26 @@ import clsx from "clsx";
|
|
|
15
15
|
*/
|
|
16
16
|
function SignatureBlock({ hast, heading = "Signature", id = "signature", hasParameters = false }) {
|
|
17
17
|
const { wrapped, toggleWrap } = useWrapToggle();
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
return /* @__PURE__ */ jsx("section", {
|
|
19
|
+
id,
|
|
20
|
+
className: clsx("rp-toc-include", index_module_default.blockWrapper, hasParameters && index_module_default.hasParameters),
|
|
21
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
22
|
+
className: index_module_default.block,
|
|
23
|
+
children: [/* @__PURE__ */ jsx(SignatureToolbar, {
|
|
24
|
+
...heading && id ? { heading: {
|
|
25
|
+
text: heading,
|
|
26
|
+
id,
|
|
27
|
+
level: "h2"
|
|
28
|
+
} } : {},
|
|
29
|
+
buttons: /* @__PURE__ */ jsx(WrapSignatureButton, {
|
|
30
|
+
wrapped,
|
|
31
|
+
onToggle: toggleWrap
|
|
32
|
+
})
|
|
33
|
+
}), /* @__PURE__ */ jsx(SignatureCode, {
|
|
34
|
+
hast,
|
|
35
|
+
wrapped
|
|
36
|
+
})]
|
|
37
|
+
})
|
|
34
38
|
});
|
|
35
39
|
}
|
|
36
40
|
|
|
@@ -41,6 +41,7 @@ html.pmgBdW_rp-dark .pmgBdW_toolbar {
|
|
|
41
41
|
line-height: var(--api-line-height-base);
|
|
42
42
|
user-select: auto;
|
|
43
43
|
margin: 0;
|
|
44
|
+
scroll-margin-top: 1.5rem;
|
|
44
45
|
position: relative;
|
|
45
46
|
overflow: visible;
|
|
46
47
|
}
|
|
@@ -51,13 +52,14 @@ html.pmgBdW_rp-dark .pmgBdW_memberHeading {
|
|
|
51
52
|
|
|
52
53
|
.pmgBdW_memberHeading .rp-header-anchor {
|
|
53
54
|
opacity: 0;
|
|
54
|
-
font-weight: 500;
|
|
55
|
-
font-size: inherit;
|
|
56
55
|
color: var(--rp-c-brand);
|
|
56
|
+
font-size: 1.5rem;
|
|
57
|
+
font-weight: 500;
|
|
57
58
|
text-decoration: none;
|
|
58
59
|
transition: color .25s, opacity .25s;
|
|
59
60
|
position: absolute;
|
|
60
|
-
|
|
61
|
+
top: -.1rem;
|
|
62
|
+
left: -.6rem;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
.pmgBdW_memberHeading:hover .rp-header-anchor {
|
|
@@ -65,7 +67,7 @@ html.pmgBdW_rp-dark .pmgBdW_memberHeading {
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
.pmgBdW_memberHeading .rp-header-anchor:hover {
|
|
68
|
-
border-bottom:
|
|
70
|
+
border-bottom: 0px solid var(--rp-c-brand);
|
|
69
71
|
opacity: .85;
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -76,6 +78,7 @@ html.pmgBdW_rp-dark .pmgBdW_memberHeading {
|
|
|
76
78
|
margin-top: 0;
|
|
77
79
|
margin-bottom: 0;
|
|
78
80
|
padding-top: 0;
|
|
81
|
+
scroll-margin-top: 1.5rem;
|
|
79
82
|
font-weight: 600;
|
|
80
83
|
line-height: 2rem;
|
|
81
84
|
}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
--api-spacing-xs: .375rem;
|
|
15
15
|
--api-spacing-sm: .5rem;
|
|
16
16
|
--api-spacing-md: .75rem;
|
|
17
|
-
--api-spacing-lg:
|
|
18
|
-
--api-spacing-xl: 1.
|
|
17
|
+
--api-spacing-lg: 1.15rem;
|
|
18
|
+
--api-spacing-xl: 1.15rem;
|
|
19
19
|
--api-border-radius: 6px;
|
|
20
20
|
--api-border-radius-sm: 3px;
|
|
21
21
|
--api-border-radius-md: 4px;
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
text-decoration: var(--api-shiki-light-text-decoration, inherit);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
.api-doc-code .shiki span.line {
|
|
48
|
+
padding-left: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
47
51
|
html.rp-dark .api-doc-code .shiki, html.rp-dark .api-doc-code .shiki span {
|
|
48
52
|
color: var(--api-shiki-dark);
|
|
49
53
|
background-color: var(--api-shiki-dark-bg, inherit);
|
package/twoslash-transformer.js
CHANGED
|
@@ -131,7 +131,8 @@ function renderMarkdown(markdown) {
|
|
|
131
131
|
try {
|
|
132
132
|
let transformed = transformTsDocLinks(markdown);
|
|
133
133
|
transformed = transformed.split(/\n\n+/).map((para) => para.replace(/\s+/g, " ").trim()).filter((para) => para.length > 0).join("\n\n");
|
|
134
|
-
const
|
|
134
|
+
const mdast = fromMarkdown(transformed);
|
|
135
|
+
const hast = toHast(mdast);
|
|
135
136
|
if (hast && "children" in hast) {
|
|
136
137
|
const children = hast.children;
|
|
137
138
|
for (const child of children) addLinkClasses(child);
|