diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-10-13 15:17:13 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-10-13 15:17:13 -0400 |
commit | 09a559937536c14ed61f8c692fbfcb56d19483b3 (patch) | |
tree | cedf10e9843cae5ff24f4940f5811cc56dadd53f /web/react/utils/markdown.jsx | |
parent | 4935112a4711d0ec40a6da37766a10cccb702c2e (diff) | |
parent | 17d37816d42f93c42187787397c7d4060b2b943d (diff) | |
download | chat-09a559937536c14ed61f8c692fbfcb56d19483b3.tar.gz chat-09a559937536c14ed61f8c692fbfcb56d19483b3.tar.bz2 chat-09a559937536c14ed61f8c692fbfcb56d19483b3.zip |
Merge pull request #1037 from hmhealey/revert987
Revert #987
Diffstat (limited to 'web/react/utils/markdown.jsx')
-rw-r--r-- | web/react/utils/markdown.jsx | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx index 848b1ea75..12d6dd424 100644 --- a/web/react/utils/markdown.jsx +++ b/web/react/utils/markdown.jsx @@ -6,31 +6,7 @@ const Utils = require('./utils.jsx'); const marked = require('marked'); -class MattermostInlineLexer extends marked.InlineLexer { - constructor(links, options) { - super(links, options); - - // modified version of the regex that doesn't break up words in snake_case - // the original is /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/ - this.rules.text = /^[\s\S]+?(?=__|\b_|[\\<!\[*`]| {2,}\n|$)/; - } -} - -class MattermostParser extends marked.Parser { - parse(src) { - this.inline = new MattermostInlineLexer(src.links, this.options, this.renderer); - this.tokens = src.reverse(); - - var out = ''; - while (this.next()) { - out += this.tok(); - } - - return out; - } -} - -class MattermostMarkdownRenderer extends marked.Renderer { +export class MattermostMarkdownRenderer extends marked.Renderer { constructor(options, formattingOptions = {}) { super(options); @@ -92,15 +68,3 @@ class MattermostMarkdownRenderer extends marked.Renderer { return TextFormatting.doFormatText(text, this.formattingOptions); } } - -export function format(text, options) { - const markdownOptions = { - renderer: new MattermostMarkdownRenderer(null, options), - sanitize: true - }; - - const tokens = marked.lexer(text, markdownOptions); - - return new MattermostParser(markdownOptions).parse(tokens); -} - |