Files
leadchat/lib/chatwoot_markdown_renderer.rb
Nithin David Thomas d2aa19579e feat: Adds support for superscript in help center articles (#7279)
- Adds support for superscript when rendering article markdown
- Chatwoot Markdown Render to render markdown everywhere

Co-authored-by: Sojan <sojan@pepalo.com>
2023-06-14 15:39:00 +05:30

27 lines
552 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
superscript_renderer = SuperscriptRenderer.new
doc = CommonMarker.render_doc(@content, :DEFAULT)
html = superscript_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