diff options
author | Stan Hu <stanhu@gmail.com> | 2018-09-12 07:54:44 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-09-13 19:29:04 +0300 |
commit | d2e8e38cc20da81c7afae58bee101892a566bca0 (patch) | |
tree | 8d8d4875b2f717f52fdd9feee504fdf5223af8ed /lib | |
parent | 831c94751313d78165daa6f63823988141aa9d5e (diff) |
Merge branch '51271-error-500-due-to-encoding-issues-when-when-attempting-to-access-issues-api' into 'master'
Resolve "Error 500 due to encoding issues when when attempting to access issues API"
Closes #51271
See merge request gitlab-org/gitlab-ce!21680
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/renderer/common_mark/html.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/banzai/renderer/common_mark/html.rb b/lib/banzai/renderer/common_mark/html.rb index 46b609c36b0..0b27316da1b 100644 --- a/lib/banzai/renderer/common_mark/html.rb +++ b/lib/banzai/renderer/common_mark/html.rb @@ -4,15 +4,11 @@ module Banzai class HTML < CommonMarker::HtmlRenderer def code_block(node) block do - code = node.string_content - lang = node.fence_info - lang_attr = lang.present? ? %Q{ lang="#{lang}"} : '' - result = - "<pre>" \ - "<code#{lang_attr}>#{ERB::Util.html_escape(code)}</code>" \ - "</pre>" - - out(result) + out("<pre#{sourcepos(node)}><code") + out(' lang="', node.fence_info, '"') if node.fence_info.present? + out('>') + out(escape_html(node.string_content)) + out('</code></pre>') end end end |