summaryrefslogtreecommitdiffstats
path: root/web/react/utils/markdown.jsx
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-09-19 10:33:13 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-09-19 10:39:55 -0400
commit2eb320f48a66b42832b758e5fc6700358aef34ed (patch)
treea23b380af7cc82c2330daad6c18153c2966267c3 /web/react/utils/markdown.jsx
parentefb3462a683d1f4d88c56327b14256adda11115d (diff)
downloadchat-2eb320f48a66b42832b758e5fc6700358aef34ed.tar.gz
chat-2eb320f48a66b42832b758e5fc6700358aef34ed.tar.bz2
chat-2eb320f48a66b42832b758e5fc6700358aef34ed.zip
Changed markdown link parsing to automatically add an explicit protocol to urls
Diffstat (limited to 'web/react/utils/markdown.jsx')
-rw-r--r--web/react/utils/markdown.jsx14
1 files changed, 14 insertions, 0 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
new file mode 100644
index 000000000..880e41a18
--- /dev/null
+++ b/web/react/utils/markdown.jsx
@@ -0,0 +1,14 @@
+// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+const marked = require('marked');
+
+export class MattermostMarkdownRenderer extends marked.Renderer {
+ link(href, title, text) {
+ if (href.lastIndexOf('http', 0) !== 0) {
+ href = `http://${href}`;
+ }
+
+ return super.link(href, title, text);
+ }
+}