diff --git a/spec/MarkdownTableFormatterSpec.js b/spec/MarkdownTableFormatterSpec.js index 96adae6..e69ff4f 100644 --- a/spec/MarkdownTableFormatterSpec.js +++ b/spec/MarkdownTableFormatterSpec.js @@ -326,6 +326,21 @@ describe("MarkdownTableFormatter", function() { }); + it("should keep escaped pipes on the same cells", function() { + + table = "| h1 | h2 |\n"; + table += "|-------------|--------|\n"; + table += "| a | b \\| c |\n"; + table += "| a \\| b \\| c | d |\n"; + + // WHEN + mtf.format_table(table); + + // THEN + expect(mtf.output_table).toEqual(table); + + }); + }); }); diff --git a/src/MarkdownTableFormatter.js b/src/MarkdownTableFormatter.js index bf995f5..9feb410 100644 --- a/src/MarkdownTableFormatter.js +++ b/src/MarkdownTableFormatter.js @@ -93,7 +93,7 @@ MarkdownTableFormatter.prototype.import_table = function(table) { this.cells[row_i] = new Array(); - var row_columns = table_rows[row_i].split("\|"); + var row_columns = table_rows[row_i].split(/(?