FIX: Remove linebreaks from cell data (#48)

Pasting text with linebreaks into the table UI results in incorrectly
generated table markdown.

This fix strips linebreaks from text during table markdown generation.
This commit is contained in:
Selase Krakani
2023-02-27 15:49:55 +00:00
committed by GitHub
parent 4c6b020fd8
commit 850e31c83d
2 changed files with 23 additions and 3 deletions
@@ -33,13 +33,14 @@ export function arrayToTable(array, cols, colPrefix = "col") {
table +=
cols
.map(function (_key, index) {
return String(item[`${colPrefix}${index}`] || "");
return String(item[`${colPrefix}${index}`] || "").replace(
/\r?\n|\r/g,
" "
);
})
.join(" | ") + "|\r\n";
});
// Return table
console.log(table);
return table;
}