Skip to content
Snippets Groups Projects
Commit ef672679 authored by jm-factorin's avatar jm-factorin
Browse files

Add support for carriage return in markdown code blocks

parent 362ac8ea
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment