-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
95 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ words: | |
- Hunyuan | ||
- importantimport | ||
- koemotion | ||
- llms | ||
- masknet | ||
- ministral | ||
- mistralai | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import fg from 'fast-glob' | ||
import { remarkInstall } from 'fumadocs-docgen' | ||
import { remarkInclude } from 'fumadocs-mdx/config' | ||
import matter from 'gray-matter' | ||
import { readFile } from 'node:fs/promises' | ||
import { remark } from 'remark' | ||
import remarkGfm from 'remark-gfm' | ||
import remarkMdx from 'remark-mdx' | ||
import remarkStringify from 'remark-stringify' | ||
|
||
export const revalidate = false | ||
|
||
const processContent = async (content: string) => String(await remark() | ||
.use(remarkMdx) | ||
// https://fumadocs.vercel.app/docs/mdx/include | ||
.use(remarkInclude) | ||
// gfm styles | ||
.use(remarkGfm) | ||
// your remark plugins | ||
.use(remarkInstall, { persist: { id: 'package-manager' } }) | ||
// to string | ||
.use(remarkStringify) | ||
.process(content)) | ||
|
||
/** @see {@link https://fumadocs.vercel.app/docs/ui/llms} */ | ||
export const GET = async () => { | ||
// all scanned content | ||
const files = await fg(['./content/docs/**/*.mdx']) | ||
|
||
const scan = files.map(async (file) => { | ||
const fileContent = await readFile(file) | ||
const { content, data } = matter(fileContent.toString()) | ||
const processed = await processContent(content) | ||
return [ | ||
`file: ${file}`, | ||
`meta: ${JSON.stringify(data, null, 2)}`, | ||
'', | ||
processed, | ||
].join('\n') | ||
}) | ||
|
||
const scanned = await Promise.all(scan) | ||
|
||
return new Response(scanned.join('\n\n')) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.