mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 03:27:52 +00:00
This change will render the youbtube, vimeo and .mp4 urls as embedded in the article page in the help centre. Fixes: https://linear.app/chatwoot/issue/CW-1393/help-center-support-video-upload-in-articles Co-authored-by: Sojan <sojan@pepalo.com>
27 lines
549 B
Ruby
27 lines
549 B
Ruby
class ChatwootMarkdownRenderer
|
|
def initialize(content)
|
|
@content = content
|
|
end
|
|
|
|
def render_message
|
|
html = CommonMarker.render_html(@content)
|
|
render_as_html_safe(html)
|
|
end
|
|
|
|
def render_article
|
|
markdown_renderer = CustomMarkdownRenderer.new
|
|
doc = CommonMarker.render_doc(@content, :DEFAULT)
|
|
html = markdown_renderer.render(doc)
|
|
|
|
render_as_html_safe(html)
|
|
end
|
|
|
|
private
|
|
|
|
def render_as_html_safe(html)
|
|
# rubocop:disable Rails/OutputSafety
|
|
html.html_safe
|
|
# rubocop:enable Rails/OutputSafety
|
|
end
|
|
end
|