feat: Shows Youtube and Vimeo links as embeds [cw-1393] (#7330)

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>
This commit is contained in:
Nithin David Thomas
2023-06-21 20:28:28 +05:30
committed by GitHub
parent 595e6e79f0
commit e6a49b5800
6 changed files with 215 additions and 83 deletions

View File

@@ -4,13 +4,13 @@ RSpec.describe ChatwootMarkdownRenderer do
let(:markdown_content) { 'This is a *test* content with ^markdown^' }
let(:doc) { instance_double(CommonMarker::Node) }
let(:renderer) { described_class.new(markdown_content) }
let(:superscript_renderer) { instance_double(SuperscriptRenderer) }
let(:markdown_renderer) { instance_double(CustomMarkdownRenderer) }
let(:html_content) { '<p>This is a <em>test</em> content with <sup>markdown</sup></p>' }
before do
allow(CommonMarker).to receive(:render_doc).with(markdown_content, :DEFAULT).and_return(doc)
allow(SuperscriptRenderer).to receive(:new).and_return(superscript_renderer)
allow(superscript_renderer).to receive(:render).with(doc).and_return(html_content)
allow(CustomMarkdownRenderer).to receive(:new).and_return(markdown_renderer)
allow(markdown_renderer).to receive(:render).with(doc).and_return(html_content)
end
describe '#render_article' do