Skip to content

Commit

Permalink
Do not remove first word of block if it is single line. Fixes #536
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Aug 22, 2015
1 parent 9dd3bef commit ac6d0c1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/rocketchat-highlight/highlight.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ac6d0c1

Please sign in to comment.