1- // import fs from 'node:fs/promises';
1+ import fs from 'node:fs/promises' ;
22
3- // import type { InferPageType } from 'fumadocs-core/source';
4- // import { remarkInclude } from 'fumadocs-mdx/config';
5- // import { remark } from 'remark';
6- // import remarkGfm from 'remark-gfm';
7- // import remarkMdx from 'remark-mdx';
3+ import type { InferPageType } from 'fumadocs-core/source' ;
4+ import { remarkInclude } from 'fumadocs-mdx/config' ;
5+ import { remark } from 'remark' ;
6+ import remarkGfm from 'remark-gfm' ;
7+ import remarkMdx from 'remark-mdx' ;
88
9- // import { source } from './source';
9+ import { source } from './source' ;
1010
11- // const processor = remark()
12- // .use(remarkMdx)
13- // .use(remarkInclude)
14- // .use(remarkGfm)
11+ const processor = remark ( )
12+ . use ( remarkMdx )
13+ . use ( remarkInclude )
14+ . use ( remarkGfm )
1515
16- // export async function getLLMText(page: InferPageType<typeof source>) {
17- // const processed = await processor.process({
18- // path: page.absolutePath ,
19- // value: await fs.readFile(page.absolutePath , 'utf8'),
20- // });
16+ export async function getLLMText ( page : InferPageType < typeof source > ) {
17+ const processed = await processor . process ( {
18+ path : page . file . path ,
19+ value : await fs . readFile ( page . file . path , 'utf8' ) ,
20+ } ) ;
2121
22- // // note: it doesn't escape frontmatter, it's up to you.
23- // return `# ${page.data.title}
24- // URL: ${page.url}
22+ // note: it doesn't escape frontmatter, it's up to you.
23+ return `# ${ page . data . title }
24+ URL: ${ page . url }
2525
26- // ${ processed.value}`;
27- // }
26+ ${ String ( processed . value ) } `;
27+ }
0 commit comments