File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,15 @@ function flankingWhitespace (node) {
22
22
var trailing = ''
23
23
24
24
if ( ! node . isBlock ) {
25
- var hasLeading = / ^ [ \r \n \t ] / . test ( node . textContent )
26
- var hasTrailing = / [ \r \n \t ] $ / . test ( node . textContent )
25
+ var hasLeading = / ^ \s / . test ( node . textContent )
26
+ var hasTrailing = / \s $ / . test ( node . textContent )
27
+ var blankWithSpaces = node . isBlank && hasLeading && hasTrailing
27
28
28
29
if ( hasLeading && ! isFlankedByWhitespace ( 'left' , node ) ) {
29
30
leading = ' '
30
31
}
31
- if ( hasTrailing && ! isFlankedByWhitespace ( 'right' , node ) ) {
32
+
33
+ if ( ! blankWithSpaces && hasTrailing && ! isFlankedByWhitespace ( 'right' , node ) ) {
32
34
trailing = ' '
33
35
}
34
36
}
Original file line number Diff line number Diff line change @@ -888,6 +888,20 @@ <h2>This is a header.</h2>
888
888
< pre class ="expected "> </ pre >
889
889
</ div >
890
890
891
+ < div class ="case " data-name ="text separated by a space in an element ">
892
+ < div class ="input ">
893
+ < p > Foo< span > </ span > Bar</ p >
894
+ </ div >
895
+ < pre class ="expected "> Foo Bar</ pre >
896
+ </ div >
897
+
898
+ < div class ="case " data-name ="text separated by a non-breaking space in an element ">
899
+ < div class ="input ">
900
+ < p > Foo< span > </ span > Bar</ p >
901
+ </ div >
902
+ < pre class ="expected "> Foo Bar</ pre >
903
+ </ div >
904
+
891
905
<!-- /TEST CASES -->
892
906
893
907
< script src ="turndown-test.browser.js "> </ script >
You can’t perform that action at this time.
0 commit comments