ReadWebpageTool: fix newlines in codeblocks

This commit is contained in:
Alex Gleason committed 2025-08-21 13:38:53 -05:00
1 parent cc62c116a8
commit 79f11383f1
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';
export default {
meta: {
+1 -1
View File
@@ -39,7 +39,7 @@ export class ReadWebpageTool implements Tool<ReadWebpageParams> {
const codeElement = node.querySelector("code");
if (codeElement) {
const language = codeElement.className.match(/language-(\w+)/)?.[1] || "";
return `\n\n\`\`\`${language}\n${codeElement.textContent || content}\n\`\`\`\n\n`;
return `\n\n\`\`\`${language}\n${content}\n\`\`\`\n\n`;
}
return `\n\n\`\`\`\n${content}\n\`\`\`\n\n`;
},