diff --git a/lib/qiita/markdown.rb b/lib/qiita/markdown.rb
index 8b1f3626..8c78cf28 100644
--- a/lib/qiita/markdown.rb
+++ b/lib/qiita/markdown.rb
@@ -12,6 +12,7 @@
require "qiita/markdown/embed/tweet"
require "qiita/markdown/embed/asciinema"
require "qiita/markdown/embed/youtube"
+require "qiita/markdown/embed/google_drive"
require "qiita/markdown/embed/slide_share"
require "qiita/markdown/embed/google_slide"
require "qiita/markdown/embed/speeker_deck"
diff --git a/lib/qiita/markdown/embed/google_drive.rb b/lib/qiita/markdown/embed/google_drive.rb
new file mode 100644
index 00000000..22d90513
--- /dev/null
+++ b/lib/qiita/markdown/embed/google_drive.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module Qiita
+ module Markdown
+ module Embed
+ module GoogleDrive
+ SCRIPT_HOST = "drive.google.com"
+ end
+ end
+ end
+end
diff --git a/lib/qiita/markdown/transformers/filter_iframe.rb b/lib/qiita/markdown/transformers/filter_iframe.rb
index d5efa805..02920dfe 100644
--- a/lib/qiita/markdown/transformers/filter_iframe.rb
+++ b/lib/qiita/markdown/transformers/filter_iframe.rb
@@ -10,6 +10,7 @@ class FilterIframe
Embed::GoogleSlide::SCRIPT_HOST,
Embed::Docswell::SCRIPT_HOSTS,
Embed::Figma::SCRIPT_HOST,
+ Embed::GoogleDrive::SCRIPT_HOST,
].flatten.freeze
def self.call(**args)
diff --git a/spec/qiita/markdown/processor_spec.rb b/spec/qiita/markdown/processor_spec.rb
index 7cf76e4b..30df7b09 100644
--- a/spec/qiita/markdown/processor_spec.rb
+++ b/spec/qiita/markdown/processor_spec.rb
@@ -1520,6 +1520,42 @@
end
end
+ context "with HTML embed code for Google Drive" do
+ shared_examples "embed code googledrive example" do
+ let(:markdown) do
+ <<-MARKDOWN.strip_heredoc
+
+ MARKDOWN
+ end
+ let(:file_id) { "DRIVE_FILE_ID_EXAMPLE" }
+ let(:url) { "#{scheme}//drive.google.com/file/d/#{file_id}/preview" }
+
+ if allowed
+ it "does not sanitize embed code" do
+ should eq <<-HTML.strip_heredoc
+
+ HTML
+ end
+ else
+ it "forces width attribute on iframe" do
+ should eq <<-HTML.strip_heredoc
+
+ HTML
+ end
+ end
+ end
+
+ context "with scheme" do
+ let(:scheme) { "https:" }
+ include_examples "embed code googledrive example"
+ end
+
+ context "without scheme" do
+ let(:scheme) { "" }
+ include_examples "embed code googledrive example"
+ end
+ end
+
context "with HTML embed code for SlideShare" do
shared_examples "embed code slideshare example" do
let(:markdown) do