处理 Markdown 空白行格式
兼容带空格的连续空行,保留 Markdown 段落分隔语义
This commit is contained in:
@@ -20,7 +20,9 @@ function normalizeMarkdownBlankLines(text: string) {
|
||||
return text
|
||||
.split(/(```[\s\S]*?```)/g)
|
||||
.map((part, index) =>
|
||||
index % 2 === 1 ? part : part.replace(/\n{3,}/g, '\n\n'),
|
||||
index % 2 === 1
|
||||
? part
|
||||
: part.replace(/[ \t]*\n(?:[ \t]*\n){2,}/g, '\n\n'),
|
||||
)
|
||||
.join('');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user