Module: FlowChat::Renderers::MarkdownSupport
- Included in:
- Intercom::Renderer, Telegram::Renderer, Whatsapp::Renderer
- Defined in:
- lib/flow_chat/renderers/markdown_support.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
24 25 26 |
# File 'lib/flow_chat/renderers/markdown_support.rb', line 24 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#sanitize_html(html) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/flow_chat/renderers/markdown_support.rb', line 14 def sanitize_html(html) sanitized = self.class.sanitizer.sanitize( html, tags: , attributes: allowed_attributes ) post_process_html(sanitized) end |
#to_html(text) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/flow_chat/renderers/markdown_support.rb', line 7 def to_html(text) return "" if text.nil? html = Kramdown::Document.new(text.to_s, **).to_html.strip sanitize_html(html) end |