jekyll-commonmark 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.markdown +26 -0
- data/Readme.md +2 -4
- data/lib/jekyll-commonmark/html_renderer.rb +62 -0
- data/lib/jekyll-commonmark/version.rb +1 -1
- data/lib/jekyll-commonmark.rb +47 -33
- metadata +24 -41
- data/.github/stale.yml +0 -17
- data/.gitignore +0 -4
- data/.rubocop.yml +0 -12
- data/.rubocop_todo.yml +0 -39
- data/.travis.yml +0 -35
- data/Gemfile +0 -6
- data/Rakefile +0 -8
- data/appveyor.yml +0 -27
- data/jekyll-commonmark.gemspec +0 -29
- data/script/bootstrap +0 -3
- data/script/cibuild +0 -4
- data/script/console +0 -35
- data/script/fmt +0 -5
- data/script/release +0 -7
- data/spec/jekyll_commonmark_spec.rb +0 -90
- data/spec/spec_helper.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bda6fd984f53c9027917fa0e75046c6962532478d039de9155ac344923d8021
|
4
|
+
data.tar.gz: 675a90e1ef61e9c43481208adb3acba8f949383198a4c28d00f7573d59caf9fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c4d619ba9bea75f6e74e025ecf1b30f5399412cad0567e3f7c1f92e1507b91c325821e51fb40c5986255871992ab31c417ef791b669dd66551992fe2b372d4e
|
7
|
+
data.tar.gz: c13e47638595170762778b8b297dc41a90739161797203300f1f4454720a8743eda74f30cc1665ea5c60e732d2f3f947603f21d796cadb0c9853134e46613bed
|
data/History.markdown
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
## 1.4.0 / 2022-01-30
|
2
|
+
|
3
|
+
### Minor Enhancements
|
4
|
+
|
5
|
+
* Require at least commonmarker-0.22 (#44)
|
6
|
+
* Highlight fenced code-block contents with Rouge (#29)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* Refactor away extra abstractions (#53)
|
11
|
+
|
12
|
+
### Development Fixes
|
13
|
+
|
14
|
+
* DRY begin-rescue-end block with a private helper (#28)
|
15
|
+
* Fix failing CI builds (#33)
|
16
|
+
* Remove gemspec dependency on Jekyll (#34)
|
17
|
+
* Test rendering with invalid configuration (#27)
|
18
|
+
* Refactor to improve readability (#37)
|
19
|
+
* Set up Continuous Integration via GH Actions (#46)
|
20
|
+
* Clean up gemspec (#47)
|
21
|
+
* Add workflow to release gem via GH Actions (#54)
|
22
|
+
|
23
|
+
### Documentation
|
24
|
+
|
25
|
+
* Update README to link to commonmarker (#38)
|
26
|
+
|
1
27
|
## 1.3.1 / 2019-03-25
|
2
28
|
|
3
29
|
### Bug Fixes
|
data/Readme.md
CHANGED
@@ -5,9 +5,8 @@
|
|
5
5
|
[![Gem Version](https://img.shields.io/gem/v/jekyll-commonmark.svg)](https://rubygems.org/gems/jekyll-commonmark)
|
6
6
|
[![Build Status](https://img.shields.io/travis/jekyll/jekyll-commonmark/master.svg)](https://travis-ci.org/jekyll/jekyll-commonmark)
|
7
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)
|
8
|
-
[![Dependency Status](https://img.shields.io/gemnasium/pathawks/jekyll-commonmark.svg)](https://gemnasium.com/pathawks/jekyll-commonmark)
|
9
8
|
|
10
|
-
Jekyll Markdown converter that uses [libcmark](https://github.com/
|
9
|
+
Jekyll Markdown converter that uses [libcmark-gfm](https://github.com/github/cmark-gfm) (via [commonmarker](https://github.com/gjtorikian/commonmarker)).
|
11
10
|
As a result, it is faster than Kramdown.
|
12
11
|
|
13
12
|
GitHub Pages supports CommonMark through https://github.com/github/jekyll-commonmark-ghpages
|
@@ -36,5 +35,4 @@ To specify [extensions](https://github.com/gjtorikian/commonmarker#extensions) a
|
|
36
35
|
commonmark:
|
37
36
|
options: ["SMART", "FOOTNOTES"]
|
38
37
|
extensions: ["strikethrough", "autolink", "table"]
|
39
|
-
|
40
|
-
|
38
|
+
```
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Converters
|
5
|
+
class Markdown
|
6
|
+
class CommonMark
|
7
|
+
class HtmlRenderer < CommonMarker::HtmlRenderer
|
8
|
+
def code_block(node)
|
9
|
+
block do
|
10
|
+
lang = extract_code_lang(node.fence_info)
|
11
|
+
|
12
|
+
out('<div class="')
|
13
|
+
out("language-", lang, " ") if lang
|
14
|
+
out('highlighter-rouge"><div class="highlight">')
|
15
|
+
out("<pre", sourcepos(node), ' class="highlight"')
|
16
|
+
|
17
|
+
if option_enabled?(:GITHUB_PRE_LANG)
|
18
|
+
out_data_attr(lang)
|
19
|
+
out("><code>")
|
20
|
+
else
|
21
|
+
out("><code")
|
22
|
+
out_data_attr(lang)
|
23
|
+
out(">")
|
24
|
+
end
|
25
|
+
out(render_with_rouge(node.string_content, lang))
|
26
|
+
out("</code></pre></div></div>")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def extract_code_lang(info)
|
33
|
+
return unless info.is_a?(String)
|
34
|
+
return if info.empty?
|
35
|
+
|
36
|
+
info.split(%r!\s+!)[0]
|
37
|
+
end
|
38
|
+
|
39
|
+
def out_data_attr(lang)
|
40
|
+
return unless lang
|
41
|
+
|
42
|
+
out(' data-lang="', lang, '"')
|
43
|
+
end
|
44
|
+
|
45
|
+
def render_with_rouge(code, lang)
|
46
|
+
require "rouge"
|
47
|
+
|
48
|
+
formatter = Rouge::Formatters::HTMLLegacy.new(
|
49
|
+
:line_numbers => false,
|
50
|
+
:wrap => false,
|
51
|
+
:css_class => "highlight",
|
52
|
+
:gutter_class => "gutter",
|
53
|
+
:code_class => "code"
|
54
|
+
)
|
55
|
+
lexer = Rouge::Lexer.find_fancy(lang, code) || Rouge::Lexers::PlainText
|
56
|
+
formatter.format(lexer.lex(code))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/jekyll-commonmark.rb
CHANGED
@@ -4,47 +4,61 @@ module Jekyll
|
|
4
4
|
module Converters
|
5
5
|
class Markdown
|
6
6
|
class CommonMark
|
7
|
+
autoload :HtmlRenderer, "jekyll-commonmark/html_renderer"
|
8
|
+
|
7
9
|
def initialize(config)
|
8
10
|
Jekyll::External.require_with_graceful_fail "commonmarker"
|
9
|
-
begin
|
10
|
-
options = config["commonmark"]["options"].collect { |e| e.upcase.to_sym }
|
11
|
-
rescue NoMethodError
|
12
|
-
options = []
|
13
|
-
else
|
14
|
-
valid_opts = Set.new(CommonMarker::Config::Parse.keys + CommonMarker::Config::Render.keys)
|
15
|
-
options.reject! do |e|
|
16
|
-
next if valid_opts.include? e
|
17
|
-
|
18
|
-
Jekyll.logger.warn "CommonMark:", "#{e} is not a valid option"
|
19
|
-
Jekyll.logger.info "Valid options:", valid_opts.to_a.join(", ")
|
20
|
-
true
|
21
|
-
end
|
22
|
-
end
|
23
|
-
begin
|
24
|
-
@extensions = config["commonmark"]["extensions"].collect(&:to_sym)
|
25
|
-
rescue NoMethodError
|
26
|
-
@extensions = []
|
27
|
-
else
|
28
|
-
@extensions.reject! do |e|
|
29
|
-
next if CommonMarker.extensions.include? e.to_s
|
30
|
-
|
31
|
-
Jekyll.logger.warn "CommonMark:", "#{e} is not a valid extension"
|
32
|
-
Jekyll.logger.info "Valid extensions:", CommonMarker.extensions.join(", ")
|
33
|
-
true
|
34
|
-
end
|
35
|
-
end
|
36
11
|
|
37
|
-
|
38
|
-
|
39
|
-
|
12
|
+
parse_keys = CommonMarker::Config::OPTS[:parse].keys
|
13
|
+
render_keys = CommonMarker::Config::OPTS[:render].keys
|
14
|
+
|
15
|
+
options = setup_options(config, parse_keys, render_keys)
|
16
|
+
options_set = Set.new(options)
|
40
17
|
|
41
|
-
@
|
18
|
+
@extensions = setup_extensions(config)
|
19
|
+
|
20
|
+
@parse_options = (options_set & parse_keys).to_a
|
21
|
+
@render_options = (options_set & render_keys).to_a
|
22
|
+
|
23
|
+
@parse_options = :DEFAULT if @parse_options.empty?
|
42
24
|
@render_options = :DEFAULT if @render_options.empty?
|
43
25
|
end
|
44
26
|
|
45
27
|
def convert(content)
|
46
|
-
|
47
|
-
|
28
|
+
HtmlRenderer.new(
|
29
|
+
:options => @render_options,
|
30
|
+
:extensions => @extensions
|
31
|
+
).render(
|
32
|
+
CommonMarker.render_doc(content, @parse_options, @extensions)
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def validate(list, bucket, type)
|
39
|
+
list.reject do |item|
|
40
|
+
next if bucket.include?(item)
|
41
|
+
|
42
|
+
Jekyll.logger.warn "CommonMark:", "#{item} is not a valid #{type}"
|
43
|
+
Jekyll.logger.info "Valid #{type}s:", bucket.join(", ")
|
44
|
+
true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def setup_options(config, parse_keys, render_keys)
|
49
|
+
options = config["commonmark"]["options"].collect { |e| e.upcase.to_sym }
|
50
|
+
valid_opts = Set.new(parse_keys + render_keys).to_a
|
51
|
+
validate(options, valid_opts, "option")
|
52
|
+
rescue NoMethodError
|
53
|
+
[]
|
54
|
+
end
|
55
|
+
|
56
|
+
def setup_extensions(config)
|
57
|
+
extensions = config["commonmark"]["extensions"].collect(&:to_sym)
|
58
|
+
valid_extensions = CommonMarker.extensions.collect(&:to_sym)
|
59
|
+
validate(extensions, valid_extensions, "extension")
|
60
|
+
rescue NoMethodError
|
61
|
+
[]
|
48
62
|
end
|
49
63
|
end
|
50
64
|
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.4.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: 2022-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commonmarker
|
@@ -16,48 +16,48 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.22'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.22'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '5.0'
|
37
|
-
type: :runtime
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '5.0'
|
40
|
+
version: '0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
42
|
+
name: jekyll
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
45
|
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
47
|
+
version: '3.7'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '5.0'
|
54
51
|
type: :development
|
55
52
|
prerelease: false
|
56
53
|
version_requirements: !ruby/object:Gem::Requirement
|
57
54
|
requirements:
|
58
55
|
- - ">="
|
59
56
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
57
|
+
version: '3.7'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '5.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,42 +92,27 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: 0.12.0
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 0.12.0
|
103
103
|
description:
|
104
104
|
email: pat@pathawks.com
|
105
105
|
executables: []
|
106
106
|
extensions: []
|
107
107
|
extra_rdoc_files: []
|
108
108
|
files:
|
109
|
-
- ".github/stale.yml"
|
110
|
-
- ".gitignore"
|
111
|
-
- ".rubocop.yml"
|
112
|
-
- ".rubocop_todo.yml"
|
113
|
-
- ".travis.yml"
|
114
|
-
- Gemfile
|
115
109
|
- History.markdown
|
116
110
|
- LICENSE
|
117
|
-
- Rakefile
|
118
111
|
- Readme.md
|
119
|
-
- appveyor.yml
|
120
|
-
- jekyll-commonmark.gemspec
|
121
112
|
- lib/jekyll-commonmark.rb
|
113
|
+
- lib/jekyll-commonmark/html_renderer.rb
|
122
114
|
- lib/jekyll-commonmark/version.rb
|
123
|
-
|
124
|
-
- script/cibuild
|
125
|
-
- script/console
|
126
|
-
- script/fmt
|
127
|
-
- script/release
|
128
|
-
- spec/jekyll_commonmark_spec.rb
|
129
|
-
- spec/spec_helper.rb
|
130
|
-
homepage: https://github.com/pathawks/jekyll-commonmark
|
115
|
+
homepage: https://github.com/jekyll/jekyll-commonmark
|
131
116
|
licenses:
|
132
117
|
- MIT
|
133
118
|
metadata: {}
|
@@ -139,17 +124,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
124
|
requirements:
|
140
125
|
- - ">="
|
141
126
|
- !ruby/object:Gem::Version
|
142
|
-
version: 2.
|
127
|
+
version: 2.6.0
|
143
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
129
|
requirements:
|
145
130
|
- - ">="
|
146
131
|
- !ruby/object:Gem::Version
|
147
132
|
version: '0'
|
148
133
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.1.6
|
150
135
|
signing_key:
|
151
136
|
specification_version: 4
|
152
137
|
summary: CommonMark generator for Jekyll
|
153
|
-
test_files:
|
154
|
-
- spec/jekyll_commonmark_spec.rb
|
155
|
-
- spec/spec_helper.rb
|
138
|
+
test_files: []
|
data/.github/stale.yml
DELETED
@@ -1,17 +0,0 @@
|
|
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/.gitignore
DELETED
data/.rubocop.yml
DELETED
data/.rubocop_todo.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2019-01-03 13:58:24 +0100 using RuboCop version 0.62.0.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Configuration parameters: Max.
|
11
|
-
Metrics/AbcSize:
|
12
|
-
Exclude:
|
13
|
-
- 'lib/jekyll-commonmark.rb'
|
14
|
-
|
15
|
-
# Offense count: 1
|
16
|
-
# Configuration parameters: CountComments, Max, ExcludedMethods.
|
17
|
-
# ExcludedMethods: refine
|
18
|
-
Metrics/BlockLength:
|
19
|
-
Exclude:
|
20
|
-
- 'spec/jekyll_commonmark_spec.rb'
|
21
|
-
|
22
|
-
# Offense count: 1
|
23
|
-
# Configuration parameters: Max.
|
24
|
-
Metrics/CyclomaticComplexity:
|
25
|
-
Exclude:
|
26
|
-
- 'lib/jekyll-commonmark.rb'
|
27
|
-
|
28
|
-
# Offense count: 1
|
29
|
-
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
30
|
-
# URISchemes: http, https
|
31
|
-
Metrics/LineLength:
|
32
|
-
Exclude:
|
33
|
-
- 'lib/jekyll-commonmark.rb'
|
34
|
-
|
35
|
-
# Offense count: 1
|
36
|
-
# Configuration parameters: CountComments, Max, ExcludedMethods.
|
37
|
-
Metrics/MethodLength:
|
38
|
-
Exclude:
|
39
|
-
- 'lib/jekyll-commonmark.rb'
|
data/.travis.yml
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
rvm:
|
4
|
-
- &latest_ruby 2.6
|
5
|
-
- 2.4
|
6
|
-
- 2.3
|
7
|
-
git:
|
8
|
-
depth: 3
|
9
|
-
|
10
|
-
# we need a more recent cmake than travis/linux provides (at least 2.8.9):
|
11
|
-
addons:
|
12
|
-
apt:
|
13
|
-
sources:
|
14
|
-
- kalakris-cmake
|
15
|
-
packages:
|
16
|
-
- cmake
|
17
|
-
|
18
|
-
before_install:
|
19
|
-
- gem update --system
|
20
|
-
- gem install bundler
|
21
|
-
before_script: bundle update
|
22
|
-
script: script/cibuild
|
23
|
-
|
24
|
-
env:
|
25
|
-
global:
|
26
|
-
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
27
|
-
matrix:
|
28
|
-
- JEKYLL_VERSION="~> 3.8"
|
29
|
-
|
30
|
-
matrix:
|
31
|
-
include:
|
32
|
-
- rvm: *latest_ruby
|
33
|
-
env: JEKYLL_VERSION="~> 3.7.4"
|
34
|
-
- rvm: *latest_ruby
|
35
|
-
env: JEKYLL_VERSION=">= 4.0.0.pre.alpha1"
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/appveyor.yml
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
version: "{build}"
|
2
|
-
clone_depth: 5
|
3
|
-
build: off
|
4
|
-
|
5
|
-
install:
|
6
|
-
- SET PATH=C:\Ruby%RUBY_FOLDER_VER%-x64\bin;%PATH%
|
7
|
-
- bundle install --retry 5 --jobs=%NUMBER_OF_PROCESSORS% --clean --path vendor\bundle
|
8
|
-
|
9
|
-
environment:
|
10
|
-
JEKYLL_VERSION: "~> 3.8"
|
11
|
-
matrix:
|
12
|
-
- RUBY_FOLDER_VER: "26"
|
13
|
-
JEKYLL_VERSION : "~> 3.7.4"
|
14
|
-
- RUBY_FOLDER_VER: "26"
|
15
|
-
JEKYLL_VERSION : ">= 4.0.0.pre.alpha1"
|
16
|
-
- RUBY_FOLDER_VER: "26"
|
17
|
-
- RUBY_FOLDER_VER: "24"
|
18
|
-
- RUBY_FOLDER_VER: "23"
|
19
|
-
|
20
|
-
test_script:
|
21
|
-
- ruby --version
|
22
|
-
- gem --version
|
23
|
-
- bundler --version
|
24
|
-
- bash script/cibuild
|
25
|
-
|
26
|
-
cache:
|
27
|
-
- 'vendor\bundle -> appveyor.yml,Gemfile,jekyll-commonmark.gemspec'
|
data/jekyll-commonmark.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.expand_path("lib", __dir__)
|
4
|
-
require "jekyll-commonmark/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "jekyll-commonmark"
|
8
|
-
spec.summary = "CommonMark generator for Jekyll"
|
9
|
-
spec.version = Jekyll::CommonMark::VERSION
|
10
|
-
spec.authors = ["Pat Hawks"]
|
11
|
-
spec.email = "pat@pathawks.com"
|
12
|
-
spec.homepage = "https://github.com/pathawks/jekyll-commonmark"
|
13
|
-
spec.licenses = ["MIT"]
|
14
|
-
|
15
|
-
spec.files = `git ls-files -z`.split("\x0")
|
16
|
-
spec.executables = spec.files.grep(%r!^bin/!) { |f| File.basename(f) }
|
17
|
-
spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
|
18
|
-
spec.require_paths = ["lib"]
|
19
|
-
|
20
|
-
spec.required_ruby_version = ">= 2.3.0"
|
21
|
-
|
22
|
-
spec.add_runtime_dependency "commonmarker", "~> 0.14"
|
23
|
-
spec.add_runtime_dependency "jekyll", ">= 3.7", "< 5.0"
|
24
|
-
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rake", "~> 12.0"
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
-
spec.add_development_dependency "rubocop-jekyll", "~> 0.5"
|
29
|
-
end
|
data/script/bootstrap
DELETED
data/script/cibuild
DELETED
data/script/console
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
def relative_to_root(path)
|
5
|
-
File.expand_path(path, File.dirname(File.dirname(__FILE__)))
|
6
|
-
end
|
7
|
-
|
8
|
-
require "jekyll"
|
9
|
-
require relative_to_root("lib/jekyll-smartify.rb")
|
10
|
-
require "pry-debugger"
|
11
|
-
|
12
|
-
SOURCE_DIR = relative_to_root("spec/fixtures")
|
13
|
-
DEST_DIR = relative_to_root("spec/dest")
|
14
|
-
|
15
|
-
def source_dir(*files)
|
16
|
-
File.join(SOURCE_DIR, *files)
|
17
|
-
end
|
18
|
-
|
19
|
-
def dest_dir(*files)
|
20
|
-
File.join(DEST_DIR, *files)
|
21
|
-
end
|
22
|
-
|
23
|
-
def config(overrides = {})
|
24
|
-
Jekyll.configuration(
|
25
|
-
"source" => source_dir,
|
26
|
-
"destination" => dest_dir,
|
27
|
-
"url" => "http://example.org"
|
28
|
-
).merge(overrides)
|
29
|
-
end
|
30
|
-
|
31
|
-
def site(configuration = config)
|
32
|
-
Jekyll::Site.new(configuration)
|
33
|
-
end
|
34
|
-
|
35
|
-
binding.pry
|
data/script/fmt
DELETED
data/script/release
DELETED
@@ -1,90 +0,0 @@
|
|
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
DELETED
@@ -1,12 +0,0 @@
|
|
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
|