Changed markdown link parsing to automatically add an explicit protocol to urls

Этот коммит содержится в:
hmhealey
2015-09-19 10:33:13 -04:00
родитель efb3462a68
Коммит 2eb320f48a
2 изменённых файлов: 16 добавлений и 1 удалений

14
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);
}
}