diff --git a/docs/src/app/llms.txt/route.ts b/docs/src/app/llms.txt/route.ts index c2e4a2c8e..6c5923ee2 100644 --- a/docs/src/app/llms.txt/route.ts +++ b/docs/src/app/llms.txt/route.ts @@ -10,9 +10,13 @@ function formatPageListItem(page: { }; url: string; }) { + const title = page.data.title + .replace(/\\/g, '\\\\') + .replace(/[\[\]]/g, (match) => `\\${match}`) + .replace(/\n+/g, ' '); const description = page.data.description?.trim(); const notes = description ? `: ${description.replace(/\n+/g, ' ')}` : ''; - return `- [${page.data.title}](https://docs.hexclave.com${page.url}.md)${notes}`; + return `- [${title}](https://docs.hexclave.com${page.url}.md)${notes}`; } export async function GET() {