lib/lookbook/markdown.rb in lookbook-0.9.8 vs lib/lookbook/markdown.rb in lookbook-1.0.0.beta.0
- old
+ new
@@ -10,23 +10,21 @@
highlight: true,
with_toc_data: true
}
def self.render(text)
- text&.gsub!("<!-- BEGIN inline template -->", "")&.gsub!("<!-- END inline template -->", "")
markdown = Redcarpet::Markdown.new(Renderer, Lookbook.config.markdown_options)
markdown.render(text).html_safe
end
class Renderer < Redcarpet::Render::HTML
def block_code(code, language = "ruby")
line_numbers = language.to_s.end_with? "-numbered"
- ApplicationController.render "lookbook/components/_code", locals: {
- code: code,
+ ApplicationController.render(Lookbook::Code::Component.new(**{
+ source: code,
language: language.to_s.chomp("-numbered"),
line_numbers: line_numbers
- },
- layout: nil
+ }), layout: nil)
end
end
end
end