redcarpet-form-extension 0.4.0 → 2.0.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: bdcc9a152b1f3f35842be0f782d6b57e258b3d87cd1872e9c4c9778b5be17292
4
- data.tar.gz: 14d015cb5b3e54c2101d291649712d8b993f6bf0d416055f473e5bd31490634f
3
+ metadata.gz: fa6af9360550d02e92d521199c28855c43e3ba9bb10881b3466151f8bd6c9814
4
+ data.tar.gz: 85309724c2267a527bb6781100913e32f72f8b08068208052c0e9460917f8c13
5
5
  SHA512:
6
- metadata.gz: dedcc3d33bce496a8b81e43b20c87bfd7920cb3d2717418b0b9e4cabc6808cdb575a777eb0a9c41497de1d4c6795c021d0b6af9acedc4f261fc682f29dab74fe
7
- data.tar.gz: fe93d675a0fe895d9b8d3ced36f246b0d4a479b4b966d025864528a8e2e630dde8ed347b4f9f3b653ca83f785712043bb516de3ab08b97d8fac384c180441156
6
+ metadata.gz: 22b9f597070832253e276189d90b89a461b01d689f733232e71937e4b67d60ed5b70ac31c146f28a19db3fbdfeddc60368f9602d8376176d5b405d133e948c6d
7
+ data.tar.gz: 90790e3d273bd5ad215e7fcf37c30340591240c48efed844025352f6035d627383d96e9314e30fc4222648416c74d17b1d9724a075dc83cdaa8b1423ece0d5c5
@@ -0,0 +1,3 @@
1
+ # Make sure RUBY_VERSION matches the Ruby version in .ruby-version
2
+ ARG RUBY_VERSION=4.0.6
3
+ FROM ghcr.io/rails/devcontainer/images/ruby:${RUBY_VERSION}
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "redcarpet-form-extension",
3
+ "build": {
4
+ "dockerfile": "Dockerfile"
5
+ },
6
+
7
+ "runArgs": ["--name", "redcarpet-form-extension"],
8
+ "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
9
+ "postCreateCommand": "bash -lc 'bin/setup'",
10
+ "postStartCommand": "bash -lc 'ruby -v && bundle -v'",
11
+ "customizations": {
12
+ "vscode": {
13
+ "extensions": [
14
+ "Shopify.ruby-lsp",
15
+ "misogi.ruby-rubocop",
16
+ "GitHub.copilot",
17
+ "GitHub.copilot-chat"
18
+ ]
19
+ }
20
+ }
21
+ }
@@ -2,9 +2,9 @@ name: Ruby Gem
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ "master" ]
5
+ branches: [ "develop" ]
6
6
  pull_request:
7
- branches: [ "master" ]
7
+ branches: [ "develop" ]
8
8
 
9
9
  jobs:
10
10
  build:
@@ -19,7 +19,7 @@ jobs:
19
19
  - name: Set up Ruby
20
20
  uses: ruby/setup-ruby@v1
21
21
  with:
22
- # ruby-version: 3.1.x # Not needed with a .ruby-version file
22
+ # ruby-version: 4.0.x # Not needed with a .ruby-version file
23
23
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
24
24
 
25
25
  - name: Run lint
@@ -28,6 +28,9 @@ jobs:
28
28
  - name: Run tests
29
29
  run: bundle exec rspec
30
30
 
31
+ - name: Run bundle-audit
32
+ run: bundle exec bundle-audit check --update
33
+
31
34
  - name: Publish to GPR
32
35
  if: false # always skip job
33
36
  run: |
data/.rubocop.yml CHANGED
@@ -1,10 +1,10 @@
1
- require:
1
+ plugins:
2
2
  - rubocop-rake
3
3
  - rubocop-rspec
4
4
 
5
5
  AllCops:
6
6
  DisplayCopNames: true
7
- TargetRubyVersion: 3.1
7
+ TargetRubyVersion: 4.0
8
8
  NewCops: disable
9
9
  Exclude:
10
10
  - 'vendor/**/*'
@@ -13,7 +13,7 @@ AllCops:
13
13
  - '.git/**/*'
14
14
  - 'bin/*'
15
15
 
16
- Naming/PredicateName:
16
+ Naming/PredicatePrefix:
17
17
  # Method define macros for dynamically generated method.
18
18
  MethodDefinitionMacros:
19
19
  - define_method
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 4.0.6
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in redcarpet-form-extension.gemspec
6
6
  gemspec
7
7
 
8
- gem 'rake', '~> 12.0'
8
+ gem 'rake', '~> 13.0'
9
9
 
10
10
  # Behaviour Driven Development for Ruby
11
11
  gem 'rspec'
@@ -27,3 +27,10 @@ gem 'simplecov', require: false, group: :test
27
27
 
28
28
  # A gem to bump versions of gems and chef-cookbooks.
29
29
  gem 'bump'
30
+
31
+ # Security scanners
32
+ gem 'bundler-audit', require: false
33
+
34
+ # stdlib gems no longer default in Ruby 3.4+
35
+ gem 'base64'
36
+ gem 'ostruct'
data/Gemfile.lock CHANGED
@@ -1,71 +1,103 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redcarpet-form-extension (0.4.0)
5
- redcarpet (~> 3.6.0)
4
+ redcarpet-form-extension (1.0.0)
5
+ loofah (~> 2.25.0)
6
+ redcarpet (~> 3.6.1)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- ast (2.4.2)
11
+ ast (2.4.3)
12
+ base64 (0.3.0)
11
13
  bump (0.10.0)
12
- byebug (11.1.3)
13
- diff-lcs (1.5.0)
14
- docile (1.4.0)
15
- parallel (1.22.1)
16
- parser (3.1.2.0)
14
+ bundler-audit (0.9.3)
15
+ bundler (>= 1.2.0)
16
+ thor (~> 1.0)
17
+ byebug (13.0.0)
18
+ reline (>= 0.6.0)
19
+ crass (1.0.7)
20
+ diff-lcs (1.6.2)
21
+ io-console (0.8.2)
22
+ json (2.21.2)
23
+ language_server-protocol (3.17.0.6)
24
+ lint_roller (1.1.0)
25
+ loofah (2.25.2)
26
+ crass (~> 1.0.2)
27
+ nokogiri (>= 1.12.0)
28
+ nokogiri (1.19.4-aarch64-linux-gnu)
29
+ racc (~> 1.4)
30
+ nokogiri (1.19.4-x86_64-darwin)
31
+ racc (~> 1.4)
32
+ nokogiri (1.19.4-x86_64-linux-gnu)
33
+ racc (~> 1.4)
34
+ ostruct (0.6.3)
35
+ parallel (2.1.0)
36
+ parser (3.3.12.0)
17
37
  ast (~> 2.4.1)
38
+ racc
39
+ prism (1.9.0)
40
+ racc (1.8.1)
18
41
  rainbow (3.1.1)
19
- rake (12.3.3)
20
- redcarpet (3.6.0)
21
- regexp_parser (2.5.0)
22
- rexml (3.2.5)
23
- rspec (3.11.0)
24
- rspec-core (~> 3.11.0)
25
- rspec-expectations (~> 3.11.0)
26
- rspec-mocks (~> 3.11.0)
27
- rspec-core (3.11.0)
28
- rspec-support (~> 3.11.0)
29
- rspec-expectations (3.11.0)
42
+ rake (13.4.2)
43
+ redcarpet (3.6.1)
44
+ regexp_parser (2.12.0)
45
+ reline (0.6.3)
46
+ io-console (~> 0.5)
47
+ rspec (3.13.2)
48
+ rspec-core (~> 3.13.0)
49
+ rspec-expectations (~> 3.13.0)
50
+ rspec-mocks (~> 3.13.0)
51
+ rspec-core (3.13.6)
52
+ rspec-support (~> 3.13.0)
53
+ rspec-expectations (3.13.5)
30
54
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.11.0)
32
- rspec-mocks (3.11.1)
55
+ rspec-support (~> 3.13.0)
56
+ rspec-mocks (3.13.8)
33
57
  diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.11.0)
35
- rspec-support (3.11.0)
36
- rubocop (1.30.1)
37
- parallel (~> 1.10)
38
- parser (>= 3.1.0.0)
58
+ rspec-support (~> 3.13.0)
59
+ rspec-support (3.13.7)
60
+ rubocop (1.89.0)
61
+ json (~> 2.3)
62
+ language_server-protocol (~> 3.17.0.2)
63
+ lint_roller (~> 1.1.0)
64
+ parallel (>= 1.10)
65
+ parser (>= 3.3.0.2)
39
66
  rainbow (>= 2.2.2, < 4.0)
40
- regexp_parser (>= 1.8, < 3.0)
41
- rexml (>= 3.2.5, < 4.0)
42
- rubocop-ast (>= 1.18.0, < 2.0)
67
+ regexp_parser (>= 2.9.3, < 3.0)
68
+ rubocop-ast (>= 1.49.0, < 2.0)
43
69
  ruby-progressbar (~> 1.7)
44
- unicode-display_width (>= 1.4.0, < 3.0)
45
- rubocop-ast (1.18.0)
46
- parser (>= 3.1.1.0)
47
- rubocop-rake (0.6.0)
48
- rubocop (~> 1.0)
49
- rubocop-rspec (2.11.1)
50
- rubocop (~> 1.19)
51
- ruby-progressbar (1.11.0)
52
- simplecov (0.21.2)
53
- docile (~> 1.1)
54
- simplecov-html (~> 0.11)
55
- simplecov_json_formatter (~> 0.1)
56
- simplecov-html (0.12.3)
57
- simplecov_json_formatter (0.1.4)
58
- unicode-display_width (2.1.0)
70
+ unicode-display_width (>= 2.4.0, < 4.0)
71
+ rubocop-ast (1.50.0)
72
+ parser (>= 3.3.7.2)
73
+ prism (~> 1.7)
74
+ rubocop-rake (0.7.1)
75
+ lint_roller (~> 1.1)
76
+ rubocop (>= 1.72.1)
77
+ rubocop-rspec (3.10.2)
78
+ lint_roller (~> 1.1)
79
+ regexp_parser (>= 2.0)
80
+ rubocop (~> 1.86, >= 1.86.2)
81
+ ruby-progressbar (1.13.0)
82
+ simplecov (1.0.3)
83
+ thor (1.5.0)
84
+ unicode-display_width (3.2.0)
85
+ unicode-emoji (~> 4.1)
86
+ unicode-emoji (4.2.0)
59
87
 
60
88
  PLATFORMS
89
+ aarch64-linux
61
90
  x86_64-darwin-20
62
91
  x86_64-darwin-22
63
92
  x86_64-linux
64
93
 
65
94
  DEPENDENCIES
95
+ base64
66
96
  bump
97
+ bundler-audit
67
98
  byebug
68
- rake (~> 12.0)
99
+ ostruct
100
+ rake (~> 13.0)
69
101
  redcarpet-form-extension!
70
102
  rspec
71
103
  rubocop
@@ -74,4 +106,4 @@ DEPENDENCIES
74
106
  simplecov
75
107
 
76
108
  BUNDLED WITH
77
- 2.5.4
109
+ 2.6.7
data/README.md CHANGED
@@ -104,6 +104,26 @@ The HTML result is:
104
104
 
105
105
  After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
106
106
 
107
+ ### VS Code Dev Container
108
+
109
+ This repository includes a dev container configuration in `.devcontainer/` using Ruby 4.0.6.
110
+
111
+ 1. Open the project in VS Code.
112
+ 2. Run **Dev Containers: Reopen in Container** from the Command Palette.
113
+ 3. Wait for the container build to complete. The `postCreateCommand` runs `bin/setup` automatically.
114
+ 4. On container start, `postStartCommand` verifies the environment with `ruby -v && bundle -v`.
115
+ 5. Recommended extensions are installed for this workspace: `Shopify.ruby-lsp`, `misogi.ruby-rubocop`, `GitHub.copilot`, and `GitHub.copilot-chat`.
116
+ 6. Run tests and linting inside the container:
117
+
118
+ ```bash
119
+ bundle exec rspec
120
+ bundle exec rubocop
121
+ bundle exec bundle-audit check --update
122
+ bundle exec rake
123
+ ```
124
+
125
+ If you change `.devcontainer/devcontainer.json` or `.devcontainer/Dockerfile`, rebuild with **Dev Containers: Rebuild Container**.
126
+
107
127
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
108
128
 
109
129
  ## Contributing
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'loofah'
4
+
3
5
  require_relative '../block/checkboxes'
4
6
  require_relative '../block/radio_buttons'
5
7
  require_relative '../block/textarea'
@@ -16,6 +18,12 @@ module Redcarpet
16
18
  process_custom_tags(text.strip)
17
19
  end
18
20
 
21
+ def postprocess(document)
22
+ # Removes unknown/unsafe tags and their children
23
+ # https://github.com/flavorjones/loofah?tab=readme-ov-file#built-in-html-scrubbers
24
+ Loofah.fragment(document).scrub!(:prune).to_s
25
+ end
26
+
19
27
  private
20
28
 
21
29
  # Processes custom tags (inline tags and block tags)
@@ -3,7 +3,7 @@
3
3
  module Redcarpet
4
4
  module Form
5
5
  module Extension
6
- VERSION = '0.4.0'
6
+ VERSION = '2.0.0'
7
7
  end
8
8
  end
9
9
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'A Redcarpet extension with a custom HTML render to handle custom Markdown rules for tags like inputs and textareas'
13
13
  spec.homepage = 'https://github.com/SofiaSousa/redcarpet-form-extension'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 4.0.0')
16
16
 
17
17
  # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
18
18
 
@@ -29,5 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ['lib']
31
31
 
32
- spec.add_dependency 'redcarpet', '~> 3.6.0'
32
+ spec.add_dependency 'loofah', '~> 2.25.0'
33
+ spec.add_dependency 'redcarpet', '~> 3.6.1'
33
34
  end
metadata CHANGED
@@ -1,29 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redcarpet-form-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sofia Sousa
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-01-08 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: loofah
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 2.25.0
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: 2.25.0
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: redcarpet
15
28
  requirement: !ruby/object:Gem::Requirement
16
29
  requirements:
17
30
  - - "~>"
18
31
  - !ruby/object:Gem::Version
19
- version: 3.6.0
32
+ version: 3.6.1
20
33
  type: :runtime
21
34
  prerelease: false
22
35
  version_requirements: !ruby/object:Gem::Requirement
23
36
  requirements:
24
37
  - - "~>"
25
38
  - !ruby/object:Gem::Version
26
- version: 3.6.0
39
+ version: 3.6.1
27
40
  description: A Redcarpet extension with a custom HTML render to handle custom Markdown
28
41
  rules for tags like inputs and textareas
29
42
  email:
@@ -32,6 +45,8 @@ executables: []
32
45
  extensions: []
33
46
  extra_rdoc_files: []
34
47
  files:
48
+ - ".devcontainer/Dockerfile"
49
+ - ".devcontainer/devcontainer.json"
35
50
  - ".github/workflows/gem-push.yml"
36
51
  - ".gitignore"
37
52
  - ".rspec"
@@ -62,7 +77,6 @@ metadata:
62
77
  homepage_uri: https://github.com/SofiaSousa/redcarpet-form-extension
63
78
  source_code_uri: https://github.com/SofiaSousa/redcarpet-form-extension
64
79
  changelog_uri: https://github.com/SofiaSousa/redcarpet-form-extension
65
- post_install_message:
66
80
  rdoc_options: []
67
81
  require_paths:
68
82
  - lib
@@ -70,15 +84,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
84
  requirements:
71
85
  - - ">="
72
86
  - !ruby/object:Gem::Version
73
- version: 3.1.0
87
+ version: 4.0.0
74
88
  required_rubygems_version: !ruby/object:Gem::Requirement
75
89
  requirements:
76
90
  - - ">="
77
91
  - !ruby/object:Gem::Version
78
92
  version: '0'
79
93
  requirements: []
80
- rubygems_version: 3.4.10
81
- signing_key:
94
+ rubygems_version: 4.0.16
82
95
  specification_version: 4
83
96
  summary: A Redcarpet extension with a custom HTML render to handle custom Markdown
84
97
  rules for tags like inputs and textareas