qiita-markdown 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +5 -0
- data/.github/dependabot.yml +22 -0
- data/.github/workflows/release.yml +22 -0
- data/.github/workflows/test.yml +8 -8
- data/.rubocop.yml +7 -7
- data/CHANGELOG.md +10 -0
- data/Gemfile +1 -1
- data/lib/qiita/markdown/embed/code_pen.rb +1 -0
- data/lib/qiita/markdown/embed/google_drive.rb +11 -0
- data/lib/qiita/markdown/embed/stack_blitz.rb +11 -0
- data/lib/qiita/markdown/filters/code_block.rb +1 -1
- data/lib/qiita/markdown/transformers/filter_iframe.rb +2 -0
- data/lib/qiita/markdown/version.rb +1 -1
- data/lib/qiita/markdown.rb +2 -0
- data/spec/qiita/markdown/processor_spec.rb +98 -43
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57d4cba4cba7c841c19fd9e3a0933d5920f827a79acdf8bb38f511b49386282d
|
4
|
+
data.tar.gz: 389ed7716950987f76db86e1a48964f3f8c59709f45479dfe15f42cb72d657d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f811fabd2edaccff2c12d2acb74d3c40af82279a539da45b2c3a4c3362a1ac0dc7320e84ba680c4d3cbc4519eb18a3a4f50ac8308116d0064547a99abddb9fa7
|
7
|
+
data.tar.gz: bf449e8687ce87e0e7b0b0fc7582c81fb5775a1ecb2a741443cfea6efa5cb795a96d2a41f528eb7b6ff669a8e862f654b2baa5799d3299e48e0c78a89e1b8f0b
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
|
4
|
+
- package-ecosystem: "bundler"
|
5
|
+
directories:
|
6
|
+
- "/"
|
7
|
+
schedule:
|
8
|
+
interval: "daily"
|
9
|
+
time: "14:00"
|
10
|
+
timezone: "Asia/Tokyo"
|
11
|
+
open-pull-requests-limit: 5
|
12
|
+
rebase-strategy: "disabled"
|
13
|
+
|
14
|
+
- package-ecosystem: "github-actions"
|
15
|
+
directories:
|
16
|
+
- "/"
|
17
|
+
schedule:
|
18
|
+
interval: "daily"
|
19
|
+
time: "14:00"
|
20
|
+
timezone: "Asia/Tokyo"
|
21
|
+
open-pull-requests-limit: 5
|
22
|
+
rebase-strategy: "disabled"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
release:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
environment: release
|
11
|
+
|
12
|
+
permissions:
|
13
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
14
|
+
contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
18
|
+
- uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0
|
19
|
+
with:
|
20
|
+
ruby-version: 3.4.4 # Latest stable Ruby for release builds
|
21
|
+
bundler-cache: true
|
22
|
+
- uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
|
data/.github/workflows/test.yml
CHANGED
@@ -16,15 +16,15 @@ jobs:
|
|
16
16
|
steps:
|
17
17
|
- name: Get branch names
|
18
18
|
id: branch-name
|
19
|
-
uses: tj-actions/branch-names@
|
20
|
-
- uses: actions/checkout@v3
|
21
|
-
- uses: ruby/setup-ruby@v1
|
19
|
+
uses: tj-actions/branch-names@dde14ac574a8b9b1cedc59a1cf312788af43d8d8 # v8.2.1
|
20
|
+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
21
|
+
- uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
|
22
22
|
with:
|
23
|
-
ruby-version: '3.
|
23
|
+
ruby-version: '3.2'
|
24
24
|
bundler-cache: true
|
25
25
|
- name: Test & publish code coverage
|
26
26
|
if: "${{ env.CC_TEST_REPORTER_ID != '' }}"
|
27
|
-
uses: paambaati/codeclimate-action@v2.7.5
|
27
|
+
uses: paambaati/codeclimate-action@7bcf9e73c0ee77d178e72c0ec69f1a99c1afc1f3 # v2.7.5
|
28
28
|
env:
|
29
29
|
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
30
30
|
GIT_BRANCH: ${{ steps.branch-name.outputs.current_branch }}
|
@@ -37,7 +37,7 @@ jobs:
|
|
37
37
|
fail-fast: false
|
38
38
|
matrix:
|
39
39
|
os: ['ubuntu-latest', 'macos-latest']
|
40
|
-
ruby: ['3.
|
40
|
+
ruby: ['3.2', '3.3', '3.4']
|
41
41
|
experimental: [false]
|
42
42
|
include:
|
43
43
|
- os: 'ubuntu-latest'
|
@@ -46,8 +46,8 @@ jobs:
|
|
46
46
|
runs-on: ${{ matrix.os }}
|
47
47
|
continue-on-error: ${{ matrix.experimental }}
|
48
48
|
steps:
|
49
|
-
- uses: actions/checkout@v3
|
50
|
-
- uses: ruby/setup-ruby@v1
|
49
|
+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
50
|
+
- uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
|
51
51
|
with:
|
52
52
|
ruby-version: ${{ matrix.ruby }}
|
53
53
|
bundler-cache: true
|
data/.rubocop.yml
CHANGED
@@ -3,9 +3,16 @@ inherit_from: .rubocop_todo.yml
|
|
3
3
|
AllCops:
|
4
4
|
NewCops: enable
|
5
5
|
|
6
|
+
Layout/LineLength:
|
7
|
+
Enabled: false
|
8
|
+
|
6
9
|
Metrics/ClassLength:
|
7
10
|
Enabled: false
|
8
11
|
|
12
|
+
Naming/PredicatePrefix:
|
13
|
+
ForbiddenPrefixes:
|
14
|
+
- is_
|
15
|
+
|
9
16
|
Style/Documentation:
|
10
17
|
Enabled: false
|
11
18
|
|
@@ -15,10 +22,6 @@ Style/EmptyCaseCondition:
|
|
15
22
|
Style/GuardClause:
|
16
23
|
Enabled: false
|
17
24
|
|
18
|
-
Style/PredicateName:
|
19
|
-
ForbiddenPrefixes:
|
20
|
-
- is_
|
21
|
-
|
22
25
|
Style/StringLiterals:
|
23
26
|
EnforcedStyle: double_quotes
|
24
27
|
|
@@ -34,9 +37,6 @@ Style/TrailingCommaInArrayLiteral:
|
|
34
37
|
Style/RedundantPercentQ:
|
35
38
|
Enabled: false
|
36
39
|
|
37
|
-
Metrics/LineLength:
|
38
|
-
Enabled: false
|
39
|
-
|
40
40
|
Metrics/BlockLength:
|
41
41
|
Exclude:
|
42
42
|
- qiita-markdown.gemspec
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -9,5 +9,5 @@ gem "codeclimate-test-reporter", "0.4.4"
|
|
9
9
|
gem "pry"
|
10
10
|
gem "rake"
|
11
11
|
gem "rspec", "~> 3.1"
|
12
|
-
gem "rubocop", "~> 1.
|
12
|
+
gem "rubocop", "~> 1.76.0"
|
13
13
|
gem "simplecov", "!= 0.18.0", "!= 0.18.1", "!= 0.18.2", "!= 0.18.3", "!= 0.18.4", "!= 0.18.5", "!= 0.19.0", "!= 0.19.1"
|
@@ -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[
|
data/lib/qiita/markdown.rb
CHANGED
@@ -12,11 +12,13 @@ require "qiita/markdown/embed/code_pen"
|
|
12
12
|
require "qiita/markdown/embed/tweet"
|
13
13
|
require "qiita/markdown/embed/asciinema"
|
14
14
|
require "qiita/markdown/embed/youtube"
|
15
|
+
require "qiita/markdown/embed/google_drive"
|
15
16
|
require "qiita/markdown/embed/slide_share"
|
16
17
|
require "qiita/markdown/embed/google_slide"
|
17
18
|
require "qiita/markdown/embed/speeker_deck"
|
18
19
|
require "qiita/markdown/embed/docswell"
|
19
20
|
require "qiita/markdown/embed/figma"
|
21
|
+
require "qiita/markdown/embed/stack_blitz"
|
20
22
|
require "qiita/markdown/transformers/filter_attributes"
|
21
23
|
require "qiita/markdown/transformers/filter_script"
|
22
24
|
require "qiita/markdown/transformers/filter_iframe"
|
@@ -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
|
-
|
1434
|
-
context "with HTML embed code for CodePen" do
|
1435
|
-
let(:markdown) do
|
1436
|
-
<<-MARKDOWN.strip_heredoc
|
1437
|
-
<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>
|
1438
|
-
<script src="https://static.codepen.io/assets/embed/ei.js"></script>
|
1439
|
-
MARKDOWN
|
1440
|
-
end
|
1441
1422
|
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
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
|
@@ -1538,6 +1520,42 @@ describe Qiita::Markdown::Processor do
|
|
1538
1520
|
end
|
1539
1521
|
end
|
1540
1522
|
|
1523
|
+
context "with HTML embed code for Google Drive" do
|
1524
|
+
shared_examples "embed code googledrive example" do
|
1525
|
+
let(:markdown) do
|
1526
|
+
<<-MARKDOWN.strip_heredoc
|
1527
|
+
<iframe src="#{url}" width="640" height="480" frameborder="0" allowfullscreen="true"></iframe>
|
1528
|
+
MARKDOWN
|
1529
|
+
end
|
1530
|
+
let(:file_id) { "DRIVE_FILE_ID_EXAMPLE" }
|
1531
|
+
let(:url) { "#{scheme}//drive.google.com/file/d/#{file_id}/preview" }
|
1532
|
+
|
1533
|
+
if allowed
|
1534
|
+
it "does not sanitize embed code" do
|
1535
|
+
should eq <<-HTML.strip_heredoc
|
1536
|
+
<iframe src="#{url}" width="640" height="480" frameborder="0" allowfullscreen="true"></iframe>
|
1537
|
+
HTML
|
1538
|
+
end
|
1539
|
+
else
|
1540
|
+
it "forces width attribute on iframe" do
|
1541
|
+
should eq <<-HTML.strip_heredoc
|
1542
|
+
<iframe src="#{url}" width="100%" height="480" frameborder="0" allowfullscreen="true"></iframe>
|
1543
|
+
HTML
|
1544
|
+
end
|
1545
|
+
end
|
1546
|
+
end
|
1547
|
+
|
1548
|
+
context "with scheme" do
|
1549
|
+
let(:scheme) { "https:" }
|
1550
|
+
include_examples "embed code googledrive example"
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
context "without scheme" do
|
1554
|
+
let(:scheme) { "" }
|
1555
|
+
include_examples "embed code googledrive example"
|
1556
|
+
end
|
1557
|
+
end
|
1558
|
+
|
1541
1559
|
context "with HTML embed code for SlideShare" do
|
1542
1560
|
shared_examples "embed code slideshare example" do
|
1543
1561
|
let(:markdown) do
|
@@ -1729,6 +1747,43 @@ describe Qiita::Markdown::Processor do
|
|
1729
1747
|
end
|
1730
1748
|
end
|
1731
1749
|
|
1750
|
+
context "with HTML embed code for StackBlitz" do
|
1751
|
+
shared_examples "embed code stackblitz example" do
|
1752
|
+
let(:markdown) do
|
1753
|
+
<<~MARKDOWN
|
1754
|
+
<iframe src="#{url}" width="800" height="600" frameborder="0" allowfullscreen="true"></iframe>
|
1755
|
+
MARKDOWN
|
1756
|
+
end
|
1757
|
+
let(:url) { "#{scheme}//stackblitz.com/embed/example" }
|
1758
|
+
|
1759
|
+
if allowed
|
1760
|
+
it "does not sanitize embed code" do
|
1761
|
+
should eq <<~HTML
|
1762
|
+
<iframe src="#{url}" width="800" height="600" frameborder="0" allowfullscreen="true"></iframe>
|
1763
|
+
HTML
|
1764
|
+
end
|
1765
|
+
else
|
1766
|
+
it "forces width attribute on iframe" do
|
1767
|
+
should eq <<~HTML
|
1768
|
+
<iframe src="#{url}" width="100%" height="600" frameborder="0" allowfullscreen="true"></iframe>
|
1769
|
+
HTML
|
1770
|
+
end
|
1771
|
+
end
|
1772
|
+
end
|
1773
|
+
|
1774
|
+
context "with scheme" do
|
1775
|
+
let(:scheme) { "https:" }
|
1776
|
+
|
1777
|
+
include_examples "embed code stackblitz example"
|
1778
|
+
end
|
1779
|
+
|
1780
|
+
context "without scheme" do
|
1781
|
+
let(:scheme) { "" }
|
1782
|
+
|
1783
|
+
include_examples "embed code stackblitz example"
|
1784
|
+
end
|
1785
|
+
end
|
1786
|
+
|
1732
1787
|
context "with embed code for Tweet" do
|
1733
1788
|
let(:markdown) do
|
1734
1789
|
<<-MARKDOWN.strip_heredoc
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qiita-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: addressable
|
@@ -122,13 +121,15 @@ dependencies:
|
|
122
121
|
- - ">="
|
123
122
|
- !ruby/object:Gem::Version
|
124
123
|
version: '0'
|
125
|
-
description:
|
126
124
|
email:
|
127
125
|
- r7kamura@gmail.com
|
128
126
|
executables: []
|
129
127
|
extensions: []
|
130
128
|
extra_rdoc_files: []
|
131
129
|
files:
|
130
|
+
- ".github/CODEOWNERS"
|
131
|
+
- ".github/dependabot.yml"
|
132
|
+
- ".github/workflows/release.yml"
|
132
133
|
- ".github/workflows/test.yml"
|
133
134
|
- ".gitignore"
|
134
135
|
- ".rspec"
|
@@ -146,9 +147,11 @@ files:
|
|
146
147
|
- lib/qiita/markdown/embed/code_pen.rb
|
147
148
|
- lib/qiita/markdown/embed/docswell.rb
|
148
149
|
- lib/qiita/markdown/embed/figma.rb
|
150
|
+
- lib/qiita/markdown/embed/google_drive.rb
|
149
151
|
- lib/qiita/markdown/embed/google_slide.rb
|
150
152
|
- lib/qiita/markdown/embed/slide_share.rb
|
151
153
|
- lib/qiita/markdown/embed/speeker_deck.rb
|
154
|
+
- lib/qiita/markdown/embed/stack_blitz.rb
|
152
155
|
- lib/qiita/markdown/embed/tweet.rb
|
153
156
|
- lib/qiita/markdown/embed/youtube.rb
|
154
157
|
- lib/qiita/markdown/filters/checkbox.rb
|
@@ -192,7 +195,6 @@ licenses:
|
|
192
195
|
- MIT
|
193
196
|
metadata:
|
194
197
|
rubygems_mfa_required: 'true'
|
195
|
-
post_install_message:
|
196
198
|
rdoc_options: []
|
197
199
|
require_paths:
|
198
200
|
- lib
|
@@ -207,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
209
|
- !ruby/object:Gem::Version
|
208
210
|
version: '0'
|
209
211
|
requirements: []
|
210
|
-
rubygems_version: 3.
|
211
|
-
signing_key:
|
212
|
+
rubygems_version: 3.6.7
|
212
213
|
specification_version: 4
|
213
214
|
summary: Qiita-specified markdown processor.
|
214
215
|
test_files: []
|