Skip to content

Commit 30ec916

Browse files
committed
Collect markdown parts as a array
1 parent e78643a commit 30ec916

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/paste-markdown-html.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ function transform(
4848
transformer: MarkdownTransformer,
4949
...args: string[]
5050
): string {
51-
let markdown = ''
51+
const markdownParts = []
5252
for (const element of elements) {
5353
const textContent = element.textContent || ''
5454
const {part, index} = trimAfter(text, textContent)
55-
markdown += part.replace(textContent, transformer(element, args))
55+
markdownParts.push(part.replace(textContent, transformer(element, args)))
5656
text = text.slice(index)
5757
}
58-
markdown += text
59-
return markdown
58+
markdownParts.join(text)
59+
return markdownParts.join('')
6060
}
6161

6262
// Trim text at index of last character of the first occurrence of "search" and

0 commit comments

Comments
 (0)