Sha256: 996a621aa8a5ca60b2896e674e1389833ff6ddccc7fcf996f826b8a347f35a09
Contents?: true
Size: 685 Bytes
Versions: 1
Compression:
Stored size: 685 Bytes
Contents
# encoding: UTF-8 module Markdown module Render class HTML < Redcarpet::Render::HTML #MdEmoji::Render def block_code(code, language) sha = Digest::SHA1.hexdigest(code) lang = santize language Rails.cache.fetch ['code', lang, sha].join('-') do CodeRay.scan(code, lang).div#(:line_numbers => :table) end end def santize(language) language ||= :default if CodeRay::Scanners.list.include?(language.to_sym) language elsif CodeRay::Scanners.plugin_hash.key?(language) CodeRay::Scanners.plugin_hash[language] else :default end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mulberry_preview-0.0.10 | lib/mulberry_preview/markdown/render.rb |