Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
wljince007 committed Apr 8, 2024
1 parent f5a016a commit 73c23f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/turndown/src/turndown.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ function replacementForNode (node, previousNode) {
// Fix: Web clipper has trouble with code blocks on Joplin's website.
// See https://github.com/laurent22/joplin/pull/10126#issuecomment-2016523281 .
// if isCode, keep line breaks
//test case: packages/app-cli/tests/html_to_md/code_multiline_3.html (from https://joplinapp.org/help/api/tutorials/toc_plugin/)
//test case: packages/app-cli/tests/html_to_md/code_multiline_3.html

//If the leading blank or leading blank of the current node Including line breaks, and the leading blank of the current node is equal to the leading blank of it's first child node, and the trailing blank of the current node is equal to the leading blank of it's last child node, it indicates that the leading blank and leading blank of this current node is from it's child nodes, so should not be added repeatedly, this remove multiple line breaks.
//test case: packages/app-cli/tests/html_to_md/code_multiline_5.html (from https://www.slingacademy.com/article/python-aiohttp-how-to-download-files-using-streams/)
//test case: packages/app-cli/tests/html_to_md/code_multiline_5.html
if ( (whitespace.leading.indexOf('\n')!=-1 || whitespace.trailing.indexOf('\n')!=-1) &&
node.childNodes && node.childNodes.length>0) {

Expand Down

0 comments on commit 73c23f2

Please sign in to comment.