qiita-markdown 1.2.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0ade2d671aa9407b7c4467426a70d4dffd0d1591549935cf079c1b58e2adb88
4
- data.tar.gz: 3f1b894ce505d0f0703f4675e7c27908d6ef343b15a883bfd65434a084197c67
3
+ metadata.gz: 57d4cba4cba7c841c19fd9e3a0933d5920f827a79acdf8bb38f511b49386282d
4
+ data.tar.gz: 389ed7716950987f76db86e1a48964f3f8c59709f45479dfe15f42cb72d657d9
5
5
  SHA512:
6
- metadata.gz: 3da8566097c634c94fc622e6eeddb422a7e5fbb70ab426189fcab9ed5e94d902deb3d73638b8f2fc119c1cd8e9785db623e66f74c953ddecb539a875ce6f6f87
7
- data.tar.gz: 3951f59e21427af26fd58ad22ed0066d590e9d0faa7f6f7a77355d5ae6cf1c48fc38f091e8e906afa0ae2c544c98519239f7fbfff285aa05d230353f8fa8d1e3
6
+ metadata.gz: f811fabd2edaccff2c12d2acb74d3c40af82279a539da45b2c3a4c3362a1ac0dc7320e84ba680c4d3cbc4519eb18a3a4f50ac8308116d0064547a99abddb9fa7
7
+ data.tar.gz: bf449e8687ce87e0e7b0b0fc7582c81fb5775a1ecb2a741443cfea6efa5cb795a96d2a41f528eb7b6ff669a8e862f654b2baa5799d3299e48e0c78a89e1b8f0b
@@ -0,0 +1,5 @@
1
+ # package-ecosystem: bundler, directories: /
2
+ /Gemfile @increments/qiita-dev-group
3
+
4
+ # package-ecosystem: github-actions, directories: /
5
+ /.github/workflows @increments/qiita-dev-group
@@ -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
@@ -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@v7.0.7
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.0'
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.0', '3.1']
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
@@ -1,5 +1,11 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 1.3.0
4
+
5
+ - Support embedding new iframes
6
+ - Google Drive
7
+ - StackBlitz
8
+
3
9
  ## 1.2.0
4
10
 
5
11
  - Accept new codepen script url (public.codepenassets.com)
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.60.2"
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"
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Qiita
4
+ module Markdown
5
+ module Embed
6
+ module GoogleDrive
7
+ SCRIPT_HOST = "drive.google.com"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
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
@@ -82,7 +82,7 @@ module Qiita
82
82
  end
83
83
 
84
84
  def has_only_filename?
85
- sections[1].nil? && sections[0] && sections[0].include?(".")
85
+ sections[1].nil? && sections[0]&.include?(".")
86
86
  end
87
87
 
88
88
  def linguist_language
@@ -10,6 +10,8 @@ module Qiita
10
10
  Embed::GoogleSlide::SCRIPT_HOST,
11
11
  Embed::Docswell::SCRIPT_HOSTS,
12
12
  Embed::Figma::SCRIPT_HOST,
13
+ Embed::GoogleDrive::SCRIPT_HOST,
14
+ Embed::StackBlitz::SCRIPT_HOST,
13
15
  ].flatten.freeze
14
16
 
15
17
  def self.call(**args)
@@ -1,5 +1,5 @@
1
1
  module Qiita
2
2
  module Markdown
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -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"
@@ -1520,6 +1520,42 @@ describe Qiita::Markdown::Processor do
1520
1520
  end
1521
1521
  end
1522
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
+
1523
1559
  context "with HTML embed code for SlideShare" do
1524
1560
  shared_examples "embed code slideshare example" do
1525
1561
  let(:markdown) do
@@ -1711,6 +1747,43 @@ describe Qiita::Markdown::Processor do
1711
1747
  end
1712
1748
  end
1713
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
+
1714
1787
  context "with embed code for Tweet" do
1715
1788
  let(:markdown) do
1716
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.2.0
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: 2025-01-23 00:00:00.000000000 Z
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.3.26
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: []