diff options
Diffstat (limited to 'lib/gitlab/markdown/syntax_highlight_filter.rb')
-rw-r--r-- | lib/gitlab/markdown/syntax_highlight_filter.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/markdown/syntax_highlight_filter.rb b/lib/gitlab/markdown/syntax_highlight_filter.rb index 86f4385753a..8597e02f0de 100644 --- a/lib/gitlab/markdown/syntax_highlight_filter.rb +++ b/lib/gitlab/markdown/syntax_highlight_filter.rb @@ -21,7 +21,13 @@ module Gitlab language = node.attr('class') code = node.text - highlighted = block_code(code, language) + begin + highlighted = block_code(code, language) + rescue + # Gracefully handle syntax highlighter bugs/errors to ensure + # users can still access an issue/comment/etc. + highlighted = "<pre>#{code}</pre>" + end # Replace the parent `pre` element with the entire highlighted block node.parent.replace(highlighted) |