jekyll-commonmark 1.1.0 → 1.2.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
  SHA1:
3
- metadata.gz: 647af3a419ecde37fd6a43f237daac517b22aa12
4
- data.tar.gz: b85ba6624adf206e2a6d066b212651d13e413106
3
+ metadata.gz: c7fa262bbb8c204258512eae201ef6fd2102378c
4
+ data.tar.gz: 99d43b95c8a8151360285bce64dc6263cc799b15
5
5
  SHA512:
6
- metadata.gz: 7375fa11944b9dbdac92031ae3393410186b90935fbbdc8a26ca046d6b6c3547c735536bd347c05fe39a6303f3b29b95140839b62fc0405e0aae946f247661db
7
- data.tar.gz: 64a551c101c3d84045db1f6c6d193d54729ea87f91792f448aad9d34e40aa13bd0c91cb51cb8c77368901886403115dc8795dc5a5c058270dfec3003d8d5bd41
6
+ metadata.gz: a80334dc9f6498dddd27e5e84834cf606f839651f0cc0f354bbe95fa867b7f1f81f799d65ce6888aed7e35182fd8a59bb19053c3b114c188e7bf240f96775659
7
+ data.tar.gz: 2ee960a701c99be7368fd048e1abc6cf1689776168da923b49a3056c682dccdffcc3b7ca15b21bdf0179b27a43eb0c53a4350caf15f319c5f52ada15a0f3b130
@@ -0,0 +1,17 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 60
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
@@ -0,0 +1,27 @@
1
+ inherit_gem:
2
+ jekyll: .rubocop.yml
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.2
6
+ Exclude:
7
+ - vendor/**/*
8
+
9
+ Metrics/AbcSize:
10
+ Exclude:
11
+ - lib/jekyll-commonmark.rb
12
+
13
+ Metrics/MethodLength:
14
+ Exclude:
15
+ - lib/jekyll-commonmark.rb
16
+
17
+ Metrics/LineLength:
18
+ Exclude:
19
+ - lib/jekyll-commonmark.rb
20
+
21
+ Lint/Debugger:
22
+ Exclude:
23
+ - script/console
24
+
25
+ Metrics/BlockLength:
26
+ Exclude:
27
+ - spec/**/*
@@ -1,13 +1,13 @@
1
1
  language: ruby
2
2
  cache: bundler
3
+ sudo: false
3
4
  rvm:
5
+ - 2.5
6
+ - 2.4
7
+ - 2.3
4
8
  - 2.2
5
- - 2.1
6
- - 2.0
7
9
  git:
8
- depth: 10
9
-
10
- sudo: false
10
+ depth: 1
11
11
 
12
12
  # we need a more recent cmake than travis/linux provides (at least 2.8.9):
13
13
  addons:
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  gemspec
@@ -0,0 +1,14 @@
1
+ ## 1.2.0 / 2018-03-29
2
+
3
+ ### Minor Enhancements
4
+
5
+ * Allow render options (#4)
6
+ * Only set options once (#17)
7
+
8
+ ### Development Fixes
9
+
10
+ * Test plugin on Windows (#13)
11
+ * Allow options passed to Rubocop (#15)
12
+ * Add tests (#16)
13
+ * Test against Ruby 2.5 (#18)
14
+ * Version with class (#19)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Pat Hawks
3
+ Copyright (c) 2015-present Pat Hawks and jekyll-commonmark contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/Rakefile CHANGED
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
- require 'rspec/core/rake_task'
4
+ require "rspec/core/rake_task"
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
data/Readme.md CHANGED
@@ -3,7 +3,8 @@
3
3
  *CommonMark Markdown converter for Jekyll*
4
4
 
5
5
  [![Gem Version](https://img.shields.io/gem/v/jekyll-commonmark.svg)](https://rubygems.org/gems/jekyll-commonmark)
6
- [![Build Status](https://img.shields.io/travis/pathawks/jekyll-commonmark/master.svg)](https://travis-ci.org/pathawks/jekyll-commonmark)
6
+ [![Build Status](https://img.shields.io/travis/jekyll/jekyll-commonmark/master.svg)](https://travis-ci.org/jekyll/jekyll-commonmark)
7
+ [![Windows Build status](https://img.shields.io/appveyor/ci/pathawks/jekyll-commonmark/master.svg?label=Windows%20build)](https://ci.appveyor.com/project/pathawks/jekyll-commonmark)
7
8
  [![Dependency Status](https://img.shields.io/gemnasium/pathawks/jekyll-commonmark.svg)](https://gemnasium.com/pathawks/jekyll-commonmark)
8
9
 
9
10
  Jekyll Markdown converter that uses [libcmark](https://github.com/jgm/CommonMark), the reference parser for CommonMark.
@@ -0,0 +1,24 @@
1
+ version: "{build}"
2
+ clone_depth: 5
3
+ build: off
4
+
5
+ install:
6
+ - SET PATH=C:\Ruby%RUBY_FOLDER_VER%\bin;%PATH%
7
+ - bundle install --retry 5 --jobs=%NUMBER_OF_PROCESSORS% --clean --path vendor\bundle
8
+
9
+ environment:
10
+ matrix:
11
+ - RUBY_FOLDER_VER: "24"
12
+ - RUBY_FOLDER_VER: "24-x64"
13
+ - RUBY_FOLDER_VER: "23"
14
+ - RUBY_FOLDER_VER: "22"
15
+ - RUBY_FOLDER_VER: "21"
16
+
17
+ test_script:
18
+ - ruby --version
19
+ - gem --version
20
+ - bundler --version
21
+ - bash script/cibuild
22
+
23
+ cache:
24
+ - 'vendor\bundle -> appveyor.yml,Gemfile,jekyll-commonmark.gemspec'
@@ -1,23 +1,27 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path("lib", __dir__)
4
+ require "jekyll-commonmark/version"
2
5
 
3
6
  Gem::Specification.new do |spec|
4
7
  spec.name = "jekyll-commonmark"
5
8
  spec.summary = "CommonMark generator for Jekyll"
6
- spec.version = "1.1.0"
9
+ spec.version = Jekyll::CommonMark::VERSION
7
10
  spec.authors = ["Pat Hawks"]
8
11
  spec.email = "pat@pathawks.com"
9
12
  spec.homepage = "https://github.com/pathawks/jekyll-commonmark"
10
13
  spec.licenses = ["MIT"]
11
14
 
12
15
  spec.files = `git ls-files -z`.split("\x0")
13
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.executables = spec.files.grep(%r!^bin/!) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
15
18
  spec.require_paths = ["lib"]
16
19
 
17
20
  spec.add_runtime_dependency "commonmarker", "~> 0.14"
18
21
  spec.add_runtime_dependency "jekyll", [">= 3.0", "< 4.0"]
19
22
 
23
+ spec.add_development_dependency "bundler", "~> 1.15"
24
+ spec.add_development_dependency "rake", "~> 12.0"
20
25
  spec.add_development_dependency "rspec", "~> 3.0"
21
- spec.add_development_dependency "rake"
22
- spec.add_development_dependency "bundler", "~> 1.6"
26
+ spec.add_development_dependency "rubocop", "~> 0.52.0"
23
27
  end
@@ -1,5 +1,4 @@
1
- # Frozen-string-literal: true
2
- # Encoding: utf-8
1
+ # frozen-string-literal: true
3
2
 
4
3
  module Jekyll
5
4
  module Converters
@@ -7,35 +6,42 @@ module Jekyll
7
6
  def initialize(config)
8
7
  Jekyll::External.require_with_graceful_fail "commonmarker"
9
8
  begin
10
- @options = config['commonmark']['options'].collect { |e| e.upcase.to_sym }
9
+ options = config["commonmark"]["options"].collect { |e| e.upcase.to_sym }
11
10
  rescue NoMethodError
12
- @options = [:DEFAULT]
11
+ options = []
13
12
  else
14
- @options.reject! do |e|
15
- unless CommonMarker::Config::Parse.keys.include? e
16
- Jekyll.logger.warn "CommonMark:", "#{e} is not a valid option"
17
- Jekyll.logger.info "Valid options:", CommonMarker::Config::Parse.keys.join(", ")
18
- true
19
- end
13
+ valid_opts = Set.new(CommonMarker::Config::Parse.keys + CommonMarker::Config::Render.keys)
14
+ options.reject! do |e|
15
+ next if valid_opts.include? e
16
+ Jekyll.logger.warn "CommonMark:", "#{e} is not a valid option"
17
+ Jekyll.logger.info "Valid options:", valid_opts.to_a.join(", ")
18
+ true
20
19
  end
21
20
  end
22
21
  begin
23
- @extensions = config['commonmark']['extensions'].collect { |e| e.to_sym }
22
+ @extensions = config["commonmark"]["extensions"].collect(&:to_sym)
24
23
  rescue NoMethodError
25
24
  @extensions = []
26
25
  else
27
26
  @extensions.reject! do |e|
28
- unless CommonMarker.extensions.include? e.to_s
29
- Jekyll.logger.warn "CommonMark:", "#{e} is not a valid extension"
30
- Jekyll.logger.info "Valid extensions:", CommonMarker.extensions.join(", ")
31
- true
32
- end
27
+ next if CommonMarker.extensions.include? e.to_s
28
+ Jekyll.logger.warn "CommonMark:", "#{e} is not a valid extension"
29
+ Jekyll.logger.info "Valid extensions:", CommonMarker.extensions.join(", ")
30
+ true
33
31
  end
34
32
  end
33
+
34
+ options_set = Set.new(options).freeze
35
+ @parse_options = (options_set & CommonMarker::Config::Parse.keys).to_a
36
+ @render_options = (options_set & CommonMarker::Config::Render.keys).to_a
37
+
38
+ @parse_options = :DEFAULT if @parse_options.empty?
39
+ @render_options = :DEFAULT if @render_options.empty?
35
40
  end
36
41
 
37
42
  def convert(content)
38
- CommonMarker.render_doc(content, @options, @extensions).to_html
43
+ CommonMarker.render_doc(content, @parse_options, @extensions)
44
+ .to_html(@render_options, @extensions)
39
45
  end
40
46
  end
41
47
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module CommonMark
5
+ VERSION = "1.2.0".freeze
6
+ end
7
+ end
@@ -1,3 +1,4 @@
1
1
  #! /bin/bash
2
2
 
3
+ script/fmt
3
4
  bundle exec rspec
@@ -1,15 +1,16 @@
1
1
  #! /usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  def relative_to_root(path)
4
5
  File.expand_path(path, File.dirname(File.dirname(__FILE__)))
5
6
  end
6
7
 
7
- require 'jekyll'
8
- require relative_to_root('lib/jekyll-smartify.rb')
9
- require 'pry-debugger'
8
+ require "jekyll"
9
+ require relative_to_root("lib/jekyll-smartify.rb")
10
+ require "pry-debugger"
10
11
 
11
- SOURCE_DIR = relative_to_root('spec/fixtures')
12
- DEST_DIR = relative_to_root('spec/dest')
12
+ SOURCE_DIR = relative_to_root("spec/fixtures")
13
+ DEST_DIR = relative_to_root("spec/dest")
13
14
 
14
15
  def source_dir(*files)
15
16
  File.join(SOURCE_DIR, *files)
@@ -23,7 +24,7 @@ def config(overrides = {})
23
24
  Jekyll.configuration({
24
25
  "source" => source_dir,
25
26
  "destination" => dest_dir,
26
- "url" => "http://example.org"
27
+ "url" => "http://example.org",
27
28
  }).merge(overrides)
28
29
  end
29
30
 
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+ echo "Rubocop $(bundle exec rubocop --version)"
5
+ bundle exec rubocop -D -E $@
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ describe(Jekyll::Converters::Markdown::CommonMark) do
6
+ let(:options) { [] }
7
+ let(:extensions) { [] }
8
+ let(:config) do
9
+ {
10
+ "commonmark" => {
11
+ "options" => options,
12
+ "extensions" => extensions,
13
+ },
14
+ }
15
+ end
16
+ let(:commonmark) { described_class.new(config) }
17
+ let(:output) { commonmark.convert(content) }
18
+
19
+ context "with default configuration" do
20
+ it "produces the correct script tag" do
21
+ actual = commonmark.convert("# Heading")
22
+ expected = "<h1>Heading</h1>"
23
+ expect(actual).to match(expected)
24
+ end
25
+
26
+ it "does not treat newlines as hardbreaks" do
27
+ actual = commonmark.convert("a\nb")
28
+ expected = "<p>a\nb</p>"
29
+ expect(actual).to match(expected)
30
+ end
31
+
32
+ it "treats double linebreaks as a new paragraph" do
33
+ actual = commonmark.convert("a\n\nb")
34
+ expected = "<p>a</p>\n<p>b</p>"
35
+ expect(actual).to match(expected)
36
+ end
37
+
38
+ it "escapes quotes" do
39
+ actual = commonmark.convert('"SmartyPants"')
40
+ expected = "<p>&quot;SmartyPants&quot;</p>"
41
+ expect(actual).to match(expected)
42
+ end
43
+
44
+ it "does not link urls" do
45
+ actual = commonmark.convert("https://example.com")
46
+ expected = "https://example.com"
47
+ expect(actual).to match(expected)
48
+ end
49
+ end
50
+
51
+ context "with SmartyPants enabled" do
52
+ let(:options) { ["SMART"] }
53
+
54
+ it "makes quotes curly" do
55
+ actual = commonmark.convert('"SmartyPants"')
56
+ expected = "<p>“SmartyPants”</p>"
57
+ expect(actual).to match(expected)
58
+ end
59
+ end
60
+
61
+ context "with hardbreaks enabled" do
62
+ let(:options) { ["HARDBREAKS"] }
63
+
64
+ it "treats newlines as hardbreaks" do
65
+ actual = commonmark.convert("a\nb")
66
+ expected = "<p>a<br />\nb</p>"
67
+ expect(actual).to match(expected)
68
+ end
69
+ end
70
+
71
+ context "with nobreaks enabled" do
72
+ let(:options) { ["NOBREAKS"] }
73
+
74
+ it "treats newlines as a single space" do
75
+ actual = commonmark.convert("a\nb")
76
+ expected = "<p>a b</p>"
77
+ expect(actual).to match(expected)
78
+ end
79
+ end
80
+
81
+ context "with autolink enabled" do
82
+ let(:extensions) { ["autolink"] }
83
+
84
+ it "links urls" do
85
+ actual = commonmark.convert("https://example.com")
86
+ expected = '<p><a href="https://example.com">https://example.com</a></p>'
87
+ expect(actual).to match(expected)
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require_relative "../lib/jekyll-commonmark.rb"
5
+
6
+ Jekyll.logger.log_level = :info
7
+
8
+ RSpec.configure do |config|
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+ config.order = "random"
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-commonmark
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Hawks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-17 00:00:00.000000000 Z
11
+ date: 2018-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commonmarker
@@ -45,65 +45,87 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '4.0'
47
47
  - !ruby/object:Gem::Dependency
48
- name: rspec
48
+ name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '3.0'
53
+ version: '1.15'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '3.0'
60
+ version: '1.15'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '12.0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: '12.0'
75
75
  - !ruby/object:Gem::Dependency
76
- name: bundler
76
+ name: rspec
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rubocop
77
91
  requirement: !ruby/object:Gem::Requirement
78
92
  requirements:
79
93
  - - "~>"
80
94
  - !ruby/object:Gem::Version
81
- version: '1.6'
95
+ version: 0.52.0
82
96
  type: :development
83
97
  prerelease: false
84
98
  version_requirements: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - "~>"
87
101
  - !ruby/object:Gem::Version
88
- version: '1.6'
102
+ version: 0.52.0
89
103
  description:
90
104
  email: pat@pathawks.com
91
105
  executables: []
92
106
  extensions: []
93
107
  extra_rdoc_files: []
94
108
  files:
109
+ - ".github/stale.yml"
95
110
  - ".gitignore"
111
+ - ".rubocop.yml"
96
112
  - ".travis.yml"
97
113
  - Gemfile
114
+ - History.markdown
98
115
  - LICENSE
99
116
  - Rakefile
100
117
  - Readme.md
118
+ - appveyor.yml
101
119
  - jekyll-commonmark.gemspec
102
120
  - lib/jekyll-commonmark.rb
121
+ - lib/jekyll-commonmark/version.rb
103
122
  - script/bootstrap
104
123
  - script/cibuild
105
124
  - script/console
125
+ - script/fmt
106
126
  - script/release
127
+ - spec/jekyll_commonmark_spec.rb
128
+ - spec/spec_helper.rb
107
129
  homepage: https://github.com/pathawks/jekyll-commonmark
108
130
  licenses:
109
131
  - MIT
@@ -124,8 +146,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
146
  version: '0'
125
147
  requirements: []
126
148
  rubyforge_project:
127
- rubygems_version: 2.6.8
149
+ rubygems_version: 2.6.14
128
150
  signing_key:
129
151
  specification_version: 4
130
152
  summary: CommonMark generator for Jekyll
131
- test_files: []
153
+ test_files:
154
+ - spec/jekyll_commonmark_spec.rb
155
+ - spec/spec_helper.rb