summaryrefslogtreecommitdiffstats
path: root/web/react
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-09-23 17:42:57 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-09-23 17:42:57 -0400
commit511fcce55345adb2a6b05cf058fd4d238abcc521 (patch)
tree83fdb02089198f4e07c07becdac72a0be62fd6cd /web/react
parentf9abb5a94ae2caf6e3037ac9f716813a36e401fe (diff)
downloadchat-511fcce55345adb2a6b05cf058fd4d238abcc521.tar.gz
chat-511fcce55345adb2a6b05cf058fd4d238abcc521.tar.bz2
chat-511fcce55345adb2a6b05cf058fd4d238abcc521.zip
Restricted markdown output to only appear on one line when in singleline mode
Diffstat (limited to 'web/react')
-rw-r--r--web/react/utils/markdown.jsx16
1 files changed, 16 insertions, 0 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
index 347024e1a..8b511cd07 100644
--- a/web/react/utils/markdown.jsx
+++ b/web/react/utils/markdown.jsx
@@ -15,6 +15,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
this.formattingOptions = formattingOptions;
}
+ br() {
+ if (this.formattingOptions.singleline) {
+ return ' ';
+ }
+
+ return super.br();
+ }
+
heading(text, level, raw) {
const id = `${this.options.headerPrefix}${raw.toLowerCase().replace(/[^\w]+/g, '-')}`;
return `<h${level} id="${id}" class="markdown__heading">${text}</h${level}>`;
@@ -36,6 +44,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer {
return output;
}
+ paragraph(text) {
+ if (this.formattingOptions.singleline) {
+ return `<p class="markdown__paragraph-inline">${text}</p>`;
+ }
+
+ return super.paragraph(text);
+ }
+
table(header, body) {
return `<table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table>`;
}