#7960 Add support for Markdown footnote syntax in Mobile view

Splitting stripdown and markdownify options, because the footnote option seems to let the Redcarpet::Render::StripDown function crash
This commit is contained in:
Thorsten Claus 2021-07-31 23:34:25 +02:00 committed by Benjamin Neff
parent 122e12a068
commit c71caa5cb8
No known key found for this signature in database
GPG key ID: 971464C3F1A90194

View file

@ -50,7 +50,7 @@ module Diaspora
end end
def strip_markdown def strip_markdown
renderer = Redcarpet::Markdown.new Redcarpet::Render::StripDown, options[:markdown_options] renderer = Redcarpet::Markdown.new Redcarpet::Render::StripDown, options[:stripdown_options]
@message = renderer.render(message).strip @message = renderer.render(message).strip
end end
@ -105,26 +105,35 @@ module Diaspora
end end
end end
DEFAULTS = {mentioned_people: [], DEFAULTS = {mentioned_people: [],
link_all_mentions: false, link_all_mentions: false,
disable_hovercards: false, disable_hovercards: false,
truncate: false, truncate: false,
append: nil, append: nil,
append_after_truncate: nil, append_after_truncate: nil,
squish: false, squish: false,
escape: true, escape: true,
escape_tags: false, escape_tags: false,
markdown_options: { stripdown_options: {
autolink: true, autolink: true,
fenced_code_blocks: true, fenced_code_blocks: true,
space_after_headers: true, space_after_headers: true,
strikethrough: true, strikethrough: true,
tables: true, tables: true,
no_intra_emphasis: true, no_intra_emphasis: true
},
markdown_options: {
autolink: true,
fenced_code_blocks: true,
space_after_headers: true,
strikethrough: true,
footnotes: true,
tables: true,
no_intra_emphasis: true
}, },
markdown_render_options: { markdown_render_options: {
filter_html: true, filter_html: true,
hard_wrap: true, hard_wrap: true,
safe_links_only: true safe_links_only: true
}}.freeze }}.freeze