html-pipeline 2.12.0 → 2.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/Appraisals +4 -0
- data/CHANGELOG.md +100 -33
- data/lib/html/pipeline/markdown_filter.rb +22 -6
- data/lib/html/pipeline/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d8b4fd16f43cfa3b0c17d2b160a0e294bfa703e8d06dc6f665b22f23cea84df
|
4
|
+
data.tar.gz: 2be082b8d729165f559a4534772e175d090527bcff992af7142be088699da2ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b41e39351ae22fd30108d43332c7b20dcab3a847e20346d640ea966cbd160ecf3a08e1bc395fe6f5fc5e9fc71718850ee7ebcbbe195097cb66b6cad76ebdeb04
|
7
|
+
data.tar.gz: 9fdcea4ac0acc119d76cb1b3148ca56a3f127ec66fe58df022a68730811be5598f5873ade35ed2fb16c2a5f4374a5559f10730fab6419dc52369bc48dc6a2d19
|
data/.travis.yml
CHANGED
@@ -13,6 +13,7 @@ addons:
|
|
13
13
|
script: bundle exec rake
|
14
14
|
|
15
15
|
gemfile:
|
16
|
+
- gemfiles/rails_6.gemfile
|
16
17
|
- gemfiles/rails_5.gemfile
|
17
18
|
- gemfiles/rails_4.gemfile
|
18
19
|
- gemfiles/rails_3.gemfile
|
@@ -20,6 +21,7 @@ gemfile:
|
|
20
21
|
rvm:
|
21
22
|
- 2.4.6
|
22
23
|
- 2.3.8
|
24
|
+
- 2.5.7
|
23
25
|
- ruby-head
|
24
26
|
|
25
27
|
matrix:
|
@@ -27,7 +29,15 @@ matrix:
|
|
27
29
|
allow_failures:
|
28
30
|
- rvm: ruby-head
|
29
31
|
exclude:
|
32
|
+
- gemfile: gemfiles/rails_6.gemfile
|
33
|
+
rvm: 2.4.6
|
34
|
+
- gemfile: gemfiles/rails_6.gemfile
|
35
|
+
rvm: 2.3.8
|
36
|
+
- gemfile: gemfiles/rails_4.gemfile
|
37
|
+
rvm: 2.5.7
|
30
38
|
- gemfile: gemfiles/rails_4.gemfile
|
31
39
|
rvm: 2.4.6
|
40
|
+
- gemfile: gemfiles/rails_3.gemfile
|
41
|
+
rvm: 2.5.7
|
32
42
|
- gemfile: gemfiles/rails_3.gemfile
|
33
43
|
rvm: 2.4.6
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,80 +1,147 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 2.12.0
|
4
|
+
|
5
|
+
* Team mention filter [#314](https://github.com/jch/html-pipeline/pull/314)
|
6
|
+
|
7
|
+
## 2.11.1
|
8
|
+
|
9
|
+
* Avoid YARD warning: Unknown tag @mention [#309](https://github.com/jch/html-pipeline/pull/309)
|
10
|
+
* Freeze string literals in Ruby 2.3 and beyond [#313](https://github.com/jch/html-pipeline/pull/313)
|
11
|
+
|
12
|
+
## 2.11.0
|
13
|
+
|
14
|
+
* Test against Ruby 2.4 [#310](https://github.com/jch/html-pipeline/pull/310)
|
15
|
+
* CamoFilter: use String#unpack to hexencode URLs [#256](https://github.com/jch/html-pipeline/pull/256)
|
16
|
+
|
17
|
+
## 2.10.0
|
18
|
+
|
19
|
+
* Add XMPP URI [#307](https://github.com/jch/html-pipeline/pull/307)
|
20
|
+
* Stop testing against Ruby 2.2
|
21
|
+
|
22
|
+
## 2.9.2
|
23
|
+
|
24
|
+
* Whitelist various inline semantic/formatting tags [#306](https://github.com/jch/html-pipeline/pull/306)
|
25
|
+
|
26
|
+
## 2.9.1
|
27
|
+
|
28
|
+
* Render irc and ircs URLs [#191](https://github.com/jch/html-pipeline/pull/191)
|
29
|
+
|
30
|
+
## 2.9.0
|
31
|
+
|
32
|
+
* Fix one more missing freeze [#300](https://github.com/jch/html-pipeline/pull/300)
|
33
|
+
* Adds `UNSAFE` option to CommonMarker usage where needed [#304](https://github.com/jch/html-pipeline/pull/304)
|
34
|
+
|
35
|
+
## 2.8.4
|
36
|
+
|
37
|
+
* Freeze all elements in HTML::Pipeline::SanitizationFilter [#299](https://github.com/jch/html-pipeline/pull/299)
|
38
|
+
|
39
|
+
## 2.8.3
|
40
|
+
|
41
|
+
* Whitelist some accessibility properties [#298](https://github.com/jch/html-pipeline/pull/298)
|
42
|
+
|
43
|
+
## 2.8.2
|
44
|
+
|
45
|
+
* Update ruby-sanitize (fixes CVE-2018-3740)
|
46
|
+
|
47
|
+
## 2.8.1
|
48
|
+
|
49
|
+
* Fix XSS vulnerability on table of content generation [#296](https://github.com/jch/html-pipeline/pull/296)
|
50
|
+
|
51
|
+
## 2.8.0
|
52
|
+
|
53
|
+
* Ensure `<pre>` nodes are not removed after syntax highlighting [#295](https://github.com/jch/html-pipeline/pull/295)
|
54
|
+
|
55
|
+
## 2.7.2
|
56
|
+
|
57
|
+
* Apply mention filter & emoji filter on node text [#290](https://github.com/jch/html-pipeline/pull/290)
|
58
|
+
* Disable processing @mentions in `<script>` tag [#292](https://github.com/jch/html-pipeline/pull/292)
|
59
|
+
* Update dependencies [#291](https://github.com/jch/html-pipeline/pull/291)
|
60
|
+
|
61
|
+
## 2.7.1
|
62
|
+
|
63
|
+
* Output underlying load error when wrapping [#284](https://github.com/jch/html-pipeline/pull/284)
|
64
|
+
|
65
|
+
## 2.7.0
|
66
|
+
|
67
|
+
* Let users set the common marker extensions [#279](https://github.com/jch/html-pipeline/pull/279)
|
68
|
+
|
3
69
|
## 2.6.0
|
4
|
-
|
5
|
-
*
|
70
|
+
|
71
|
+
* Switch from github-markdown to CommonMark [#274](https://github.com/jch/html-pipeline/pull/274)
|
72
|
+
* Fixed a few warnings
|
6
73
|
|
7
74
|
## 2.5.0
|
8
75
|
|
9
|
-
* Ruby 2.4 support. Backwards compatible, but bumped minor version so projects can choose to lock at older version [#268](https://github.com/jch/html-pipeline/pull/268)
|
76
|
+
* Ruby 2.4 support. Backwards compatible, but bumped minor version so projects can choose to lock at older version [#268](https://github.com/jch/html-pipeline/pull/268)
|
10
77
|
|
11
78
|
## 2.4.2
|
12
79
|
|
13
|
-
* Make EmojiFilter generated img tag HTML attributes configurable [#258](https://github.com/jch/html-pipeline/pull/258)
|
80
|
+
* Make EmojiFilter generated img tag HTML attributes configurable [#258](https://github.com/jch/html-pipeline/pull/258)
|
14
81
|
|
15
82
|
## 2.4.1
|
16
83
|
|
17
|
-
* Regression in EmailReplyPipeline: unfiltered content is being omitted [#253](https://github.com/jch/html-pipeline/pull/253)
|
84
|
+
* Regression in EmailReplyPipeline: unfiltered content is being omitted [#253](https://github.com/jch/html-pipeline/pull/253)
|
18
85
|
|
19
86
|
## 2.4.0
|
20
87
|
|
21
|
-
* Optionally filter email addresses [#247](https://github.com/jch/html-pipeline/pull/247)
|
88
|
+
* Optionally filter email addresses [#247](https://github.com/jch/html-pipeline/pull/247)
|
22
89
|
|
23
90
|
## 2.3.0
|
24
91
|
|
25
|
-
* Add option to pass in an anchor icon, instead of using octicons [#244](https://github.com/jch/html-pipeline/pull/244)
|
92
|
+
* Add option to pass in an anchor icon, instead of using octicons [#244](https://github.com/jch/html-pipeline/pull/244)
|
26
93
|
|
27
94
|
## 2.2.4
|
28
95
|
|
29
|
-
* Use entire namespace so MissingDependencyError constant is resolved [#243](https://github.com/jch/html-pipeline/pull/243)
|
96
|
+
* Use entire namespace so MissingDependencyError constant is resolved [#243](https://github.com/jch/html-pipeline/pull/243)
|
30
97
|
|
31
98
|
## 2.2.3
|
32
99
|
|
33
|
-
* raise MissingDependencyError instead of aborting on missing dependency [#241](https://github.com/jch/html-pipeline/pull/241)
|
34
|
-
* Fix typo [#239](https://github.com/jch/html-pipeline/pull/239)
|
35
|
-
* Test against Ruby 2.3.0 on Travis CI [#238](https://github.com/jch/html-pipeline/pull/238)
|
36
|
-
* use travis containers [#237](https://github.com/jch/html-pipeline/pull/237)
|
100
|
+
* raise MissingDependencyError instead of aborting on missing dependency [#241](https://github.com/jch/html-pipeline/pull/241)
|
101
|
+
* Fix typo [#239](https://github.com/jch/html-pipeline/pull/239)
|
102
|
+
* Test against Ruby 2.3.0 on Travis CI [#238](https://github.com/jch/html-pipeline/pull/238)
|
103
|
+
* use travis containers [#237](https://github.com/jch/html-pipeline/pull/237)
|
37
104
|
|
38
105
|
## 2.2.2
|
39
106
|
|
40
|
-
* Fix for calling mention_link_filter with only one argument [#230](https://github.com/jch/html-pipeline/pull/230)
|
41
|
-
* Add html-pipeline-linkify_github to 3rd Party Extensions in README [#228](https://github.com/jch/html-pipeline/pull/228)
|
107
|
+
* Fix for calling mention_link_filter with only one argument [#230](https://github.com/jch/html-pipeline/pull/230)
|
108
|
+
* Add html-pipeline-linkify_github to 3rd Party Extensions in README [#228](https://github.com/jch/html-pipeline/pull/228)
|
42
109
|
|
43
110
|
## 2.2.1
|
44
111
|
|
45
|
-
* Soften Nokogiri dependency to versions ">= 1.4" [#208](https://github.com/jch/html-pipeline/pull/208)
|
112
|
+
* Soften Nokogiri dependency to versions ">= 1.4" [#208](https://github.com/jch/html-pipeline/pull/208)
|
46
113
|
|
47
114
|
## 2.2.0
|
48
115
|
|
49
|
-
* Only allow cite attribute on blockquote and restrict schemes [#223](https://github.com/jch/html-pipeline/pull/223)
|
116
|
+
* Only allow cite attribute on blockquote and restrict schemes [#223](https://github.com/jch/html-pipeline/pull/223)
|
50
117
|
|
51
118
|
## 2.1.0
|
52
119
|
|
53
|
-
* Whitelist schemes for longdesc [#221](https://github.com/jch/html-pipeline/pull/221)
|
54
|
-
* Extract emoji image tag generation to own method [#195](https://github.com/jch/html-pipeline/pull/195)
|
55
|
-
* Update README.md [#211](https://github.com/jch/html-pipeline/pull/211)
|
56
|
-
* Add ImageFilter for image url to img tag conversion [#207](https://github.com/jch/html-pipeline/pull/207)
|
120
|
+
* Whitelist schemes for longdesc [#221](https://github.com/jch/html-pipeline/pull/221)
|
121
|
+
* Extract emoji image tag generation to own method [#195](https://github.com/jch/html-pipeline/pull/195)
|
122
|
+
* Update README.md [#211](https://github.com/jch/html-pipeline/pull/211)
|
123
|
+
* Add ImageFilter for image url to img tag conversion [#207](https://github.com/jch/html-pipeline/pull/207)
|
57
124
|
|
58
125
|
## 2.0
|
59
126
|
|
60
127
|
**New**
|
61
128
|
|
62
|
-
* Implement new EmojiFilter context option: ignored_ancestor_tags to accept more ignored tags. [#170](https://github.com/jch/html-pipeline/pull/170) @JuanitoFatas
|
63
|
-
* Add GitHub flavor Markdown Task List extension [#162](https://github.com/jch/html-pipeline/pull/162) @simeonwillbanks
|
64
|
-
* @mention allow for custom regex to identify usernames. [#157](https://github.com/jch/html-pipeline/pull/157) @brittballard
|
65
|
-
* EmojiFilter now requires gemoji ~> 2. [#159](https://github.com/jch/html-pipeline/pull/159) @jch
|
129
|
+
* Implement new EmojiFilter context option: ignored_ancestor_tags to accept more ignored tags. [#170](https://github.com/jch/html-pipeline/pull/170) @JuanitoFatas
|
130
|
+
* Add GitHub flavor Markdown Task List extension [#162](https://github.com/jch/html-pipeline/pull/162) @simeonwillbanks
|
131
|
+
* @mention allow for custom regex to identify usernames. [#157](https://github.com/jch/html-pipeline/pull/157) @brittballard
|
132
|
+
* EmojiFilter now requires gemoji ~> 2. [#159](https://github.com/jch/html-pipeline/pull/159) @jch
|
66
133
|
|
67
134
|
**Changes**
|
68
135
|
|
69
|
-
* Restrict nokogiri to >= 1.4, <= 1.6.5 [#176](https://github.com/jch/html-pipeline/pull/176) @simeonwillbanks
|
70
|
-
* MentionFilter#link_to_mentioned_user: Replace String introspection with Regexp match [#172](https://github.com/jch/html-pipeline/pull/172) @simeonwillbanks
|
71
|
-
* Whitelist summary and details element. [#171](https://github.com/jch/html-pipeline/pull/171) @JuanitoFatas
|
72
|
-
* Support ~login for MentionFilter. [#167](https://github.com/jch/html-pipeline/pull/167) @JuanitoFatas
|
73
|
-
* Revert "Search for text nodes on DocumentFragments without root tags" [#158](https://github.com/jch/html-pipeline/pull/158) @jch
|
74
|
-
* Drop support for ruby ree, 1.9.2, 1.9.3 [#156](https://github.com/jch/html-pipeline/pull/156) @jch
|
75
|
-
* Skip EmojiFilter in `<tt>` tags [#147](https://github.com/jch/html-pipeline/pull/147) @moskvax
|
76
|
-
* Use Linguist lexers [#153](https://github.com/jch/html-pipeline/pull/153) @pchaigno
|
77
|
-
* Constrain Active Support >= 2, < 5 [#180](https://github.com/jch/html-pipeline/pull/180) @jch
|
136
|
+
* Restrict nokogiri to >= 1.4, <= 1.6.5 [#176](https://github.com/jch/html-pipeline/pull/176) @simeonwillbanks
|
137
|
+
* MentionFilter#link_to_mentioned_user: Replace String introspection with Regexp match [#172](https://github.com/jch/html-pipeline/pull/172) @simeonwillbanks
|
138
|
+
* Whitelist summary and details element. [#171](https://github.com/jch/html-pipeline/pull/171) @JuanitoFatas
|
139
|
+
* Support ~login for MentionFilter. [#167](https://github.com/jch/html-pipeline/pull/167) @JuanitoFatas
|
140
|
+
* Revert "Search for text nodes on DocumentFragments without root tags" [#158](https://github.com/jch/html-pipeline/pull/158) @jch
|
141
|
+
* Drop support for ruby ree, 1.9.2, 1.9.3 [#156](https://github.com/jch/html-pipeline/pull/156) @jch
|
142
|
+
* Skip EmojiFilter in `<tt>` tags [#147](https://github.com/jch/html-pipeline/pull/147) @moskvax
|
143
|
+
* Use Linguist lexers [#153](https://github.com/jch/html-pipeline/pull/153) @pchaigno
|
144
|
+
* Constrain Active Support >= 2, < 5 [#180](https://github.com/jch/html-pipeline/pull/180) @jch
|
78
145
|
|
79
146
|
## 1.11.0
|
80
147
|
|
@@ -11,10 +11,12 @@ module HTML
|
|
11
11
|
# Context options:
|
12
12
|
# :gfm => false Disable GFM line-end processing
|
13
13
|
# :commonmarker_extensions => [ :table, :strikethrough,
|
14
|
-
# :tagfilter, :autolink ]
|
14
|
+
# :tagfilter, :autolink ] Commonmarker extensions to include
|
15
15
|
#
|
16
16
|
# This filter does not write any additional information to the context hash.
|
17
17
|
class MarkdownFilter < TextFilter
|
18
|
+
DEFAULT_COMMONMARKER_EXTENSIONS = %i[table strikethrough tagfilter autolink].freeze
|
19
|
+
|
18
20
|
def initialize(text, context = nil, result = nil)
|
19
21
|
super text, context, result
|
20
22
|
@text = @text.delete "\r"
|
@@ -23,14 +25,28 @@ module HTML
|
|
23
25
|
# Convert Markdown to HTML using the best available implementation
|
24
26
|
# and convert into a DocumentFragment.
|
25
27
|
def call
|
26
|
-
options = [:GITHUB_PRE_LANG]
|
27
|
-
options << :HARDBREAKS if context[:gfm] != false
|
28
|
-
options << :UNSAFE if context[:unsafe]
|
29
28
|
extensions = context.fetch(
|
30
29
|
:commonmarker_extensions,
|
31
|
-
|
30
|
+
DEFAULT_COMMONMARKER_EXTENSIONS
|
32
31
|
)
|
33
|
-
html =
|
32
|
+
html = if (renderer = context[:commonmarker_renderer])
|
33
|
+
unless renderer < CommonMarker::HtmlRenderer
|
34
|
+
raise ArgumentError, "`commonmark_renderer` must be derived from `CommonMarker::HtmlRenderer`"
|
35
|
+
end
|
36
|
+
parse_options = :DEFAULT
|
37
|
+
parse_options = [:UNSAFE] if context[:unsafe]
|
38
|
+
|
39
|
+
render_options = [:GITHUB_PRE_LANG]
|
40
|
+
render_options << :HARDBREAKS if context[:gfm] != false
|
41
|
+
|
42
|
+
doc = CommonMarker.render_doc(@text, parse_options, extensions)
|
43
|
+
renderer.new(options: render_options, extensions: extensions).render(doc)
|
44
|
+
else
|
45
|
+
options = [:GITHUB_PRE_LANG]
|
46
|
+
options << :HARDBREAKS if context[:gfm] != false
|
47
|
+
options << :UNSAFE if context[:unsafe]
|
48
|
+
CommonMarker.render_html(@text, options, extensions)
|
49
|
+
end
|
34
50
|
html.rstrip!
|
35
51
|
html
|
36
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.12.
|
4
|
+
version: 2.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Tomayko
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-
|
13
|
+
date: 2019-11-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -106,8 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
|
110
|
-
rubygems_version: 2.7.6
|
109
|
+
rubygems_version: 3.0.6
|
111
110
|
signing_key:
|
112
111
|
specification_version: 4
|
113
112
|
summary: Helpers for processing content through a chain of filters
|