1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

All: Convert new lines in tables to BR tag, and added support for HTML tags in Markdown viewers

This commit is contained in:
Laurent Cozic
2018-02-17 19:28:24 +00:00
parent 90bcd7c977
commit eca500880d
2 changed files with 8 additions and 6 deletions

View File

@@ -617,10 +617,6 @@ function enexXmlToMdArray(stream, resources) {
});
}
function removeTableCellNewLines(cellText) {
return cellText.replace(/\n+/g, " ");
}
function tableHasSubTables(table) {
for (let trIndex = 0; trIndex < table.lines.length; trIndex++) {
const tr = table.lines[trIndex];
@@ -689,8 +685,9 @@ function drawTable(table) {
line.push(BLOCK_CLOSE);
} else { // Regular table rendering
// A cell in a Markdown table cannot have new lines so remove them
const cellText = removeTableCellNewLines(processMdArrayNewLines(td.lines));
// A cell in a Markdown table cannot have actual new lines so replace
// them with <br>, which are supported by the markdown renderers.
const cellText = processMdArrayNewLines(td.lines).replace(/\n+/g, "<br>");
const width = Math.max(cellText.length, 3);
line.push(stringPadding(cellText, width, ' ', stringPadding.RIGHT));