Skip to content

Commit d25e129

Browse files
authored
Remove trailing space from paragraphs, headings, html blocks (flutter#321)
1 parent 813fcf2 commit d25e129

13 files changed

+22
-24
lines changed

lib/src/block_parser.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class SetextHeaderSyntax extends BlockSyntax {
282282
}
283283
}
284284

285-
var contents = UnparsedContent(lines.join('\n'));
285+
var contents = UnparsedContent(lines.join('\n').trimRight());
286286

287287
return Element(tag /*!*/, [contents]);
288288
}
@@ -587,7 +587,7 @@ class BlockTagBlockHtmlSyntax extends BlockHtmlSyntax {
587587
parser.advance();
588588
}
589589

590-
return Text(childLines.join('\n'));
590+
return Text(childLines.join('\n').trimRight());
591591
}
592592
}
593593

@@ -634,7 +634,7 @@ class LongBlockHtmlSyntax extends BlockHtmlSyntax {
634634
}
635635

636636
parser.advance();
637-
return Text(childLines.join('\n'));
637+
return Text(childLines.join('\n').trimRight());
638638
}
639639
}
640640

@@ -1094,7 +1094,7 @@ class ParagraphSyntax extends BlockSyntax {
10941094
// Paragraph consisted solely of reference link definitions.
10951095
return Text('');
10961096
} else {
1097-
var contents = UnparsedContent(paragraphLines.join('\n'));
1097+
var contents = UnparsedContent(paragraphLines.join('\n').trimRight());
10981098
return Element('p', [contents]);
10991099
}
11001100
}

test/common_mark/hard_line_breaks.unit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ foo\
6969
>>> Hard line breaks - 642
7070
foo
7171
<<<
72-
<p>foo </p>
72+
<p>foo</p>
7373
>>> Hard line breaks - 643
7474
### foo\
7575
<<<

test/common_mark/html_blocks.unit

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ foo
226226
type="text/css">
227227

228228
foo
229-
230229
>>> HTML blocks - 143
231230
> <div>
232231
> foo

test/common_mark/paragraphs.unit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ aaa
5656
bbb
5757
<<<
5858
<p>aaa<br />
59-
bbb </p>
59+
bbb</p>

test/common_mark/setext_headings.unit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ baz*
2020
====
2121
<<<
2222
<h1> Foo <em>bar
23-
baz</em> </h1>
23+
baz</em></h1>
2424
>>> Setext headings - 53
2525
Foo
2626
-------------------------
@@ -82,7 +82,7 @@ Foo
8282
Foo
8383
-----
8484
<<<
85-
<h2>Foo </h2>
85+
<h2>Foo</h2>
8686
>>> Setext headings - 60
8787
Foo\
8888
----

test/gfm/hard_line_breaks.unit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ foo\
6969
>>> Hard line breaks - 666
7070
foo
7171
<<<
72-
<p>foo </p>
72+
<p>foo</p>
7373
>>> Hard line breaks - 667
7474
### foo\
7575
<<<

test/gfm/html_blocks.unit

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ foo
226226
type="text/css">
227227

228228
foo
229-
230229
>>> HTML blocks - 143
231230
> <div>
232231
> foo

test/gfm/paragraphs.unit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ aaa
5656
bbb
5757
<<<
5858
<p>aaa<br />
59-
bbb </p>
59+
bbb</p>

test/gfm/setext_headings.unit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ baz*
2020
====
2121
<<<
2222
<h1> Foo <em>bar
23-
baz</em> </h1>
23+
baz</em></h1>
2424
>>> Setext headings - 53
2525
Foo
2626
-------------------------
@@ -82,7 +82,7 @@ Foo
8282
Foo
8383
-----
8484
<<<
85-
<h2>Foo </h2>
85+
<h2>Foo</h2>
8686
>>> Setext headings - 60
8787
Foo\
8888
----

tool/common_mark_stats.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@
305305
"639": "strict",
306306
"640": "strict",
307307
"641": "strict",
308-
"642": "loose",
308+
"642": "strict",
309309
"643": "strict",
310310
"644": "strict"
311311
},
@@ -334,7 +334,7 @@
334334
"139": "strict",
335335
"140": "strict",
336336
"141": "strict",
337-
"142": "loose",
337+
"142": "strict",
338338
"143": "loose",
339339
"144": "loose",
340340
"145": "strict",
@@ -600,7 +600,7 @@
600600
"193": "strict",
601601
"194": "strict",
602602
"195": "strict",
603-
"196": "loose"
603+
"196": "strict"
604604
},
605605
"Precedence": {
606606
"12": "strict"
@@ -638,7 +638,7 @@
638638
"56": "strict",
639639
"57": "strict",
640640
"58": "strict",
641-
"59": "loose",
641+
"59": "strict",
642642
"60": "strict",
643643
"61": "loose",
644644
"62": "strict",

0 commit comments

Comments
 (0)