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 +4 -4
- data/.github/stale.yml +17 -0
- data/.rubocop.yml +27 -0
- data/.travis.yml +5 -5
- data/Gemfile +2 -0
- data/History.markdown +14 -0
- data/LICENSE +1 -1
- data/Rakefile +3 -1
- data/Readme.md +2 -1
- data/appveyor.yml +24 -0
- data/jekyll-commonmark.gemspec +10 -6
- data/lib/jekyll-commonmark.rb +23 -17
- data/lib/jekyll-commonmark/version.rb +7 -0
- data/script/cibuild +1 -0
- data/script/console +7 -6
- data/script/fmt +5 -0
- data/spec/jekyll_commonmark_spec.rb +90 -0
- data/spec/spec_helper.rb +12 -0
- metadata +38 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7fa262bbb8c204258512eae201ef6fd2102378c
|
4
|
+
data.tar.gz: 99d43b95c8a8151360285bce64dc6263cc799b15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a80334dc9f6498dddd27e5e84834cf606f839651f0cc0f354bbe95fa867b7f1f81f799d65ce6888aed7e35182fd8a59bb19053c3b114c188e7bf240f96775659
|
7
|
+
data.tar.gz: 2ee960a701c99be7368fd048e1abc6cf1689776168da923b49a3056c682dccdffcc3b7ca15b21bdf0179b27a43eb0c53a4350caf15f319c5f52ada15a0f3b130
|
data/.github/stale.yml
ADDED
@@ -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
|
data/.rubocop.yml
ADDED
@@ -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/**/*
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/History.markdown
ADDED
@@ -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
data/Readme.md
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
*CommonMark Markdown converter for Jekyll*
|
4
4
|
|
5
5
|
[](https://rubygems.org/gems/jekyll-commonmark)
|
6
|
-
[](https://travis-ci.org/jekyll/jekyll-commonmark)
|
7
|
+
[](https://ci.appveyor.com/project/pathawks/jekyll-commonmark)
|
7
8
|
[](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.
|
data/appveyor.yml
ADDED
@@ -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'
|
data/jekyll-commonmark.gemspec
CHANGED
@@ -1,23 +1,27 @@
|
|
1
|
-
#
|
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 =
|
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
|
14
|
-
spec.test_files = spec.files.grep(%r
|
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 "
|
22
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
26
|
+
spec.add_development_dependency "rubocop", "~> 0.52.0"
|
23
27
|
end
|
data/lib/jekyll-commonmark.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
#
|
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
|
-
|
9
|
+
options = config["commonmark"]["options"].collect { |e| e.upcase.to_sym }
|
11
10
|
rescue NoMethodError
|
12
|
-
|
11
|
+
options = []
|
13
12
|
else
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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[
|
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
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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, @
|
43
|
+
CommonMarker.render_doc(content, @parse_options, @extensions)
|
44
|
+
.to_html(@render_options, @extensions)
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
data/script/cibuild
CHANGED
data/script/console
CHANGED
@@ -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
|
8
|
-
require relative_to_root(
|
9
|
-
require
|
8
|
+
require "jekyll"
|
9
|
+
require relative_to_root("lib/jekyll-smartify.rb")
|
10
|
+
require "pry-debugger"
|
10
11
|
|
11
|
-
SOURCE_DIR = relative_to_root(
|
12
|
-
DEST_DIR = relative_to_root(
|
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
|
|
data/script/fmt
ADDED
@@ -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>"SmartyPants"</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
|
data/spec/spec_helper.rb
ADDED
@@ -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.
|
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:
|
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:
|
48
|
+
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
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: '
|
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:
|
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:
|
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:
|
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.
|
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
|