@farming-labs/theme 0.1.34 → 0.1.36
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 +16 -3
- package/package.json +2 -2
package/dist/docs-api.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { getNextAppDir } from "./get-app-dir.mjs";
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import matter from "gray-matter";
|
|
6
|
-
import { performDocsSearch, resolveChangelogConfig, resolveDocsI18n, resolveDocsLocale, resolveSearchRequestConfig } from "@farming-labs/docs";
|
|
6
|
+
import { normalizeDocsRelated, performDocsSearch, renderDocsRelatedMarkdownLines, resolveChangelogConfig, resolveDocsI18n, resolveDocsLocale, resolveSearchRequestConfig } from "@farming-labs/docs";
|
|
7
7
|
import { createDocsMcpHttpHandler, createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "@farming-labs/docs/server";
|
|
8
8
|
|
|
9
9
|
//#region src/docs-api.ts
|
|
@@ -673,6 +673,7 @@ function scanDocsDir(docsDir, entry, locale, excludedDirs = []) {
|
|
|
673
673
|
indexes.push({
|
|
674
674
|
title,
|
|
675
675
|
description,
|
|
676
|
+
relatedInput: data.related,
|
|
676
677
|
content,
|
|
677
678
|
rawContent,
|
|
678
679
|
agentFallbackRawContent: agentRawContent !== rawContent ? agentRawContent : void 0,
|
|
@@ -694,7 +695,7 @@ function scanDocsDir(docsDir, entry, locale, excludedDirs = []) {
|
|
|
694
695
|
}
|
|
695
696
|
}
|
|
696
697
|
scan(docsDir, []);
|
|
697
|
-
return indexes;
|
|
698
|
+
return resolveRelatedForSearchPages(indexes);
|
|
698
699
|
}
|
|
699
700
|
function scanChangelogDir(changelogDir, entryPath, changelogPath, locale) {
|
|
700
701
|
if (!fs.existsSync(changelogDir)) return [];
|
|
@@ -730,6 +731,7 @@ function scanChangelogDir(changelogDir, entryPath, changelogPath, locale) {
|
|
|
730
731
|
indexes.push({
|
|
731
732
|
title,
|
|
732
733
|
description,
|
|
734
|
+
relatedInput: data.related,
|
|
733
735
|
content,
|
|
734
736
|
rawContent,
|
|
735
737
|
agentFallbackRawContent: agentRawContent !== rawContent ? agentRawContent : void 0,
|
|
@@ -741,7 +743,16 @@ function scanChangelogDir(changelogDir, entryPath, changelogPath, locale) {
|
|
|
741
743
|
});
|
|
742
744
|
} catch {}
|
|
743
745
|
}
|
|
744
|
-
return indexes;
|
|
746
|
+
return resolveRelatedForSearchPages(indexes);
|
|
747
|
+
}
|
|
748
|
+
function resolveRelatedForSearchPages(pages) {
|
|
749
|
+
return pages.map(({ relatedInput, ...page }) => {
|
|
750
|
+
const related = normalizeDocsRelated(relatedInput);
|
|
751
|
+
return related.length > 0 ? {
|
|
752
|
+
...page,
|
|
753
|
+
related
|
|
754
|
+
} : page;
|
|
755
|
+
});
|
|
745
756
|
}
|
|
746
757
|
function normalizePathSegment(value) {
|
|
747
758
|
return value.replace(/^\/+|\/+$/g, "");
|
|
@@ -802,8 +813,10 @@ function resolveLlmsTxtFormat(url) {
|
|
|
802
813
|
}
|
|
803
814
|
function renderMarkdownDocument(page) {
|
|
804
815
|
if ("agentRawContent" in page && page.agentRawContent !== void 0) return page.agentRawContent;
|
|
816
|
+
const relatedLines = renderDocsRelatedMarkdownLines(page.related);
|
|
805
817
|
const lines = [`# ${page.title}`, `URL: ${page.url}`];
|
|
806
818
|
if (page.description) lines.push(`Description: ${page.description}`);
|
|
819
|
+
lines.push(...relatedLines);
|
|
807
820
|
lines.push("", page.agentFallbackRawContent ?? page.rawContent ?? page.content);
|
|
808
821
|
return lines.join("\n");
|
|
809
822
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"tsdown": "^0.20.3",
|
|
134
134
|
"typescript": "^5.9.3",
|
|
135
135
|
"vitest": "^3.2.4",
|
|
136
|
-
"@farming-labs/docs": "0.1.
|
|
136
|
+
"@farming-labs/docs": "0.1.36"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
139
|
"@farming-labs/docs": ">=0.0.1",
|