mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
fix: docs
This commit is contained in:
1 parent
689985ed93
commit
ba6a83a9cb
1 file changed
+10
-4
@@ -15,11 +15,17 @@ const api = defineCollection({
|
||||
for (const path in globbed) {
|
||||
const id = path.replace("./pages/api/", "").replace(".ts", "");
|
||||
const body = (globbed[path] as string).replaceAll("\r\n", "\n");
|
||||
const docs = body.match(
|
||||
/\/\*\*\n((( \*.*)\n)+) \*\/\nexport (async )?function GET\(/
|
||||
)?[1].spl;
|
||||
const docs = body
|
||||
.match(
|
||||
/\/\*\*\n((( \*.*)\n)+) \*\/\nexport (async )?function GET\(/,
|
||||
)?.[1]
|
||||
.split("\n")
|
||||
.map((line) => line.replace(/ \* ?/, ""))
|
||||
.join("\n");
|
||||
|
||||
paths.push({ id, body, docs: docs?.[1] ?? undefined });
|
||||
if (!docs) continue;
|
||||
|
||||
paths.push({ id, body: docs });
|
||||
}
|
||||
|
||||
return paths;
|
||||
|
||||
Reference in new issue
Block a user