github-markup 3.0.4 → 3.0.5
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/HISTORY.md +5 -0
- data/github-markup.gemspec +5 -3
- data/lib/github-markup.rb +1 -1
- data/lib/github/markup/markdown.rb +2 -1
- data/lib/github/markups.rb +6 -3
- data/test/markup_test.rb +10 -1
- metadata +7 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed10cd1dbc1a7163fdf02e5cb7ee8ca2a7b2fca74f740b862c051aee1bc1547b
|
4
|
+
data.tar.gz: f0bda9286bc09c5409e805d20ac67c5f0d5ea25e41b97e3512526597c439a573
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2b9ce502ae753a9cdc2559803d4e3dc24a578f09de84ff4899a886e3252a4ec89a9fb045f0c69ca2ba440638e552487c7f51ddeb56c32f6a9841fdd52f777aa
|
7
|
+
data.tar.gz: 2031883234215ba63e23c4f7be7aef7daf8b270ce4ce82a5723caca12a32182beea84046db399ee551e34df72a1bbdd3340407f3c54e1ee13300e3111bf17578
|
data/HISTORY.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 3.0.5 - 2020-11-12
|
2
|
+
|
3
|
+
* Add commonmarker_exts to commonmarker options [#1268](https://github.com/github/markup/pull/1268)
|
4
|
+
* Check whether filename is set when rendering Asciidoc. [#1290](https://github.com/github/markup/pull/1290)
|
5
|
+
|
1
6
|
## 3.0.4 - 2019-04-03
|
2
7
|
|
3
8
|
* Expose options in #render_s [#1249](https://github.com/github/markup/pull/1249)
|
data/github-markup.gemspec
CHANGED
@@ -4,8 +4,10 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = "github-markup"
|
5
5
|
s.version = GitHub::Markup::VERSION
|
6
6
|
s.summary = "The code GitHub uses to render README.markup"
|
7
|
-
s.description =
|
8
|
-
|
7
|
+
s.description = <<~DESC
|
8
|
+
This gem is used by GitHub to render any fancy markup such as Markdown,
|
9
|
+
Textile, Org-Mode, etc. Fork it and add your own!
|
10
|
+
DESC
|
9
11
|
s.authors = ["Chris Wanstrath"]
|
10
12
|
s.email = "chris@ozmm.org"
|
11
13
|
s.homepage = "https://github.com/github/markup"
|
@@ -21,7 +23,7 @@ Gem::Specification.new do |s|
|
|
21
23
|
s.add_development_dependency 'activesupport', '~> 4.0'
|
22
24
|
s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3'
|
23
25
|
s.add_development_dependency 'html-pipeline', '~> 1.0'
|
24
|
-
s.add_development_dependency 'sanitize', '
|
26
|
+
s.add_development_dependency 'sanitize', '>= 4.6.3'
|
25
27
|
s.add_development_dependency 'nokogiri', '~> 1.8.1'
|
26
28
|
s.add_development_dependency 'nokogiri-diff', '~> 0.2.0'
|
27
29
|
s.add_development_dependency "github-linguist", ">= 7.1.3"
|
data/lib/github-markup.rb
CHANGED
@@ -6,7 +6,8 @@ module GitHub
|
|
6
6
|
MARKDOWN_GEMS = {
|
7
7
|
"commonmarker" => proc { |content, options: {}|
|
8
8
|
commonmarker_opts = [:GITHUB_PRE_LANG].concat(options.fetch(:commonmarker_opts, []))
|
9
|
-
|
9
|
+
commonmarker_exts = options.fetch(:commonmarker_exts, [:tagfilter, :autolink, :table, :strikethrough])
|
10
|
+
CommonMarker.render_html(content, commonmarker_opts, commonmarker_exts)
|
10
11
|
},
|
11
12
|
"github/markdown" => proc { |content, options: {}|
|
12
13
|
GitHub::Markdown.render(content)
|
data/lib/github/markups.rb
CHANGED
@@ -33,13 +33,16 @@ markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["A
|
|
33
33
|
'idprefix' => '',
|
34
34
|
'idseparator' => '-',
|
35
35
|
'sectanchors' => nil,
|
36
|
-
'docname' => File.basename(filename, (extname = File.extname(filename))),
|
37
|
-
'docfilesuffix' => extname,
|
38
|
-
'outfilesuffix' => extname,
|
39
36
|
'env' => 'github',
|
40
37
|
'env-github' => '',
|
41
38
|
'source-highlighter' => 'html-pipeline'
|
42
39
|
}
|
40
|
+
if filename
|
41
|
+
attributes['docname'] = File.basename(filename, (extname = File.extname(filename)))
|
42
|
+
attributes['docfilesuffix'] = attributes['outfilesuffix'] = extname
|
43
|
+
else
|
44
|
+
attributes['outfilesuffix'] = '.adoc'
|
45
|
+
end
|
43
46
|
Asciidoctor::Compliance.unique_id_start_index = 1
|
44
47
|
Asciidoctor.convert(content, :safe => :secure, :attributes => attributes)
|
45
48
|
end
|
data/test/markup_test.rb
CHANGED
@@ -94,7 +94,10 @@ message
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def test_rendering_by_symbol
|
97
|
-
|
97
|
+
markup = '`test`'
|
98
|
+
result = /<p><code>test<\/code><\/p>/
|
99
|
+
assert_match result, GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, markup).strip
|
100
|
+
assert_match result, GitHub::Markup.render_s(GitHub::Markups::MARKUP_ASCIIDOC, markup).split.join
|
98
101
|
end
|
99
102
|
|
100
103
|
def test_raises_error_if_command_exits_non_zero
|
@@ -120,5 +123,11 @@ message
|
|
120
123
|
|
121
124
|
assert_equal "<p>hello <!-- raw HTML omitted --> world</p>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello <bad> world")
|
122
125
|
assert_equal "<p>hello <bad> world</p>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello <bad> world", options: {commonmarker_opts: [:UNSAFE]})
|
126
|
+
|
127
|
+
assert_equal "<style>.red{color: red;}</style>\n", GitHub::Markup.render("test.md", "<style>.red{color: red;}</style>", options: {commonmarker_opts: [:UNSAFE]})
|
128
|
+
assert_equal "<style>.red{color: red;}</style>\n", GitHub::Markup.render("test.md", "<style>.red{color: red;}</style>", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]})
|
129
|
+
|
130
|
+
assert_equal "<style>.red{color: red;}</style>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "<style>.red{color: red;}</style>", options: {commonmarker_opts: [:UNSAFE]})
|
131
|
+
assert_equal "<style>.red{color: red;}</style>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "<style>.red{color: red;}</style>", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]})
|
123
132
|
end
|
124
133
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-markup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -76,22 +76,16 @@ dependencies:
|
|
76
76
|
name: sanitize
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '2.1'
|
82
79
|
- - ">="
|
83
80
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
81
|
+
version: 4.6.3
|
85
82
|
type: :development
|
86
83
|
prerelease: false
|
87
84
|
version_requirements: !ruby/object:Gem::Requirement
|
88
85
|
requirements:
|
89
|
-
- - "~>"
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '2.1'
|
92
86
|
- - ">="
|
93
87
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
88
|
+
version: 4.6.3
|
95
89
|
- !ruby/object:Gem::Dependency
|
96
90
|
name: nokogiri
|
97
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,7 +128,8 @@ dependencies:
|
|
134
128
|
- - ">="
|
135
129
|
- !ruby/object:Gem::Version
|
136
130
|
version: 7.1.3
|
137
|
-
description:
|
131
|
+
description: |
|
132
|
+
This gem is used by GitHub to render any fancy markup such as Markdown,
|
138
133
|
Textile, Org-Mode, etc. Fork it and add your own!
|
139
134
|
email: chris@ozmm.org
|
140
135
|
executables:
|
@@ -225,8 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
220
|
- !ruby/object:Gem::Version
|
226
221
|
version: '0'
|
227
222
|
requirements: []
|
228
|
-
|
229
|
-
rubygems_version: 2.7.6
|
223
|
+
rubygems_version: 3.0.3
|
230
224
|
signing_key:
|
231
225
|
specification_version: 4
|
232
226
|
summary: The code GitHub uses to render README.markup
|