diff --git a/src/renderer/src/lib/parse-html.ts b/src/renderer/src/lib/parse-html.ts
index 1f464e12b..dac2fc750 100644
--- a/src/renderer/src/lib/parse-html.ts
+++ b/src/renderer/src/lib/parse-html.ts
@@ -182,9 +182,27 @@ function extractCodeFromHtml(htmlString: string) {
// 2. line wrapper like ...
const spanElements = tempDiv.querySelectorAll("span > span")
+ // 2.1 outside as a line break?
+
+ let spanAsLineBreak = false
+
+ if (tempDiv.children.length > 2) {
+ for (const node of tempDiv.children) {
+ const span = node as HTMLSpanElement
+ // 2.2 If the span has only one child and it's a line break, then span can be as a line break
+ spanAsLineBreak =
+ span.children.length === 1 &&
+ span.childNodes.item(0).textContent === "\n"
+ if (spanAsLineBreak) break
+ }
+ }
if (spanElements.length > 0) {
for (const node of tempDiv.children) {
- code += `${node.textContent}\n`
+ if (spanAsLineBreak) {
+ code += `${node.textContent}`
+ } else {
+ code += `${node.textContent}\n`
+ }
}
return code