Skip to content

Commit

Permalink
Merge pull request #7072 from jm-factorin/markdown-carriage-return
Browse files Browse the repository at this point in the history
[FIX] Add support for carriage return in markdown code blocks
  • Loading branch information
rodrigok committed May 31, 2017
2 parents 90ef85f + ef67267 commit d695d10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/rocketchat-markdown/markdowncode.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ class MarkdownCode {
}

// Separate text in code blocks and non code blocks
const msgParts = message.html.split(/(^.*)(```(?:[a-zA-Z]+)?(?:(?:.|\n)*?)```)(.*\n?)$/gm);
const msgParts = message.html.split(/(^.*)(```(?:[a-zA-Z]+)?(?:(?:.|\r|\n)*?)```)(.*\n?)$/gm);

for (let index = 0; index < msgParts.length; index++) {
// Verify if this part is code
const part = msgParts[index];
const codeMatch = part.match(/^```(.*[\n\ ]?)([\s\S]*?)```+?$/);
const codeMatch = part.match(/^```(.*[\r\n\ ]?)([\s\S]*?)```+?$/);

if (codeMatch != null) {
// Process highlight if this part is code
Expand Down

0 comments on commit d695d10

Please sign in to comment.