From 2eb320f48a66b42832b758e5fc6700358aef34ed Mon Sep 17 00:00:00 2001 From: hmhealey Date: Sat, 19 Sep 2015 10:33:13 -0400 Subject: Changed markdown link parsing to automatically add an explicit protocol to urls --- web/react/utils/markdown.jsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 web/react/utils/markdown.jsx (limited to 'web/react/utils/markdown.jsx') 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); + } +} -- cgit v1.2.3-1-g7c22