// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. const TextFormatting = require('./text_formatting.jsx'); 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]+?(?=[\\${text}`; } link(href, title, text) { let outHref = href; if (outHref.lastIndexOf('http', 0) !== 0) { outHref = `http://${outHref}`; } let output = ''; } else { output += ' target="_blank">'; } output += text + ''; return output; } paragraph(text) { if (this.formattingOptions.singleline) { return `
${text}
`; } return super.paragraph(text); } table(header, body) { return `