Skip to content

Commit

Permalink
Add tests for tables from cmark-gfm
Browse files Browse the repository at this point in the history
I also had to update the output of the HTML renderer to match changes made in github/cmark-gfm@1470c30, and our existing table tests needed to be updated for that as well.
  • Loading branch information
hmhealey committed Oct 25, 2024
1 parent 6d239b1 commit 2148a1a
Show file tree
Hide file tree
Showing 6 changed files with 705 additions and 63 deletions.
7 changes: 5 additions & 2 deletions dist/commonmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -15809,12 +15809,15 @@
this.cr();
} else {
this.tag("/tr");
this.cr();

if (node === node.parent.firstChild) {
this.cr(); // we're not consistent about how these tags are laid out because this is what GitHub does
this.tag("/thead");
this.cr();
} else if (node === node.parent.lastChild) {
this.tag("/tbody");
this.cr();
}
}
}
Expand Down Expand Up @@ -15949,7 +15952,7 @@

this.indentLevel = 0;
this.indent = " ";

this.esc = options.esc || escapeXml;
// escape html with a custom function
// else use escapeXml
Expand Down Expand Up @@ -16048,7 +16051,7 @@
attrs.push(["on_exit", node.onExit]);
break;
}
{
if (options.sourcepos) {
var pos = node.sourcepos;
if (pos) {
attrs.push([
Expand Down
2 changes: 1 addition & 1 deletion dist/commonmark.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lib/render/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,15 @@ function table_row(node, entering) {
this.cr();
} else {
this.tag("/tr");
this.cr();

if (node === node.parent.firstChild) {
this.cr(); // we're not consistent about how these tags are laid out because this is what GitHub does
this.tag("/thead");
this.cr();
} else if (node === node.parent.lastChild) {
this.tag("/tbody");
this.cr();
}
}
}
Expand Down
Loading

0 comments on commit 2148a1a

Please sign in to comment.