|
|
@ -336,9 +336,9 @@ module ApplicationHelper
|
|
|
|
|
|
|
|
|
|
|
|
# 导出pdf时,转化markdown为html
|
|
|
|
# 导出pdf时,转化markdown为html
|
|
|
|
def to_markdown(text)
|
|
|
|
def to_markdown(text)
|
|
|
|
|
|
|
|
return nil if text.blank?
|
|
|
|
request_url = request.base_url
|
|
|
|
request_url = request.base_url
|
|
|
|
|
|
|
|
|
|
|
|
return nil if text.blank?
|
|
|
|
|
|
|
|
options = {
|
|
|
|
options = {
|
|
|
|
:autolink => true,
|
|
|
|
:autolink => true,
|
|
|
|
:no_intra_emphasis => true,
|
|
|
|
:no_intra_emphasis => true,
|
|
|
@ -350,7 +350,7 @@ module ApplicationHelper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,options)
|
|
|
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,options)
|
|
|
|
m_t = markdown.render(text)
|
|
|
|
m_t = markdown.render(text)
|
|
|
|
m_t&.include?("src=\"") ? m_t&.gsub("src=\"","src=\"#{request_url}") : m_t
|
|
|
|
m_t&.include?("src=\"") ? m_t&.gsub("src=\"","src=\"#{request.base_url}") : m_t
|
|
|
|
Rails.logger.info("###########__________request_url_________###################{request_url}")
|
|
|
|
Rails.logger.info("###########__________request_url_________###################{request_url}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|