修复段落分割逻辑,支持单双换行
This commit is contained in:
parent
49a4bcea3d
commit
d1c64f7327
@ -347,8 +347,9 @@
|
||||
const chapter = await response.json();
|
||||
|
||||
// 将纯文本转换为HTML(每段包裹<p>标签)
|
||||
// 支持单换行或双换行作为段落分隔
|
||||
const htmlContent = chapter.content
|
||||
.split('\n\n')
|
||||
.split(/\n\n|\n/)
|
||||
.filter(p => p.trim())
|
||||
.map(p => `<p>${p.trim()}</p>`)
|
||||
.join('');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user