diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-09-24 08:14:25 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-09-24 08:14:25 -0400 |
commit | 56f76502e3edcc95f7a0e9c8fe5b3d523b33ee29 (patch) | |
tree | 47ec77caf723394af4a79360a7051e38e2e700c7 /web/react/utils/markdown.jsx | |
parent | fba72b849c65a5639296f64f1653243eccddab51 (diff) | |
parent | 511fcce55345adb2a6b05cf058fd4d238abcc521 (diff) | |
download | chat-56f76502e3edcc95f7a0e9c8fe5b3d523b33ee29.tar.gz chat-56f76502e3edcc95f7a0e9c8fe5b3d523b33ee29.tar.bz2 chat-56f76502e3edcc95f7a0e9c8fe5b3d523b33ee29.zip |
Merge pull request #769 from hmhealey/plt334
PLT-334 Restricted markdown output to only appear on one line when in singleline mode
Diffstat (limited to 'web/react/utils/markdown.jsx')
-rw-r--r-- | web/react/utils/markdown.jsx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/web/react/utils/markdown.jsx b/web/react/utils/markdown.jsx index c6ffb1871..7e88f8644 100644 --- a/web/react/utils/markdown.jsx +++ b/web/react/utils/markdown.jsx @@ -15,6 +15,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer { this.formattingOptions = formattingOptions; } + br() { + if (this.formattingOptions.singleline) { + return ' '; + } + + return super.br(); + } + heading(text, level, raw) { const id = `${this.options.headerPrefix}${raw.toLowerCase().replace(/[^\w]+/g, '-')}`; return `<h${level} id="${id}" class="markdown__heading">${text}</h${level}>`; @@ -36,6 +44,14 @@ export class MattermostMarkdownRenderer extends marked.Renderer { return output; } + paragraph(text) { + if (this.formattingOptions.singleline) { + return `<p class="markdown__paragraph-inline">${text}</p>`; + } + + return super.paragraph(text); + } + table(header, body) { return `<table class="markdown__table"><thead>${header}</thead><tbody>${body}</tbody></table>`; } |