File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 17
17
require "qiita/markdown/embed/speeker_deck"
18
18
require "qiita/markdown/embed/docswell"
19
19
require "qiita/markdown/embed/figma"
20
+ require "qiita/markdown/embed/stack_blitz"
20
21
require "qiita/markdown/transformers/filter_attributes"
21
22
require "qiita/markdown/transformers/filter_script"
22
23
require "qiita/markdown/transformers/filter_iframe"
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module Qiita
4
+ module Markdown
5
+ module Embed
6
+ module StackBlitz
7
+ SCRIPT_HOST = "stackblitz.com"
8
+ end
9
+ end
10
+ end
11
+ end
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ class FilterIframe
10
10
Embed ::GoogleSlide ::SCRIPT_HOST ,
11
11
Embed ::Docswell ::SCRIPT_HOSTS ,
12
12
Embed ::Figma ::SCRIPT_HOST ,
13
+ Embed ::StackBlitz ::SCRIPT_HOST ,
13
14
] . flatten . freeze
14
15
15
16
def self . call ( **args )
Original file line number Diff line number Diff line change 1711
1711
end
1712
1712
end
1713
1713
1714
+ context "with HTML embed code for StackBlitz" do
1715
+ shared_examples "embed code stackblitz example" do
1716
+ let ( :markdown ) do
1717
+ <<-MARKDOWN . strip_heredoc
1718
+ <iframe src="#{ url } "></iframe>
1719
+ MARKDOWN
1720
+ end
1721
+ let ( :url ) { "#{ scheme } //stackblitz.com/embed/example" }
1722
+
1723
+ if allowed
1724
+ it "does not sanitize embed code" do
1725
+ should eq <<-HTML . strip_heredoc
1726
+ < iframe src ="#{ url } "> </ iframe>
1727
+ HTML
1728
+ end
1729
+ else
1730
+ it "forces width attribute on iframe" do
1731
+ should eq <<-HTML . strip_heredoc
1732
+ < iframe src ="#{ url } " width="100%"> </ iframe>
1733
+ HTML
1734
+ end
1735
+ end
1736
+ end
1737
+
1738
+ context "with scheme" do
1739
+ let ( :scheme ) { "https:" }
1740
+
1741
+ include_examples "embed code stackblitz example"
1742
+ end
1743
+
1744
+ context "without scheme" do
1745
+ let ( :scheme ) { "" }
1746
+
1747
+ include_examples "embed code stackblitz example"
1748
+ end
1749
+ end
1750
+
1714
1751
context "with embed code for Tweet" do
1715
1752
let ( :markdown ) do
1716
1753
<<-MARKDOWN . strip_heredoc
You can’t perform that action at this time.
0 commit comments