|
|
@@ -40,6 +40,19 @@ export default class MarkdownTable {
|
|
|
return new MarkdownTable(newTable, this.options);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * normalize all cell data(trim & convert the newline character to space)
|
|
|
+ */
|
|
|
+ normalizeCells() {
|
|
|
+ for (let i = 0; i < this.table.length; i++) {
|
|
|
+ for (let j = 0; j < this.table[i].length; j++) {
|
|
|
+ this.table[i][j] = this.table[i][j].trim().replace(/\r?\n/g, ' ');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* return a MarkdownTable instance made from a string of HTML table tag
|
|
|
*
|