fix: escape llms docs titles

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>
This commit is contained in:
Devin AI 2026-07-18 23:46:05 +00:00
parent d20adaeef5
commit f6bdcd004d

View File

@ -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() {