lib/devcenter-parser/github_parser.rb in devcenter-parser-2.2.2rc2 vs lib/devcenter-parser/github_parser.rb in devcenter-parser-2.2.2rc3
- old
+ new
@@ -3,10 +3,15 @@
class HTMLWithPantsRenderer < Redcarpet::Render::HTML
include Redcarpet::Render::SmartyPants
def block_code(code, language)
- %{\n<pre><code class="language-#{language}">#{html_escape(code)}</code></pre>\n}
+ if language
+ language.sub!(/\Alang(uage)?-/, '')
+ %{<pre class="language-#{language}"><code class="language-#{language}">#{html_escape(code)}</code></pre>}
+ else
+ %{<pre><code>#{html_escape(code)}</code></pre>}
+ end
end
private
# This is a method copy/pasted from redcarpet/lib/redcarpet.rb