Sha256: c6fb847b8489321b36bf55e6aba0300cf60fda4dec0043099deccb57fa4cdab9
Contents?: true
Size: 691 Bytes
Versions: 16
Compression:
Stored size: 691 Bytes
Contents
class Blogit::Parsers::MarkdownParser require "nokogiri" require "albino" require "blogit/renderers" def initialize(content) @content = content end def parsed renderer = Blogit::configuration.highlight_code_syntax ? Redcarpet::Render::HTMLWithAlbino : Redcarpet::Render::HTML markdown = Redcarpet::Markdown.new(renderer, Blogit.configuration.redcarpet_options) html_content = markdown.render(@content).html_safe end private def syntax_highlighter(html) doc = Nokogiri::HTML(html) doc.search("//pre[@lang]").each do |pre| puts "/" pre.replace Albino.colorize(pre.text.rstrip, pre[:lang]) end doc.inner_html end end
Version data entries
16 entries across 16 versions & 1 rubygems