File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
1
module . exports = indentLines
2
2
3
- var blank = / ^ [ \t ] * $ /
4
3
var eol = / \r ? \n | \r / g
5
4
6
5
function indentLines ( value , map ) {
@@ -21,6 +20,6 @@ function indentLines(value, map) {
21
20
return result . join ( '' )
22
21
23
22
function one ( value ) {
24
- result . push ( map ( value , line , blank . test ( value ) ) )
23
+ result . push ( map ( value , line , ! value ) )
25
24
}
26
25
}
Original file line number Diff line number Diff line change @@ -2522,5 +2522,22 @@ test('roundtrip', function (t) {
2522
2522
2523
2523
t . equal ( to ( from ( doc ) ) , doc , 'should roundtrip lists with break comments' )
2524
2524
2525
+ // The first one could have (up to) four spaces, but it doesn’t add anything,
2526
+ // so we don’t roundtrip it.
2527
+ doc = [
2528
+ ' <h3>Header 3</h3>' ,
2529
+ '' ,
2530
+ ' <blockquote>' ,
2531
+ ' <p>This is a blockquote.</p>' ,
2532
+ ' ' ,
2533
+ ' <p>This is the second paragraph in the blockquote.</p>' ,
2534
+ ' ' ,
2535
+ ' <h2>This is an H2 in a blockquote</h2>' ,
2536
+ ' </blockquote>' ,
2537
+ ''
2538
+ ] . join ( '\n' )
2539
+
2540
+ t . equal ( to ( from ( doc ) ) , doc , 'should roundtrip indented blank lines in code' )
2541
+
2525
2542
t . end ( )
2526
2543
} )
You can’t perform that action at this time.
0 commit comments