qiita-markdown 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/qiita/markdown/embed/code_pen.rb +1 -0
- data/lib/qiita/markdown/version.rb +1 -1
- data/spec/qiita/markdown/processor_spec.rb +25 -43
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0ade2d671aa9407b7c4467426a70d4dffd0d1591549935cf079c1b58e2adb88
|
4
|
+
data.tar.gz: 3f1b894ce505d0f0703f4675e7c27908d6ef343b15a883bfd65434a084197c67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3da8566097c634c94fc622e6eeddb422a7e5fbb70ab426189fcab9ed5e94d902deb3d73638b8f2fc119c1cd8e9785db623e66f74c953ddecb539a875ce6f6f87
|
7
|
+
data.tar.gz: 3951f59e21427af26fd58ad22ed0066d590e9d0faa7f6f7a77355d5ae6cf1c48fc38f091e8e906afa0ae2c544c98519239f7fbfff285aa05d230353f8fa8d1e3
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,7 @@ module Qiita
|
|
6
6
|
"https://production-assets.codepen.io/assets/embed/ei.js",
|
7
7
|
"https://static.codepen.io/assets/embed/ei.js",
|
8
8
|
"https://cpwebassets.codepen.io/assets/embed/ei.js",
|
9
|
+
"https://public.codepenassets.com/embed/index.js",
|
9
10
|
]
|
10
11
|
CLASS_NAME = %w[codepen]
|
11
12
|
DATA_ATTRIBUTES = %w[
|
@@ -1406,52 +1406,34 @@ describe Qiita::Markdown::Processor do
|
|
1406
1406
|
end
|
1407
1407
|
|
1408
1408
|
shared_examples_for "override embed code attributes" do |allowed:|
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
it "does not sanitize embed code" do
|
1419
|
-
should eq <<-HTML.strip_heredoc
|
1420
|
-
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1421
|
-
<script src="https://production-assets.codepen.io/assets/embed/ei.js"></script>
|
1422
|
-
HTML
|
1423
|
-
end
|
1424
|
-
else
|
1425
|
-
it "forces async attribute on script" do
|
1426
|
-
should eq <<-HTML.strip_heredoc
|
1409
|
+
[
|
1410
|
+
"https://production-assets.codepen.io/assets/embed/ei.js",
|
1411
|
+
"https://static.codepen.io/assets/embed/ei.js",
|
1412
|
+
"https://cpwebassets.codepen.io/assets/embed/ei.js",
|
1413
|
+
"https://public.codepenassets.com/embed/index.js",
|
1414
|
+
].each do |script_url|
|
1415
|
+
context "with HTML embed code for CodePen using script url `#{script_url}`" do
|
1416
|
+
let(:markdown) do
|
1417
|
+
<<-MARKDOWN.strip_heredoc
|
1427
1418
|
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1428
|
-
<script src="
|
1429
|
-
|
1419
|
+
<script src="#{script_url}"></script>
|
1420
|
+
MARKDOWN
|
1430
1421
|
end
|
1431
|
-
end
|
1432
|
-
end
|
1433
1422
|
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
end
|
1449
|
-
else
|
1450
|
-
it "forces async attribute on script" do
|
1451
|
-
should eq <<-HTML.strip_heredoc
|
1452
|
-
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1453
|
-
<script src="https://static.codepen.io/assets/embed/ei.js" async="async"></script>
|
1454
|
-
HTML
|
1423
|
+
if allowed
|
1424
|
+
it "does not sanitize embed code" do
|
1425
|
+
should eq <<-HTML.strip_heredoc
|
1426
|
+
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1427
|
+
<script src="#{script_url}"></script>
|
1428
|
+
HTML
|
1429
|
+
end
|
1430
|
+
else
|
1431
|
+
it "forces async attribute on script" do
|
1432
|
+
should eq <<-HTML.strip_heredoc
|
1433
|
+
<p data-height="1" data-theme-id="0" data-slug-hash="foo" data-default-tab="bar" data-user="baz" data-embed-version="2" data-pen-title="qux" class="codepen"></p>
|
1434
|
+
<script src="#{script_url}" async="async"></script>
|
1435
|
+
HTML
|
1436
|
+
end
|
1455
1437
|
end
|
1456
1438
|
end
|
1457
1439
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qiita-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
|
-
rubygems_version: 3.
|
210
|
+
rubygems_version: 3.3.26
|
211
211
|
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: Qiita-specified markdown processor.
|