You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cartodb/lib/carto/notifications_markdown_rend...

24 lines
766 B

4 years ago
require 'redcarpet/render_strip'
# A Redcarpet renderer that renders plain text, with a few modifications
# It is used to validate the length of the notifications messages, and check that the content is valid
module Carto
class NotificationsMarkdownRenderer < Redcarpet::Render::StripDown
def link(_link, _title, content)
content
end
DISABLED_TAGS = [
:block_code, :block_quote, :block_html, :footnotes, :footnote_def, :footnote_ref,
:image, :header, :table, :table_row, :table_cell
].freeze
# Defines a method that raises an error for each unsupported tag
DISABLED_TAGS.each do |method|
define_method method do |*_args|
raise "cannot contain #{method.to_s.humanize.downcase}"
end
end
end
end