diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-09-19 10:33:13 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-09-19 10:39:55 -0400 |
commit | 2eb320f48a66b42832b758e5fc6700358aef34ed (patch) | |
tree | a23b380af7cc82c2330daad6c18153c2966267c3 /web/react/utils/markdown.jsx | |
parent | efb3462a683d1f4d88c56327b14256adda11115d (diff) | |
download | chat-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.jsx | 14 |
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); + } +} |