mirror of
https://github.com/trycua/computer.git
synced 2026-01-08 14:30:25 -06:00
27 lines
665 B
TypeScript
27 lines
665 B
TypeScript
import { remark } from 'remark';
|
|
import remarkGfm from 'remark-gfm';
|
|
import remarkMdx from 'remark-mdx';
|
|
import { remarkInclude } from 'fumadocs-mdx/config';
|
|
import { source } from '@/lib/source';
|
|
import type { InferPageType } from 'fumadocs-core/source';
|
|
|
|
const processor = remark()
|
|
.use(remarkMdx)
|
|
// needed for Fumadocs MDX
|
|
.use(remarkInclude)
|
|
.use(remarkGfm);
|
|
|
|
export async function getLLMText(page: InferPageType<typeof source>) {
|
|
const processed = await processor.process({
|
|
path: page.data._file.absolutePath,
|
|
value: page.data.content,
|
|
});
|
|
|
|
return `# ${page.data.title}
|
|
URL: ${page.url}
|
|
|
|
${page.data.description}
|
|
|
|
${processed.value}`;
|
|
}
|