diff --git a/extensions/table.c b/extensions/table.c index f6d3e7a07..6b50959c5 100644 --- a/extensions/table.c +++ b/extensions/table.c @@ -577,6 +577,10 @@ static void html_render(cmark_syntax_extension *extension, table_state->in_table_header = 1; cmark_strbuf_puts(html, ""); cmark_html_render_cr(html); + } else if (!table_state->need_closing_table_body) { + cmark_strbuf_puts(html, ""); + cmark_html_render_cr(html); + table_state->need_closing_table_body = 1; } cmark_strbuf_puts(html, "as.opaque)->is_header) { cmark_html_render_cr(html); cmark_strbuf_puts(html, ""); - cmark_html_render_cr(html); - cmark_strbuf_puts(html, ""); - table_state->need_closing_table_body = 1; table_state->in_table_header = false; } } diff --git a/test/extensions.txt b/test/extensions.txt index 4340b618f..3c783cf34 100644 --- a/test/extensions.txt +++ b/test/extensions.txt @@ -96,23 +96,20 @@ Here we demonstrate some edge cases about what is and isn't a table. Just enough table to be considered table - - +

| ---- | --- |

- -
x
+ - -
xyz
+ ```````````````````````````````` A "simpler" table, GFM style: @@ -297,8 +294,7 @@ This shouldn't assert. a - - + ```````````````````````````````` ### Escaping diff --git a/test/spec.txt b/test/spec.txt index babf3c8c9..670fe58ab 100644 --- a/test/spec.txt +++ b/test/spec.txt @@ -3399,6 +3399,21 @@ cells are inserted. If there are greater, the excess is ignored: ```````````````````````````````` +If there are no rows in the body, no `` is generated in HTML output: + +```````````````````````````````` example table +| abc | def | +| --- | --- | +. + + + + + + +
abcdef
+```````````````````````````````` + # Container blocks