diff --git a/extensions/table.c b/extensions/table.c
index add277166..e955b0d6d 100644
--- a/extensions/table.c
+++ b/extensions/table.c
@@ -578,10 +578,15 @@ static void html_render(cmark_syntax_extension *extension,
cmark_strbuf_putc(html, '>');
table_state->need_closing_table_body = false;
} else {
- if (table_state->need_closing_table_body)
+ if (table_state->need_closing_table_body) {
+ cmark_html_render_cr(html);
cmark_strbuf_puts(html, "");
+ cmark_html_render_cr(html);
+ }
table_state->need_closing_table_body = false;
- cmark_strbuf_puts(html, "\n");
+ cmark_html_render_cr(html);
+ cmark_strbuf_puts(html, "");
+ cmark_html_render_cr(html);
}
} else if (node->type == CMARK_NODE_TABLE_ROW) {
if (entering) {
diff --git a/test/extensions-table-prefer-style-attributes.txt b/test/extensions-table-prefer-style-attributes.txt
index 09cb7299a..0379def1b 100644
--- a/test/extensions-table-prefer-style-attributes.txt
+++ b/test/extensions-table-prefer-style-attributes.txt
@@ -32,5 +32,7 @@ fff | ggg | hhh | iii | jjj
hhh |
iii |
jjj |
-
+
+
+
````````````````````````````````
diff --git a/test/extensions.txt b/test/extensions.txt
index 6c8baefa1..5a1c3d990 100644
--- a/test/extensions.txt
+++ b/test/extensions.txt
@@ -31,7 +31,9 @@ Here's a well-formed table, doing everything it should.
| mno |
pqr |
-
+
+
+
````````````````````````````````
We're going to mix up the table now; we'll demonstrate that inline formatting
@@ -64,7 +66,9 @@ Hi!
| But inline elements do. |
x |
-
+
+
+
Hi!
````````````````````````````````
@@ -96,20 +100,23 @@ Here we demonstrate some edge cases about what is and isn't a table.
Just enough table |
to be considered table |
-
+
+
| ---- | --- |
+
+
+
+
````````````````````````````````
A "simpler" table, GFM style:
@@ -130,7 +137,9 @@ xyz | ghi
| xyz |
ghi |
-
+
+
+
````````````````````````````````
We are making the parser slighly more lax here. Here is a table with spaces at
@@ -162,7 +171,9 @@ Hi!
| But inline elements do. |
x |
-
+
+
+
Hi!
````````````````````````````````
@@ -190,7 +201,9 @@ fff | ggg | hhh | iii | jjj
hhh |
iii |
jjj |
-
+
+
+
````````````````````````````````
### Table cell count mismatches
@@ -240,7 +253,9 @@ than the header are truncated.
1 |
2 |
3 |
-
+
+
+
````````````````````````````````
### Embedded pipes
@@ -278,7 +293,9 @@ Tables with embedded pipes could be tricky.
| don't _reparse_ |
|
-
+
+
+
````````````````````````````````
### Oddly-formatted markers
@@ -294,7 +311,8 @@ This shouldn't assert.
| a |
-
+
+
````````````````````````````````
### Escaping
@@ -345,7 +363,9 @@ This shouldn't assert.
| \a |
\a |
-
+
+
+
\ \\
\\ \\\\
_ \_
@@ -373,7 +393,9 @@ This shouldn't assert.
ok sure |
-
+
+
+
````````````````````````````````
### Reference-style links
@@ -397,7 +419,9 @@ Here's a link to [Freedom Planet 2][].
| Here's a link to Freedom Planet 2 in a table row. |
-
+
+
+
````````````````````````````````
### Sequential cells
@@ -420,7 +444,9 @@ Here's a link to [Freedom Planet 2][].
d |
|
e |
-
+
+
+
````````````````````````````````
### Interaction with emphasis
@@ -441,7 +467,9 @@ Here's a link to [Freedom Planet 2][].
| (a) |
|
-
+
+
+
````````````````````````````````
@@ -670,5 +698,7 @@ Autolink and tables.
| https://github.com www.github.com |
http://pokemon.com |
-
+
+
+
````````````````````````````````
diff --git a/test/spec.txt b/test/spec.txt
index ded685d1a..01df54bee 100644
--- a/test/spec.txt
+++ b/test/spec.txt
@@ -3257,7 +3257,9 @@ right, or center alignment respectively.
| baz |
bim |
-
+
+
+
````````````````````````````````
Cells in one column don't need to match length, though it's easier to read if
@@ -3279,7 +3281,9 @@ bar | baz
| bar |
baz |
-
+
+
+
````````````````````````````````
Include a pipe in a cell's content by escaping it, including inside other
@@ -3303,7 +3307,9 @@ inline spans:
| b | im |
-
+
+
+
````````````````````````````````
The table is broken at the first empty line, or beginning of another
@@ -3326,7 +3332,9 @@ block-level structure:
| bar |
baz |
-
+
+
+
bar
@@ -3355,7 +3363,9 @@ bar
| bar |
|
-
+
+
+
bar
````````````````````````````````
@@ -3397,7 +3407,9 @@ cells are inserted. If there are greater, the excess is ignored:
| bar |
baz |
-
+
+
+
````````````````````````````````
If there are no rows in the body, no `` is generated in HTML output:
@@ -3412,7 +3424,8 @@ If there are no rows in the body, no `` is generated in HTML output:
abc |
def |
-
+
+
````````````````````````````````