mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2025-12-26 06:28:56 +08:00
fix: normalize url
This commit is contained in:
parent
01705291c4
commit
767c0b37ef
@ -223,7 +223,6 @@ export function smartMergeStrings(str1: string, str2: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function fixCodeBlockIndentation(markdownText: string): string {
|
||||
// Track the state of code blocks and their indentation
|
||||
const lines = markdownText.split('\n');
|
||||
@ -256,8 +255,21 @@ export function fixCodeBlockIndentation(markdownText: string): string {
|
||||
result.push(line);
|
||||
}
|
||||
}
|
||||
} else if (codeBlockStack.length > 0) {
|
||||
// Inside a code block - adjust indentation to match opening fence
|
||||
const openingBlock = codeBlockStack[codeBlockStack.length - 1];
|
||||
|
||||
// Only adjust non-empty lines
|
||||
if (line.trim().length > 0) {
|
||||
// Remove any existing indentation and apply the opening fence indentation
|
||||
const trimmedLine = line.trimStart();
|
||||
result.push(`${openingBlock.indent}${trimmedLine}`);
|
||||
} else {
|
||||
// For empty lines, just keep them as is
|
||||
result.push(line);
|
||||
}
|
||||
} else {
|
||||
// Not a code fence line, just add it as is
|
||||
// Not in a code block, just add it as is
|
||||
result.push(line);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user