summaryrefslogtreecommitdiffstats
path: root/web/react/utils/markdown.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/utils/markdown.jsx')
-rw-r--r--web/react/utils/markdown.jsx22
1 files changed, 22 insertions, 0 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx
new file mode 100644
index 000000000..96da54217
--- /dev/null
+++ b/web/react/utils/markdown.jsx
@@ -0,0 +1,22 @@
+// 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) {
+ let outHref = href;
+
+ if (outHref.lastIndexOf('http', 0) !== 0) {
+ outHref = `http://${outHref}`;
+ }
+
+ let output = '<a class="theme" href="' + outHref + '"';
+ if (title) {
+ output += ' title="' + title + '"';
+ }
+ output += '>' + text + '</a>';
+
+ return output;
+ }
+}