mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-24 20:09:02 +00:00
Renames the public doc-collection method across runtime, types, examples and create-app templates so the API carries no upstream brand. The internal helper and all call sites move together; fumadocs-core package imports are untouched. Pairs with the .docs default outDir change. BREAKING CHANGE: docs.toFumadocsSource() is now docs.toDocsSource(). Co-authored-by: Hanzo Dev <[email protected]>
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import { docs } from 'collections/server';
|
|
import { loader } from 'fumadocs-core/source';
|
|
import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
|
|
import { docsContentRoute, docsImageRoute, docsRoute } from './shared';
|
|
|
|
// See https://fumadocs.dev/docs/headless/source-api for more info
|
|
export const source = loader({
|
|
baseUrl: docsRoute,
|
|
source: docs.toDocsSource(),
|
|
plugins: [lucideIconsPlugin()],
|
|
});
|
|
|
|
export function getPageImage(page: (typeof source)['$inferPage']) {
|
|
const segments = [...page.slugs, 'image.png'];
|
|
|
|
return {
|
|
segments,
|
|
url: `${docsImageRoute}/${segments.join('/')}`,
|
|
};
|
|
}
|
|
|
|
export function getPageMarkdownUrl(page: (typeof source)['$inferPage']) {
|
|
const segments = [...page.slugs, 'content.md'];
|
|
|
|
return {
|
|
segments,
|
|
url: `${docsContentRoute}/${segments.join('/')}`,
|
|
};
|
|
}
|
|
|
|
export async function getLLMText(page: (typeof source)['$inferPage']) {
|
|
const processed = await page.data.getText('processed');
|
|
|
|
return `# ${page.data.title} (${page.url})
|
|
|
|
${processed}`;
|
|
}
|