From 4d37a0a3675924d9aca85624565c10070dea2ee8 Mon Sep 17 00:00:00 2001 From: Ken Sheedlo Date: Tue, 25 Oct 2016 18:27:19 -0700 Subject: [PATCH] Pass header flag to Renderer.tablerow method When styling tables out of a custom renderer subclass, it's useful to know if the tablerow is in the header or body. Tablecells already get a header flag that is set if the tablecell is in the header. This change adds the flag to tablerows. --- lib/marked.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/marked.js b/lib/marked.js index 9f1584bb3b..fa79f01e6c 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -1009,7 +1009,9 @@ Parser.prototype.tok = function() { { header: true, align: this.token.align[i] } ); } - header += this.renderer.tablerow(cell); + // header flag is not used in Renderer.prototype.tablerow, but passed + // here to make available to Renderer subclasses. + header += this.renderer.tablerow(cell, {header: true}); for (i = 0; i < this.token.cells.length; i++) { row = this.token.cells[i]; @@ -1022,7 +1024,7 @@ Parser.prototype.tok = function() { ); } - body += this.renderer.tablerow(cell); + body += this.renderer.tablerow(cell, {header: false}); } return this.renderer.table(header, body); }