@farming-labs/svelte 0.2.55 → 0.2.57
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/content.js +6 -5
- package/dist/markdown.js +2 -2
- package/dist/server.js +7 -6
- package/package.json +2 -2
package/dist/content.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import matter from "gray-matter";
|
|
11
|
-
import { normalizeDocsRelated, normalizePageAgentFrontmatter,
|
|
11
|
+
import { normalizeDocsRelated, normalizePageAgentFrontmatter, resolveDocsAudienceMdxContent, resolvePageSidebarFolderIndexBehavior, } from "@farming-labs/docs";
|
|
12
12
|
/**
|
|
13
13
|
* Scan a content directory and return all docs pages.
|
|
14
14
|
* Expects a flat or nested structure of `.md` files:
|
|
@@ -36,8 +36,8 @@ export function loadDocsContent(contentDir, entry = "docs") {
|
|
|
36
36
|
continue;
|
|
37
37
|
const raw = fs.readFileSync(full, "utf-8");
|
|
38
38
|
const { data, content } = matter(raw);
|
|
39
|
-
const humanRawContent =
|
|
40
|
-
const pageAgentRawContent =
|
|
39
|
+
const humanRawContent = resolveDocsAudienceMdxContent(content, "human");
|
|
40
|
+
const pageAgentRawContent = resolveDocsAudienceMdxContent(content, "agent");
|
|
41
41
|
const related = normalizeDocsRelated(data.related);
|
|
42
42
|
const baseName = name.replace(/\.(md|mdx|svx)$/, "");
|
|
43
43
|
const isIndex = baseName === "index" || baseName === "page" || baseName === "+page";
|
|
@@ -83,9 +83,10 @@ function readAgentDoc(dir) {
|
|
|
83
83
|
return undefined;
|
|
84
84
|
const raw = fs.readFileSync(agentPath, "utf-8");
|
|
85
85
|
const { content } = matter(raw);
|
|
86
|
+
const agentRawContent = resolveDocsAudienceMdxContent(content, "agent");
|
|
86
87
|
return {
|
|
87
|
-
agentContent: stripMarkdown(
|
|
88
|
-
agentRawContent
|
|
88
|
+
agentContent: stripMarkdown(agentRawContent),
|
|
89
|
+
agentRawContent,
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
92
|
/**
|
package/dist/markdown.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Callouts / admonitions (GitHub `[!NOTE]` and `**Note:**` styles)
|
|
9
9
|
* - Tables, lists, inline formatting, headings with anchor IDs
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { resolveDocsAudienceMdxContent } from "@farming-labs/docs";
|
|
12
12
|
import { parsePromptStringArray, resolvePromptProviderChoices, sanitizePromptText, } from "@farming-labs/docs/server";
|
|
13
13
|
import { createHighlighter } from "shiki";
|
|
14
14
|
let highlighterPromise = null;
|
|
@@ -491,7 +491,7 @@ export async function renderMarkdown(content, options = {}) {
|
|
|
491
491
|
if (!content)
|
|
492
492
|
return "";
|
|
493
493
|
const hl = await getHighlighter();
|
|
494
|
-
let result =
|
|
494
|
+
let result = resolveDocsAudienceMdxContent(content, "human");
|
|
495
495
|
// ── Mintlify-style code groups: <CodeGroup> fenced code blocks </CodeGroup> ──
|
|
496
496
|
const tabsBlocks = [];
|
|
497
497
|
result = result.replace(/<CodeGroup(?:\s+([^>]*?))?>([\s\S]*?)<\/CodeGroup>/g, (_, attrSource, body) => {
|
package/dist/server.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import fs from "node:fs";
|
|
31
31
|
import path from "node:path";
|
|
32
32
|
import matter from "gray-matter";
|
|
33
|
-
import { applySidebarFolderIndexBehavior, buildDocsAskAIContext, buildDocsAgentDiscoverySpec, buildDocsConfigMap, buildDocsDiagnostics, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, isDocsAgentDiscoveryRequest, isDocsAgentsRequest, isDocsConfigRequest, isDocsDiagnosticsRequest, isDocsSkillRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, parseDocsAgentFeedbackData, performDocsSearch, renderDocsMarkdownDocument, renderDocsLlmsTxt, renderDocsAgentsDocument, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance,
|
|
33
|
+
import { applySidebarFolderIndexBehavior, buildDocsAskAIContext, buildDocsAgentDiscoverySpec, buildDocsConfigMap, buildDocsDiagnostics, createDocsMarkdownResponse, createDocsRobotsResponse, createDocsSitemapResponse, createDocsAgentTraceContext, createDocsAgentTraceId, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsTelemetryAgentSurfaceEvent, emitDocsTelemetryProjectEvent, formatDocsAskAIPackageHints, findDocsMarkdownPage, getDocsLlmsTxtMaxCharsIssue, isDocsAgentDiscoveryRequest, isDocsAgentsRequest, isDocsConfigRequest, isDocsDiagnosticsRequest, isDocsSkillRequest, normalizeDocsRelated, normalizePageAgentFrontmatter, parseDocsAgentFeedbackData, performDocsSearch, renderDocsMarkdownDocument, renderDocsLlmsTxt, renderDocsAgentsDocument, renderDocsSkillDocument, readDocsSitemapManifestFromContentMap, stripGeneratedAgentProvenance, resolveDocsAudienceMdxContent, resolveDocsAgentFeedbackConfig, resolveDocsAgentFeedbackRequest, resolvePageSidebarFolderIndexBehavior, resolveAskAISearchRequestConfig, resolveSearchRequestConfig, resolveDocsI18n, resolveDocsLlmsTxtRequest, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsPath, resolvePageReadingTime, resolveReadingTimeOptions, resolveDocsSitemapPageLastmod, resolveDocsAgentsFormat, resolveDocsSkillFormat, inferDocsTelemetryAgentSurface, renderDocsPageStructuredDataJson, selectDocsLlmsTxtContent, validateDocsAgentFeedbackPayload, } from "@farming-labs/docs";
|
|
34
34
|
import { buildApiReferenceOpenApiDocumentAsync, createDocsCloudAskAIResponse, createDocsMcpHttpHandler, isDocsCloudAskAIProvider, readDocsSitemapManifest, resolveApiReferenceConfig, resolveDocsMcpConfig, serializeDocsIconRegistry, serializeOpenDocsProviders, } from "@farming-labs/docs/server";
|
|
35
35
|
import { loadDocsNavTree, loadDocsContent, flattenNavTree } from "./content.js";
|
|
36
36
|
import { renderMarkdown } from "./markdown.js";
|
|
@@ -325,8 +325,8 @@ function searchIndexFromMap(contentMap, dirPrefix, entry) {
|
|
|
325
325
|
const slug = isIdx ? segments.join("/") : [...segments, base].join("/");
|
|
326
326
|
const url = slug ? `/${entry}/${slug}` : `/${entry}`;
|
|
327
327
|
const { data, content } = matter(raw);
|
|
328
|
-
const humanRawContent =
|
|
329
|
-
const pageAgentRawContent =
|
|
328
|
+
const humanRawContent = resolveDocsAudienceMdxContent(content, "human");
|
|
329
|
+
const pageAgentRawContent = resolveDocsAudienceMdxContent(content, "agent");
|
|
330
330
|
const related = normalizeDocsRelated(data.related);
|
|
331
331
|
const agentDoc = isIdx ? readAgentDocFromMap(contentMap, dirPrefix, slug) : undefined;
|
|
332
332
|
const title = data.title ?? base.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
@@ -363,9 +363,10 @@ function readAgentDocFromMap(contentMap, dirPrefix, slug) {
|
|
|
363
363
|
if (!raw)
|
|
364
364
|
return undefined;
|
|
365
365
|
const { content } = matter(stripGeneratedAgentProvenance(raw));
|
|
366
|
+
const agentRawContent = resolveDocsAudienceMdxContent(content, "agent");
|
|
366
367
|
return {
|
|
367
|
-
agentContent: stripMarkdownText(
|
|
368
|
-
agentRawContent
|
|
368
|
+
agentContent: stripMarkdownText(agentRawContent),
|
|
369
|
+
agentRawContent,
|
|
369
370
|
};
|
|
370
371
|
}
|
|
371
372
|
function findPageInMap(contentMap, dirPrefix, slug) {
|
|
@@ -553,7 +554,7 @@ export function createDocsServer(config = {}) {
|
|
|
553
554
|
});
|
|
554
555
|
}
|
|
555
556
|
const { data, content } = matter(raw);
|
|
556
|
-
const humanRawContent =
|
|
557
|
+
const humanRawContent = resolveDocsAudienceMdxContent(content, "human");
|
|
557
558
|
const readingTime = resolvePageReadingTime(data, humanRawContent, {
|
|
558
559
|
enabledByDefault: readingTimeOptions.enabled,
|
|
559
560
|
wordsPerMinute: readingTimeOptions.wordsPerMinute,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/svelte",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.57",
|
|
4
4
|
"description": "SvelteKit adapter for @farming-labs/docs — content loading and navigation utilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^22.10.0",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
|
-
"@farming-labs/docs": "0.2.
|
|
59
|
+
"@farming-labs/docs": "0.2.57"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@farming-labs/docs": "*"
|