@farming-labs/theme 0.1.90 → 0.1.93
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/docs-api.mjs +5 -4
- package/dist/docs-page-client.mjs +113 -91
- package/package.json +2 -2
package/dist/docs-api.mjs
CHANGED
|
@@ -935,10 +935,11 @@ function resolveMarkdownRequest(entry, url, request) {
|
|
|
935
935
|
}
|
|
936
936
|
return null;
|
|
937
937
|
}
|
|
938
|
-
function renderMarkdownDocument(page) {
|
|
938
|
+
function renderMarkdownDocument(page, options = {}) {
|
|
939
939
|
if ("agentRawContent" in page && page.agentRawContent !== void 0) return page.agentRawContent;
|
|
940
940
|
const relatedLines = renderDocsRelatedMarkdownLines(page.related);
|
|
941
941
|
const lines = [`# ${page.title}`, `URL: ${page.url}`];
|
|
942
|
+
if (options.llmsEnabled !== false) lines.push("LLM index: /llms.txt");
|
|
942
943
|
if (page.description) lines.push(`Description: ${page.description}`);
|
|
943
944
|
lines.push(...relatedLines);
|
|
944
945
|
lines.push("", page.agentFallbackRawContent ?? page.rawContent ?? page.content);
|
|
@@ -1735,11 +1736,11 @@ function createDocsAPI(options) {
|
|
|
1735
1736
|
for (const docsDir of ctx.docsDirs) if (isHiddenFolderIndexPageDir(relativeSlug ? path.join(docsDir, ...relativeSlug.split("/")) : docsDir)) return null;
|
|
1736
1737
|
for (const source of getMarkdownSources(ctx)) {
|
|
1737
1738
|
const page = findDocsMcpPage(ctx.entryPath, await source.getPages(), requestedPath);
|
|
1738
|
-
if (page) return renderMarkdownDocument(page);
|
|
1739
|
+
if (page) return renderMarkdownDocument(page, { llmsEnabled: llmsConfig.enabled });
|
|
1739
1740
|
}
|
|
1740
1741
|
const fallbackPage = getIndexes(ctx).find((page) => normalizeUrlPath(page.url) === normalizedRequest);
|
|
1741
|
-
if (fallbackPage) return renderMarkdownDocument(fallbackPage);
|
|
1742
|
-
for (const page of getIndexes(ctx)) if (normalizePathSegment(page.url.replace(/^\/+/, "").replace(`${ctx.entryPath}/`, "")) === normalizePathSegment(requestedPath.replace(/^\/+/, "").replace(/\.md$/i, ""))) return renderMarkdownDocument(page);
|
|
1742
|
+
if (fallbackPage) return renderMarkdownDocument(fallbackPage, { llmsEnabled: llmsConfig.enabled });
|
|
1743
|
+
for (const page of getIndexes(ctx)) if (normalizePathSegment(page.url.replace(/^\/+/, "").replace(`${ctx.entryPath}/`, "")) === normalizePathSegment(requestedPath.replace(/^\/+/, "").replace(/\.md$/i, ""))) return renderMarkdownDocument(page, { llmsEnabled: llmsConfig.enabled });
|
|
1743
1744
|
return null;
|
|
1744
1745
|
}
|
|
1745
1746
|
function getLlmsContent(ctx) {
|
|
@@ -13,6 +13,17 @@ import { usePathname, useRouter } from "fumadocs-core/framework";
|
|
|
13
13
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
|
|
15
15
|
//#region src/docs-page-client.tsx
|
|
16
|
+
const agentLlmsDirectiveStyle = {
|
|
17
|
+
position: "absolute",
|
|
18
|
+
width: 1,
|
|
19
|
+
height: 1,
|
|
20
|
+
padding: 0,
|
|
21
|
+
margin: -1,
|
|
22
|
+
overflow: "hidden",
|
|
23
|
+
clip: "rect(0, 0, 0, 0)",
|
|
24
|
+
whiteSpace: "nowrap",
|
|
25
|
+
border: 0
|
|
26
|
+
};
|
|
16
27
|
/**
|
|
17
28
|
* Path-based breadcrumb that shows only parent / current folder.
|
|
18
29
|
* Skips the entry segment (e.g. "docs"). Parent is clickable.
|
|
@@ -343,97 +354,108 @@ function DocsPageClient({ tocEnabled, tocStyle = "default", breadcrumbEnabled =
|
|
|
343
354
|
belowTitle: belowTitleBlock
|
|
344
355
|
}), titlePortalHost) : null;
|
|
345
356
|
const renderedChildren = Children.toArray(decoratedChildren);
|
|
346
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
style:
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
357
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
358
|
+
structuredDataJson && /* @__PURE__ */ jsx("script", {
|
|
359
|
+
type: "application/ld+json",
|
|
360
|
+
dangerouslySetInnerHTML: { __html: escapeJsonLdForScript(structuredDataJson) }
|
|
361
|
+
}),
|
|
362
|
+
llmsTxtEnabled && /* @__PURE__ */ jsx("a", {
|
|
363
|
+
href: `/llms.txt${llmsLangQuery}`,
|
|
364
|
+
className: "fd-agent-llms-directive",
|
|
365
|
+
style: agentLlmsDirectiveStyle,
|
|
366
|
+
tabIndex: -1,
|
|
367
|
+
"aria-hidden": "true",
|
|
368
|
+
children: "llms.txt"
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ jsxs(DocsPage, {
|
|
371
|
+
full: false,
|
|
372
|
+
toc,
|
|
373
|
+
tableOfContent: {
|
|
374
|
+
enabled: effectiveTocEnabled,
|
|
375
|
+
style: fdTocStyle
|
|
376
|
+
},
|
|
377
|
+
tableOfContentPopover: {
|
|
378
|
+
enabled: effectiveTocEnabled,
|
|
379
|
+
style: fdTocStyle
|
|
380
|
+
},
|
|
381
|
+
breadcrumb: { enabled: false },
|
|
382
|
+
footer: { enabled: !isChangelogRoute },
|
|
383
|
+
children: [
|
|
384
|
+
effectiveBreadcrumbEnabled && /* @__PURE__ */ jsx(PathBreadcrumb, {
|
|
385
|
+
pathname,
|
|
386
|
+
entry,
|
|
387
|
+
locale: activeLocale
|
|
388
|
+
}),
|
|
389
|
+
showActionsAboveTitle && /* @__PURE__ */ jsxs("div", {
|
|
390
|
+
className: "fd-below-title-block not-prose",
|
|
391
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
392
|
+
className: "fd-actions-portal",
|
|
393
|
+
"data-actions-alignment": pageActionsAlignment,
|
|
394
|
+
children: /* @__PURE__ */ jsx(PageActions, {
|
|
395
|
+
copyMarkdown,
|
|
396
|
+
openDocs,
|
|
397
|
+
providers: openDocsProviders,
|
|
398
|
+
alignment: pageActionsAlignment,
|
|
399
|
+
githubFileUrl,
|
|
400
|
+
analytics
|
|
401
|
+
})
|
|
402
|
+
}), readingTimeBlock]
|
|
403
|
+
}),
|
|
404
|
+
!showReadingTimeAboveTitle && !showReadingTimeBelowTitle ? readingTimeBlock : null,
|
|
405
|
+
/* @__PURE__ */ jsxs(DocsBody, {
|
|
406
|
+
style: {
|
|
407
|
+
display: "flex",
|
|
408
|
+
flexDirection: "column"
|
|
409
|
+
},
|
|
410
|
+
children: [
|
|
411
|
+
/* @__PURE__ */ jsx("div", {
|
|
412
|
+
style: { flex: 1 },
|
|
413
|
+
children: renderedChildren
|
|
414
|
+
}),
|
|
415
|
+
titleDecorationsPortal,
|
|
416
|
+
!isChangelogRoute && feedbackEnabled && /* @__PURE__ */ jsx(DocsFeedback, {
|
|
417
|
+
pathname: normalizedPath,
|
|
418
|
+
entry,
|
|
419
|
+
locale: activeLocale,
|
|
420
|
+
question: feedbackQuestion,
|
|
421
|
+
placeholder: feedbackPlaceholder,
|
|
422
|
+
positiveLabel: feedbackPositiveLabel,
|
|
423
|
+
negativeLabel: feedbackNegativeLabel,
|
|
424
|
+
submitLabel: feedbackSubmitLabel,
|
|
425
|
+
onFeedback: feedbackOnFeedback,
|
|
426
|
+
analytics
|
|
427
|
+
}),
|
|
428
|
+
showFooter && /* @__PURE__ */ jsxs("div", {
|
|
429
|
+
className: "not-prose fd-page-footer",
|
|
430
|
+
children: [
|
|
431
|
+
githubFileUrl && /* @__PURE__ */ jsx(EditOnGitHub, { href: githubFileUrl }),
|
|
432
|
+
llmsTxtEnabled && /* @__PURE__ */ jsxs("span", {
|
|
433
|
+
className: "fd-llms-txt-links",
|
|
434
|
+
children: [/* @__PURE__ */ jsx("a", {
|
|
435
|
+
href: `/llms.txt${llmsLangQuery}`,
|
|
436
|
+
target: "_blank",
|
|
437
|
+
rel: "noopener noreferrer",
|
|
438
|
+
className: "fd-llms-txt-link",
|
|
439
|
+
children: "llms.txt"
|
|
440
|
+
}), /* @__PURE__ */ jsx("a", {
|
|
441
|
+
href: `/llms-full.txt${llmsLangQuery}`,
|
|
442
|
+
target: "_blank",
|
|
443
|
+
rel: "noopener noreferrer",
|
|
444
|
+
className: "fd-llms-txt-link",
|
|
445
|
+
children: "llms-full.txt"
|
|
446
|
+
})]
|
|
447
|
+
}),
|
|
448
|
+
showLastUpdatedInFooter && lastModified && /* @__PURE__ */ jsxs("span", {
|
|
449
|
+
className: "fd-last-updated-footer",
|
|
450
|
+
children: ["Last updated ", lastModified]
|
|
451
|
+
})
|
|
452
|
+
]
|
|
453
|
+
})
|
|
454
|
+
]
|
|
455
|
+
})
|
|
456
|
+
]
|
|
457
|
+
})
|
|
458
|
+
] });
|
|
437
459
|
}
|
|
438
460
|
|
|
439
461
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.93",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"tsdown": "^0.20.3",
|
|
140
140
|
"typescript": "^5.9.3",
|
|
141
141
|
"vitest": "^3.2.4",
|
|
142
|
-
"@farming-labs/docs": "0.1.
|
|
142
|
+
"@farming-labs/docs": "0.1.93"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
145
145
|
"@farming-labs/docs": ">=0.0.1",
|