diff --git a/packages/rocketchat-highlight/highlight.coffee b/packages/rocketchat-highlight/highlight.coffee index 815f59e984d2..55468747368d 100644 --- a/packages/rocketchat-highlight/highlight.coffee +++ b/packages/rocketchat-highlight/highlight.coffee @@ -27,8 +27,15 @@ class Highlight codeMatch = part.match(/```(\w*)[\n\ ]?([\s\S]*?)```+?/) if codeMatch? # Process highlight if this part is code - lang = codeMatch[1] - code = _.unescapeHTML codeMatch[2] + singleLine = codeMatch[0].indexOf('\n') is -1 + + if singleLine + lang = '' + code = _.unescapeHTML codeMatch[1] + ' ' + codeMatch[2] + else + lang = codeMatch[1] + code = _.unescapeHTML codeMatch[2] + if lang not in hljs.listLanguages() result = hljs.highlightAuto code else