diff --git a/tools/server/public_simplechat/simplechat.css b/tools/server/public_simplechat/simplechat.css index 4789666a3e..9b46a30c76 100644 --- a/tools/server/public_simplechat/simplechat.css +++ b/tools/server/public_simplechat/simplechat.css @@ -125,6 +125,9 @@ body { word-break: break-word; hyphens: auto; } +.chat-message-content thead { + text-align: left; +} .chat-message-content-live { overflow-wrap: break-word; word-break: break-word; diff --git a/tools/server/public_simplechat/typemd.mjs b/tools/server/public_simplechat/typemd.mjs index f1cc075294..4020d91e21 100644 --- a/tools/server/public_simplechat/typemd.mjs +++ b/tools/server/public_simplechat/typemd.mjs @@ -32,25 +32,35 @@ export class MarkDown { } /** + * Try extract a table from markdown content, + * one line at a time. + * This is a imperfect logic, but should give a rough semblance of a table many a times. * @param {string} line */ process_table_line(line) { - //let lineParts = line.match(/^([|].*?)+?[|]$/) - let lineParts = line.match(/^[|](\s*[^|]*\s*[|])+$/) - if (lineParts != null) { + if (!line.startsWith("|")) { + if (this.in.table.columns > 0) { + this.html += "\n" + this.html += "\n" + this.in.table.columns = 0 + } + return false + } + let lineA = line.split('|') + if (lineA.length > 2) { if (this.in.table.columns == 0) { // table heading - this.html += "