diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/pagedown/Markdown.Converter.js b/lib/gollum/frontend/public/gollum/livepreview/js/pagedown/Markdown.Converter.js index 8bb02cd6..25313cf0 100644 --- a/lib/gollum/frontend/public/gollum/livepreview/js/pagedown/Markdown.Converter.js +++ b/lib/gollum/frontend/public/gollum/livepreview/js/pagedown/Markdown.Converter.js @@ -1025,14 +1025,14 @@ else // // Gollum wraps code in one pre. Use ` to mark code pre. // Gollum requires exactly three starting and ending `. - // All regex set to use 'm' multiline option. // text = text.replace(/(^|[^\\])(`{3})([^\r]*?[^`])\2(?!`)/gm, function (wholeMatch, m1, m2, m3, m4) { var c = m3; - c = c.replace(/^([ \t]*)/gm, ""); // leading whitespace - c = c.replace(/[ \t]*$/gm, ""); // trailing whitespace + c = c.replace(/^([ \t]*)/g, ""); // leading whitespace + c = c.replace(/[ \t]*$/g, ""); // trailing whitespace c = _EncodeCode(c); + // Set to use 'm' multiline option. c = c.replace(/:\/\//gm, "~P"); // to prevent auto-linking. Not necessary in code *blocks*, but in code spans. Will be converted back after the auto-linker runs. return m1 + hashBlock("
`" + c + ""); }