修复 Markdown 换行归一化
先统一 CRLF 与 LF,再压缩正文中的多余空行
This commit is contained in:
@@ -18,6 +18,7 @@ export type ChatMarkdownMessageProps = {
|
||||
/** 只压缩普通 Markdown 正文里多余的空行;代码块中的换行必须原样保留。 */
|
||||
function normalizeMarkdownBlankLines(text: string) {
|
||||
return text
|
||||
.replace(/\r\n?/g, '\n')
|
||||
.split(/(```[\s\S]*?```)/g)
|
||||
.map((part, index) =>
|
||||
index % 2 === 1
|
||||
|
||||
Reference in New Issue
Block a user