Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/content_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def html(field = :all)
# Generate HTML for a specific field using the text_filter in use for this
# object.
def generate_html(field, text = nil)
text ||= self[field].to_s
text ||= self[field] || ""
html = (text_filter || default_text_filter).filter_text(text) || text
html_postprocess(field, html).to_s
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/text_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def help
if f.help_text.blank?
""
else
"<h3>#{f.display_name}</h3>\n#{CommonMarker.render_html(f.help_text, :DEFAULT)}"
"<h3>#{f.display_name}</h3>\n#{Commonmarker.to_html(f.help_text)}"
end
end

Expand All @@ -56,7 +56,7 @@ def commenthelp
.expand_filter_list([markup, filters].flatten)

help_filters.map do |f|
f.help_text.blank? ? "" : CommonMarker.render_html(f.help_text)
f.help_text.blank? ? "" : Commonmarker.to_html(f.help_text)
end.join("\n")
end

Expand Down
6 changes: 5 additions & 1 deletion lib/publify_core/text_filter/markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ def self.help_text
def self.filtertext(text)
# FIXME: Workaround for <publify:foo> not being interpreted as an HTML tag.
escaped_macros = text.gsub(%r{(</?publify):}, '\1X')
html = CommonMarker.render_html(escaped_macros, :UNSAFE)
html = Commonmarker.to_html(escaped_macros,
options: {
extension: { header_ids: nil },
render: { unsafe: true }
})
html.gsub(%r{(</?publify)X}, '\1:').strip
end
end
Expand Down
7 changes: 6 additions & 1 deletion lib/publify_core/text_filter/markdown_smartquotes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ class MarkdownSmartquotes < PublifyCore::TextFilter::Markdown
def self.filtertext(text)
# FIXME: Workaround for <publify:foo> not being interpreted as an HTML tag.
escaped_macros = text.gsub(%r{(</?publify):}, '\1X')
html = CommonMarker.render_doc(escaped_macros, :SMART).to_html(:UNSAFE)
html = Commonmarker.to_html(escaped_macros,
options: {
parse: { smart: true },
extension: { header_ids: nil },
render: { unsafe: true }
})
html.gsub(%r{(</?publify)X}, '\1:').strip
end
end
Expand Down
2 changes: 1 addition & 1 deletion publify_core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency "bootstrap", "~> 4.6.2"
s.add_dependency "cancancan", "~> 3.0"
s.add_dependency "carrierwave", "~> 3.0"
s.add_dependency "commonmarker", "~> 0.23.2"
s.add_dependency "commonmarker", "~> 2.3"
s.add_dependency "devise", ">= 4.8", "< 4.10"
s.add_dependency "devise-i18n", "~> 1.2"
s.add_dependency "devise_zxcvbn", "~> 6.0"
Expand Down