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 11module . exports = indentLines
22
3- var blank = / ^ [ \t ] * $ /
43var eol = / \r ? \n | \r / g
54
65function indentLines ( value , map ) {
@@ -21,6 +20,6 @@ function indentLines(value, map) {
2120 return result . join ( '' )
2221
2322 function one ( value ) {
24- result . push ( map ( value , line , blank . test ( value ) ) )
23+ result . push ( map ( value , line , ! value ) )
2524 }
2625}
Original file line number Diff line number Diff line change @@ -2522,5 +2522,22 @@ test('roundtrip', function (t) {
25222522
25232523 t . equal ( to ( from ( doc ) ) , doc , 'should roundtrip lists with break comments' )
25242524
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+
25252542 t . end ( )
25262543} )
You can’t perform that action at this time.
0 commit comments