diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt
index 59a074985..494f628a4 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt
@@ -111,26 +111,27 @@ object ChapterProvider {
)
}
} else if (book.getImageStyle() != Book.imgStyleText) {
- content.replace(AppPattern.imgPattern.toRegex(), "\n\$0\n")
- .split("\n").forEach { text ->
- if (text.isNotBlank()) {
- if (!text.startsWith("
+ if (!text.startsWith(""
)
appendPos = matcher.end()
@@ -78,7 +79,8 @@ object HtmlFormatter {
}
if (appendPos < keepImgHtml.length) {
- sb.append(keepImgHtml.substring(appendPos, keepImgHtml.length).replace("\n","\n ")) //非图片部分换行缩减
+ val beforeStr = keepImgHtml.substring(appendPos, keepImgHtml.length)
+ sb.append( if(beforeStr == "\n") '\n' else beforeStr.replace("\n","\n ") ) //缩进换行下个非图片段落
}
return sb.toString()
}