summaryrefslogtreecommitdiffstats
path: root/web/react/utils/text_formatting.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2015-10-13 15:17:13 -0400
committerJoram Wilander <jwawilander@gmail.com>2015-10-13 15:17:13 -0400
commit09a559937536c14ed61f8c692fbfcb56d19483b3 (patch)
treecedf10e9843cae5ff24f4940f5811cc56dadd53f /web/react/utils/text_formatting.jsx
parent4935112a4711d0ec40a6da37766a10cccb702c2e (diff)
parent17d37816d42f93c42187787397c7d4060b2b943d (diff)
downloadchat-09a559937536c14ed61f8c692fbfcb56d19483b3.tar.gz
chat-09a559937536c14ed61f8c692fbfcb56d19483b3.tar.bz2
chat-09a559937536c14ed61f8c692fbfcb56d19483b3.zip
Merge pull request #1037 from hmhealey/revert987
Revert #987
Diffstat (limited to 'web/react/utils/text_formatting.jsx')
-rw-r--r--web/react/utils/text_formatting.jsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx
index 6778d341a..2b6e6e14e 100644
--- a/web/react/utils/text_formatting.jsx
+++ b/web/react/utils/text_formatting.jsx
@@ -8,6 +8,8 @@ const Markdown = require('./markdown.jsx');
const UserStore = require('../stores/user_store.jsx');
const Utils = require('./utils.jsx');
+const marked = require('marked');
+
// Performs formatting of user posts including highlighting mentions and search terms and converting urls, hashtags, and
// @mentions to links by taking a user's message and returning a string of formatted html. Also takes a number of options
// as part of the second parameter:
@@ -20,8 +22,11 @@ export function formatText(text, options = {}) {
let output;
if (!('markdown' in options) || options.markdown) {
- // the markdown renderer will call doFormatText as necessary
- output = Markdown.format(text, options);
+ // the markdown renderer will call doFormatText as necessary so just call marked
+ output = marked(text, {
+ renderer: new Markdown.MattermostMarkdownRenderer(null, options),
+ sanitize: true
+ });
} else {
output = sanitizeHtml(text);
output = doFormatText(output, options);