shuffling code so it can be reused outside the engine
This commit is contained in:
@ -1,35 +1,8 @@
|
||||
require "redcarpet"
|
||||
|
||||
module Merged
|
||||
module MergedHelper
|
||||
include OptionsHelper
|
||||
|
||||
def renderer
|
||||
options = {hard_wrap: true , autolink: true, no_intra_emphasis: true ,
|
||||
safe_links_only: true, no_styles: true ,
|
||||
link_attributes: { target: '_blank' }}
|
||||
html = Redcarpet::Render::HTML.new(options)
|
||||
Redcarpet::Markdown.new(html, options)
|
||||
end
|
||||
|
||||
def prose_classes
|
||||
classes = "prose lg:prose-lg "
|
||||
classes += "prose-headings:text-inherit "
|
||||
{ class: classes }
|
||||
end
|
||||
|
||||
def markdown_image(section)
|
||||
return "" unless section.text
|
||||
down = self.renderer.render(section.text)
|
||||
image = image_for(section)
|
||||
down.gsub("IMAGE" , image).html_safe
|
||||
end
|
||||
|
||||
def markdown(text)
|
||||
text = text.text unless text.is_a?(String)
|
||||
return "" if text.blank?
|
||||
self.renderer.render(text).html_safe
|
||||
end
|
||||
include SharedHelper
|
||||
|
||||
def aspect_ratio image
|
||||
x , y = image.aspect_ratio
|
||||
|
Reference in New Issue
Block a user