From 511fcce55345adb2a6b05cf058fd4d238abcc521 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Wed, 23 Sep 2015 17:42:57 -0400
Subject: Restricted markdown output to only appear on one line when in
 singleline mode

---
 web/react/utils/markdown.jsx | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

(limited to 'web/react/utils/markdown.jsx')

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>`;
     }
-- 
cgit v1.2.3-1-g7c22

