mirror of
https://github.com/basketikun/infinite-canvas.git
synced 2026-07-26 16:54:29 +08:00
28 lines
728 B
TypeScript
28 lines
728 B
TypeScript
import { docs } from 'collections/server';
|
|
import { loader } from 'fumadocs-core/source';
|
|
import { docsContentRoute, docsRoute } from './shared';
|
|
|
|
// See https://fumadocs.dev/docs/headless/source-api for more info
|
|
export const source = loader({
|
|
baseUrl: docsRoute,
|
|
source: docs.toFumadocsSource(),
|
|
plugins: [],
|
|
});
|
|
|
|
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}`;
|
|
}
|