Skip to content

Commit 7f54b28

Browse files
Merge pull request #182 from increments/support-blueprintue-embedding
Support blueprintUE embedding
2 parents ca9196f + 0f919aa commit 7f54b28

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

lib/qiita/markdown.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
require "qiita/markdown/embed/docswell"
2020
require "qiita/markdown/embed/figma"
2121
require "qiita/markdown/embed/stack_blitz"
22+
require "qiita/markdown/embed/blueprint_ue"
2223
require "qiita/markdown/transformers/filter_attributes"
2324
require "qiita/markdown/transformers/filter_script"
2425
require "qiita/markdown/transformers/filter_iframe"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
module Qiita
4+
module Markdown
5+
module Embed
6+
module BlueprintUe
7+
SCRIPT_HOST = "blueprintue.com"
8+
end
9+
end
10+
end
11+
end

lib/qiita/markdown/transformers/filter_iframe.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class FilterIframe
1212
Embed::Figma::SCRIPT_HOST,
1313
Embed::GoogleDrive::SCRIPT_HOST,
1414
Embed::StackBlitz::SCRIPT_HOST,
15+
Embed::BlueprintUe::SCRIPT_HOST,
1516
].flatten.freeze
1617

1718
def self.call(**args)

spec/qiita/markdown/processor_spec.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,6 +1784,43 @@
17841784
end
17851785
end
17861786

1787+
context "with HTML embed code for blueprintUE" do
1788+
shared_examples "embed code blueprintUE example" do
1789+
let(:markdown) do
1790+
<<~MARKDOWN
1791+
<iframe src="#{url}" width="800" height="600" frameborder="0" allowfullscreen="true"></iframe>
1792+
MARKDOWN
1793+
end
1794+
let(:url) { "#{scheme}//blueprintue.com/embed/example" }
1795+
1796+
if allowed
1797+
it "does not sanitize embed code" do
1798+
should eq <<~HTML
1799+
<iframe src="#{url}" width="800" height="600" frameborder="0" allowfullscreen="true"></iframe>
1800+
HTML
1801+
end
1802+
else
1803+
it "forces width attribute on iframe" do
1804+
should eq <<~HTML
1805+
<iframe src="#{url}" width="100%" height="600" frameborder="0" allowfullscreen="true"></iframe>
1806+
HTML
1807+
end
1808+
end
1809+
end
1810+
1811+
context "with scheme" do
1812+
let(:scheme) { "https:" }
1813+
1814+
include_examples "embed code blueprintUE example"
1815+
end
1816+
1817+
context "without scheme" do
1818+
let(:scheme) { "" }
1819+
1820+
include_examples "embed code blueprintUE example"
1821+
end
1822+
end
1823+
17871824
context "with embed code for Tweet" do
17881825
let(:markdown) do
17891826
<<-MARKDOWN.strip_heredoc

0 commit comments

Comments
 (0)