qiita-markdown 0.44.0 → 1.0.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/workflows/test.yml +2 -2
- data/.rubocop.yml +0 -4
- data/.rubocop_todo.yml +15 -239
- data/CHANGELOG.md +15 -0
- data/README.md +5 -3
- data/lib/qiita/markdown/filters/checkbox.rb +5 -1
- data/lib/qiita/markdown/filters/code_block.rb +13 -13
- data/lib/qiita/markdown/filters/custom_block.rb +8 -6
- data/lib/qiita/markdown/filters/external_link.rb +2 -0
- data/lib/qiita/markdown/filters/final_sanitizer.rb +126 -120
- data/lib/qiita/markdown/filters/footnote.rb +2 -0
- data/lib/qiita/markdown/filters/group_mention.rb +2 -2
- data/lib/qiita/markdown/filters/heading_anchor.rb +44 -0
- data/lib/qiita/markdown/filters/html_toc.rb +67 -0
- data/lib/qiita/markdown/filters/image_link.rb +6 -6
- data/lib/qiita/markdown/filters/inline_code_color.rb +8 -8
- data/lib/qiita/markdown/filters/mention.rb +11 -9
- data/lib/qiita/markdown/filters/qiita_marker.rb +55 -0
- data/lib/qiita/markdown/filters/simplify.rb +1 -0
- data/lib/qiita/markdown/filters/syntax_highlight.rb +4 -4
- data/lib/qiita/markdown/filters/truncate.rb +1 -3
- data/lib/qiita/markdown/filters/user_input_sanitizer.rb +34 -29
- data/lib/qiita/markdown/processor.rb +2 -1
- data/lib/qiita/markdown/summary_processor.rb +1 -1
- data/lib/qiita/markdown/transformers/filter_attributes.rb +1 -0
- data/lib/qiita/markdown/transformers/filter_iframe.rb +1 -2
- data/lib/qiita/markdown/transformers/filter_script.rb +1 -1
- data/lib/qiita/markdown/transformers/strip_invalid_node.rb +1 -3
- data/lib/qiita/markdown/version.rb +1 -1
- data/lib/qiita/markdown.rb +4 -5
- data/qiita-markdown.gemspec +7 -8
- data/spec/qiita/markdown/filters/checkbox_spec.rb +28 -0
- data/spec/qiita/markdown/filters/heading_anchor_spec.rb +73 -0
- data/spec/qiita/markdown/filters/html_toc_spec.rb +223 -0
- data/spec/qiita/markdown/filters/qiita_marker_spec.rb +60 -0
- data/spec/qiita/markdown/processor_spec.rb +64 -70
- data/spec/qiita/markdown/summary_processor_spec.rb +4 -4
- metadata +80 -102
- data/benchmark/heading_anchor_rendering.rb +0 -248
- data/benchmark/sample.md +0 -317
- data/lib/qiita/markdown/filters/greenmat.rb +0 -38
- data/lib/qiita/markdown/greenmat/heading_rendering.rb +0 -61
- data/lib/qiita/markdown/greenmat/html_renderer.rb +0 -60
- data/lib/qiita/markdown/greenmat/html_toc_renderer.rb +0 -78
- data/spec/qiita/markdown/filters/greenmat_spec.rb +0 -15
- data/spec/qiita/markdown/greenmat/html_toc_renderer_spec.rb +0 -156
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 196cc261921bae3253f06a912b56e96a5912ed4552ec6352415756bcca1d98ed
|
4
|
+
data.tar.gz: '018a907a21f827e68a814ce0d15ff96f3cdccb4e6e52411b7ff63399c5c55f4b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 267fcb94bfc63e83b1f42bb42d01f61744d3979be9a92b1df767fc3c7ff3beed8b6299958677835f113abed3c6990bced41618c916650f34c31d5d125e16750d
|
7
|
+
data.tar.gz: 4a072057a0d55751e5b9e52357641930b1fd0301fe779720820705d453aaaae4fe5cd20bfec3354bb47eb8981ff3742b8a200b8bc647c3b42c5b99e27930458c
|
data/.github/workflows/test.yml
CHANGED
@@ -20,7 +20,7 @@ jobs:
|
|
20
20
|
- uses: actions/checkout@v3
|
21
21
|
- uses: ruby/setup-ruby@v1
|
22
22
|
with:
|
23
|
-
ruby-version: '2.
|
23
|
+
ruby-version: '2.7'
|
24
24
|
bundler-cache: true
|
25
25
|
- name: Test & publish code coverage
|
26
26
|
if: "${{ env.CC_TEST_REPORTER_ID != '' }}"
|
@@ -37,7 +37,7 @@ jobs:
|
|
37
37
|
fail-fast: false
|
38
38
|
matrix:
|
39
39
|
os: ['ubuntu-18.04', 'ubuntu-latest', 'macos-latest']
|
40
|
-
ruby: ['2.
|
40
|
+
ruby: ['2.7', '3.0', '3.1']
|
41
41
|
experimental: [false]
|
42
42
|
include:
|
43
43
|
- os: 'ubuntu-latest'
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,27 +1,11 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --exclude-limit 99999`
|
3
|
-
# on 2022-
|
3
|
+
# on 2022-11-15 12:42:36 UTC using RuboCop version 1.39.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count: 3
|
10
|
-
# This cop supports safe auto-correction (--auto-correct).
|
11
|
-
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
12
|
-
# Include: **/*.gemspec
|
13
|
-
Gemspec/OrderedDependencies:
|
14
|
-
Exclude:
|
15
|
-
- 'qiita-markdown.gemspec'
|
16
|
-
|
17
|
-
# Offense count: 1
|
18
|
-
# This cop supports safe auto-correction (--auto-correct).
|
19
|
-
# Configuration parameters: Include.
|
20
|
-
# Include: **/*.gemspec
|
21
|
-
Gemspec/RequireMFA:
|
22
|
-
Exclude:
|
23
|
-
- 'qiita-markdown.gemspec'
|
24
|
-
|
25
9
|
# Offense count: 1
|
26
10
|
# Configuration parameters: Include.
|
27
11
|
# Include: **/*.gemspec
|
@@ -29,66 +13,16 @@ Gemspec/RequiredRubyVersion:
|
|
29
13
|
Exclude:
|
30
14
|
- 'qiita-markdown.gemspec'
|
31
15
|
|
32
|
-
# Offense count:
|
33
|
-
#
|
34
|
-
Layout/ClosingHeredocIndentation:
|
35
|
-
Exclude:
|
36
|
-
- 'spec/qiita/markdown/processor_spec.rb'
|
37
|
-
|
38
|
-
# Offense count: 9
|
39
|
-
# This cop supports safe auto-correction (--auto-correct).
|
40
|
-
Layout/EmptyLineAfterGuardClause:
|
41
|
-
Exclude:
|
42
|
-
- 'lib/qiita/markdown/filters/custom_block.rb'
|
43
|
-
- 'lib/qiita/markdown/filters/external_link.rb'
|
44
|
-
- 'lib/qiita/markdown/filters/footnote.rb'
|
45
|
-
- 'lib/qiita/markdown/filters/mention.rb'
|
46
|
-
- 'lib/qiita/markdown/filters/simplify.rb'
|
47
|
-
- 'lib/qiita/markdown/transformers/filter_attributes.rb'
|
48
|
-
|
49
|
-
# Offense count: 22
|
50
|
-
# This cop supports safe auto-correction (--auto-correct).
|
51
|
-
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
52
|
-
# SupportedHashRocketStyles: key, separator, table
|
53
|
-
# SupportedColonStyles: key, separator, table
|
54
|
-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
55
|
-
Layout/HashAlignment:
|
56
|
-
Exclude:
|
57
|
-
- 'lib/qiita/markdown/filters/user_input_sanitizer.rb'
|
58
|
-
|
59
|
-
# Offense count: 1
|
60
|
-
# This cop supports safe auto-correction (--auto-correct).
|
61
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
|
62
|
-
# SupportedStyles: space, no_space, compact
|
63
|
-
# SupportedStylesForEmptyBrackets: space, no_space
|
64
|
-
Layout/SpaceInsideArrayLiteralBrackets:
|
65
|
-
Exclude:
|
66
|
-
- 'lib/qiita/markdown/transformers/filter_iframe.rb'
|
67
|
-
|
68
|
-
# Offense count: 2
|
69
|
-
# This cop supports safe auto-correction (--auto-correct).
|
70
|
-
Lint/AmbiguousOperatorPrecedence:
|
71
|
-
Exclude:
|
72
|
-
- 'lib/qiita/markdown/filters/mention.rb'
|
73
|
-
|
74
|
-
# Offense count: 5
|
75
|
-
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
16
|
+
# Offense count: 8
|
17
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
76
18
|
Metrics/AbcSize:
|
77
|
-
Max:
|
19
|
+
Max: 26
|
78
20
|
|
79
21
|
# Offense count: 10
|
80
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
22
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
81
23
|
Metrics/MethodLength:
|
82
24
|
Max: 20
|
83
25
|
|
84
|
-
# Offense count: 2
|
85
|
-
# This cop supports safe auto-correction (--auto-correct).
|
86
|
-
# Configuration parameters: EnforcedStyle, BlockForwardingName.
|
87
|
-
# SupportedStyles: anonymous, explicit
|
88
|
-
Naming/BlockForwarding:
|
89
|
-
Exclude:
|
90
|
-
- 'lib/qiita/markdown/filters/truncate.rb'
|
91
|
-
|
92
26
|
# Offense count: 1
|
93
27
|
Naming/ConstantName:
|
94
28
|
Exclude:
|
@@ -102,53 +36,28 @@ Naming/FileName:
|
|
102
36
|
Exclude:
|
103
37
|
- 'lib/qiita-markdown.rb'
|
104
38
|
|
105
|
-
# Offense count:
|
39
|
+
# Offense count: 21
|
106
40
|
# Configuration parameters: ForbiddenDelimiters.
|
107
41
|
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
108
42
|
Naming/HeredocDelimiterNaming:
|
109
43
|
Exclude:
|
110
|
-
- 'spec/qiita/markdown/greenmat/html_toc_renderer_spec.rb'
|
111
44
|
- 'spec/qiita/markdown/summary_processor_spec.rb'
|
112
45
|
|
113
|
-
# Offense count: 3
|
114
|
-
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
|
115
|
-
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
|
116
|
-
Naming/MemoizedInstanceVariableName:
|
117
|
-
Exclude:
|
118
|
-
- 'benchmark/heading_anchor_rendering.rb'
|
119
|
-
- 'lib/qiita/markdown/filters/greenmat.rb'
|
120
|
-
- 'lib/qiita/markdown/greenmat/heading_rendering.rb'
|
121
|
-
|
122
46
|
# Offense count: 1
|
123
47
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
124
|
-
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
|
48
|
+
# AllowedNames: as, at, by, db, id, if, in, io, ip, of, on, os, pp, to
|
125
49
|
Naming/MethodParameterName:
|
126
50
|
Exclude:
|
127
51
|
- 'lib/qiita/markdown/filters/footnote.rb'
|
128
52
|
|
129
|
-
# Offense count:
|
130
|
-
# This cop supports
|
131
|
-
# Configuration parameters: EnforcedStyle.
|
132
|
-
# SupportedStyles: percent_q, bare_percent
|
133
|
-
Style/BarePercentLiterals:
|
134
|
-
Exclude:
|
135
|
-
- 'lib/qiita/markdown/filters/syntax_highlight.rb'
|
136
|
-
|
137
|
-
# Offense count: 1
|
138
|
-
# This cop supports safe auto-correction (--auto-correct).
|
139
|
-
Style/ExpandPathArguments:
|
140
|
-
Exclude:
|
141
|
-
- 'qiita-markdown.gemspec'
|
142
|
-
|
143
|
-
# Offense count: 47
|
144
|
-
# This cop supports safe auto-correction (--auto-correct).
|
53
|
+
# Offense count: 37
|
54
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
145
55
|
# Configuration parameters: EnforcedStyle.
|
146
56
|
# SupportedStyles: always, always_true, never
|
147
57
|
Style/FrozenStringLiteralComment:
|
148
58
|
Exclude:
|
149
59
|
- 'Gemfile'
|
150
60
|
- 'Rakefile'
|
151
|
-
- 'benchmark/heading_anchor_rendering.rb'
|
152
61
|
- 'lib/qiita-markdown.rb'
|
153
62
|
- 'lib/qiita/markdown.rb'
|
154
63
|
- 'lib/qiita/markdown/base_processor.rb'
|
@@ -161,12 +70,9 @@ Style/FrozenStringLiteralComment:
|
|
161
70
|
- 'lib/qiita/markdown/embed/youtube.rb'
|
162
71
|
- 'lib/qiita/markdown/filters/checkbox.rb'
|
163
72
|
- 'lib/qiita/markdown/filters/code_block.rb'
|
164
|
-
- 'lib/qiita/markdown/filters/custom_block.rb'
|
165
73
|
- 'lib/qiita/markdown/filters/emoji.rb'
|
166
74
|
- 'lib/qiita/markdown/filters/external_link.rb'
|
167
|
-
- 'lib/qiita/markdown/filters/final_sanitizer.rb'
|
168
75
|
- 'lib/qiita/markdown/filters/footnote.rb'
|
169
|
-
- 'lib/qiita/markdown/filters/greenmat.rb'
|
170
76
|
- 'lib/qiita/markdown/filters/group_mention.rb'
|
171
77
|
- 'lib/qiita/markdown/filters/image_link.rb'
|
172
78
|
- 'lib/qiita/markdown/filters/inline_code_color.rb'
|
@@ -175,10 +81,6 @@ Style/FrozenStringLiteralComment:
|
|
175
81
|
- 'lib/qiita/markdown/filters/syntax_highlight.rb'
|
176
82
|
- 'lib/qiita/markdown/filters/toc.rb'
|
177
83
|
- 'lib/qiita/markdown/filters/truncate.rb'
|
178
|
-
- 'lib/qiita/markdown/filters/user_input_sanitizer.rb'
|
179
|
-
- 'lib/qiita/markdown/greenmat/heading_rendering.rb'
|
180
|
-
- 'lib/qiita/markdown/greenmat/html_renderer.rb'
|
181
|
-
- 'lib/qiita/markdown/greenmat/html_toc_renderer.rb'
|
182
84
|
- 'lib/qiita/markdown/processor.rb'
|
183
85
|
- 'lib/qiita/markdown/summary_processor.rb'
|
184
86
|
- 'lib/qiita/markdown/transformers/filter_attributes.rb'
|
@@ -187,166 +89,40 @@ Style/FrozenStringLiteralComment:
|
|
187
89
|
- 'lib/qiita/markdown/transformers/strip_invalid_node.rb'
|
188
90
|
- 'lib/qiita/markdown/version.rb'
|
189
91
|
- 'qiita-markdown.gemspec'
|
190
|
-
- 'spec/qiita/markdown/filters/greenmat_spec.rb'
|
191
92
|
- 'spec/qiita/markdown/filters/inline_code_color_spec.rb'
|
192
|
-
- 'spec/qiita/markdown/greenmat/html_toc_renderer_spec.rb'
|
193
93
|
- 'spec/qiita/markdown/processor_spec.rb'
|
194
94
|
- 'spec/qiita/markdown/summary_processor_spec.rb'
|
195
95
|
- 'spec/spec_helper.rb'
|
196
96
|
|
197
|
-
# Offense count: 6
|
198
|
-
# This cop supports safe auto-correction (--auto-correct).
|
199
|
-
# Configuration parameters: EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
200
|
-
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
201
|
-
# SupportedShorthandSyntax: always, never, either
|
202
|
-
Style/HashSyntax:
|
203
|
-
EnforcedStyle: ruby19
|
204
|
-
EnforcedShorthandSyntax: never
|
205
|
-
|
206
|
-
# Offense count: 2
|
207
|
-
# This cop supports safe auto-correction (--auto-correct).
|
208
|
-
Style/IfUnlessModifier:
|
209
|
-
Exclude:
|
210
|
-
- 'lib/qiita/markdown/filters/truncate.rb'
|
211
|
-
- 'lib/qiita/markdown/transformers/strip_invalid_node.rb'
|
212
|
-
|
213
97
|
# Offense count: 17
|
214
|
-
# This cop supports
|
98
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
215
99
|
# Configuration parameters: EnforcedStyle.
|
216
100
|
# SupportedStyles: literals, strict
|
217
101
|
Style/MutableConstant:
|
218
102
|
Exclude:
|
219
103
|
- 'lib/qiita/markdown/embed/code_pen.rb'
|
220
|
-
- 'lib/qiita/markdown/filters/group_mention.rb'
|
221
|
-
- 'lib/qiita/markdown/filters/inline_code_color.rb'
|
222
|
-
- 'lib/qiita/markdown/filters/mention.rb'
|
223
104
|
- 'lib/qiita/markdown/embed/tweet.rb'
|
224
105
|
- 'lib/qiita/markdown/filters/checkbox.rb'
|
225
106
|
- 'lib/qiita/markdown/filters/code_block.rb'
|
107
|
+
- 'lib/qiita/markdown/filters/group_mention.rb'
|
108
|
+
- 'lib/qiita/markdown/filters/inline_code_color.rb'
|
109
|
+
- 'lib/qiita/markdown/filters/mention.rb'
|
226
110
|
- 'lib/qiita/markdown/filters/simplify.rb'
|
227
111
|
- 'lib/qiita/markdown/filters/syntax_highlight.rb'
|
228
112
|
- 'lib/qiita/markdown/version.rb'
|
229
113
|
|
230
|
-
# Offense count: 2
|
231
|
-
# This cop supports safe auto-correction (--auto-correct).
|
232
|
-
# Configuration parameters: EnforcedStyle, MinBodyLength.
|
233
|
-
# SupportedStyles: skip_modifier_ifs, always
|
234
|
-
Style/Next:
|
235
|
-
Exclude:
|
236
|
-
- 'lib/qiita/markdown/filters/code_block.rb'
|
237
|
-
- 'lib/qiita/markdown/filters/image_link.rb'
|
238
|
-
|
239
|
-
# Offense count: 5
|
240
|
-
# This cop supports unsafe auto-correction (--auto-correct-all).
|
241
|
-
# Configuration parameters: EnforcedStyle, IgnoredMethods.
|
242
|
-
# SupportedStyles: predicate, comparison
|
243
|
-
Style/NumericPredicate:
|
244
|
-
Exclude:
|
245
|
-
- 'spec/**/*'
|
246
|
-
- 'benchmark/heading_anchor_rendering.rb'
|
247
|
-
- 'lib/qiita/markdown/greenmat/heading_rendering.rb'
|
248
|
-
- 'lib/qiita/markdown/greenmat/html_toc_renderer.rb'
|
249
|
-
|
250
|
-
# Offense count: 1
|
251
|
-
# Configuration parameters: AllowedMethods.
|
252
|
-
# AllowedMethods: respond_to_missing?
|
253
|
-
Style/OptionalBooleanParameter:
|
254
|
-
Exclude:
|
255
|
-
- 'lib/qiita/markdown/greenmat/heading_rendering.rb'
|
256
|
-
|
257
|
-
# Offense count: 1
|
258
|
-
# This cop supports safe auto-correction (--auto-correct).
|
259
|
-
Style/OrAssignment:
|
260
|
-
Exclude:
|
261
|
-
- 'lib/qiita/markdown/greenmat/html_toc_renderer.rb'
|
262
|
-
|
263
|
-
# Offense count: 9
|
264
|
-
# This cop supports safe auto-correction (--auto-correct).
|
265
|
-
# Configuration parameters: PreferredDelimiters.
|
266
|
-
Style/PercentLiteralDelimiters:
|
267
|
-
Exclude:
|
268
|
-
- 'benchmark/heading_anchor_rendering.rb'
|
269
|
-
- 'lib/qiita/markdown/filters/mention.rb'
|
270
|
-
- 'lib/qiita/markdown/filters/syntax_highlight.rb'
|
271
|
-
- 'spec/qiita/markdown/processor_spec.rb'
|
272
|
-
- 'spec/qiita/markdown/summary_processor_spec.rb'
|
273
|
-
|
274
114
|
# Offense count: 1
|
275
|
-
# This cop supports
|
276
|
-
Style/PerlBackrefs:
|
277
|
-
Exclude:
|
278
|
-
- 'lib/qiita/markdown/filters/mention.rb'
|
279
|
-
|
280
|
-
# Offense count: 1
|
281
|
-
# This cop supports unsafe auto-correction (--auto-correct-all).
|
115
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
282
116
|
# Configuration parameters: Methods.
|
283
117
|
Style/RedundantArgument:
|
284
118
|
Exclude:
|
285
119
|
- 'lib/qiita/markdown/filters/custom_block.rb'
|
286
120
|
|
287
|
-
# Offense count: 1
|
288
|
-
# This cop supports safe auto-correction (--auto-correct).
|
289
|
-
Style/RedundantRegexpCharacterClass:
|
290
|
-
Exclude:
|
291
|
-
- 'lib/qiita/markdown/filters/mention.rb'
|
292
|
-
|
293
|
-
# Offense count: 9
|
294
|
-
# This cop supports safe auto-correction (--auto-correct).
|
295
|
-
Style/RedundantRegexpEscape:
|
296
|
-
Exclude:
|
297
|
-
- 'lib/qiita/markdown/filters/group_mention.rb'
|
298
|
-
- 'lib/qiita/markdown/filters/inline_code_color.rb'
|
299
|
-
|
300
|
-
# Offense count: 4
|
301
|
-
# This cop supports safe auto-correction (--auto-correct).
|
302
|
-
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
303
|
-
# SupportedStyles: slashes, percent_r, mixed
|
304
|
-
Style/RegexpLiteral:
|
305
|
-
Exclude:
|
306
|
-
- 'lib/qiita/markdown/filters/inline_code_color.rb'
|
307
|
-
- 'lib/qiita/markdown/filters/mention.rb'
|
308
|
-
|
309
|
-
# Offense count: 1
|
310
|
-
# This cop supports safe auto-correction (--auto-correct).
|
311
|
-
# Configuration parameters: EnforcedStyle.
|
312
|
-
# SupportedStyles: implicit, explicit
|
313
|
-
Style/RescueStandardError:
|
314
|
-
Exclude:
|
315
|
-
- 'lib/qiita/markdown/filters/syntax_highlight.rb'
|
316
|
-
|
317
121
|
# Offense count: 2
|
318
|
-
# This cop supports
|
122
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
319
123
|
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
320
124
|
# AllowedMethods: present?, blank?, presence, try, try!
|
321
125
|
Style/SafeNavigation:
|
322
126
|
Exclude:
|
323
127
|
- 'lib/qiita/markdown/filters/custom_block.rb'
|
324
128
|
- 'lib/qiita/markdown/filters/toc.rb'
|
325
|
-
|
326
|
-
# Offense count: 3
|
327
|
-
# This cop supports safe auto-correction (--auto-correct).
|
328
|
-
# Configuration parameters: EnforcedStyle.
|
329
|
-
# SupportedStyles: only_raise, only_fail, semantic
|
330
|
-
Style/SignalException:
|
331
|
-
Exclude:
|
332
|
-
- 'lib/qiita/markdown/greenmat/heading_rendering.rb'
|
333
|
-
- 'spec/qiita/markdown/summary_processor_spec.rb'
|
334
|
-
|
335
|
-
# Offense count: 13
|
336
|
-
# This cop supports safe auto-correction (--auto-correct).
|
337
|
-
# Configuration parameters: EnforcedStyleForMultiline.
|
338
|
-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
339
|
-
Style/TrailingCommaInArguments:
|
340
|
-
Exclude:
|
341
|
-
- 'lib/qiita/markdown/filters/mention.rb'
|
342
|
-
- 'spec/qiita/markdown/processor_spec.rb'
|
343
|
-
|
344
|
-
# Offense count: 12
|
345
|
-
# This cop supports safe auto-correction (--auto-correct).
|
346
|
-
# Configuration parameters: EnforcedStyle, MinSize, WordRegex.
|
347
|
-
# SupportedStyles: percent, brackets
|
348
|
-
Style/WordArray:
|
349
|
-
Exclude:
|
350
|
-
- 'lib/qiita/markdown/filters/final_sanitizer.rb'
|
351
|
-
- 'lib/qiita/markdown/transformers/filter_script.rb'
|
352
|
-
- 'spec/qiita/markdown/processor_spec.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
+
## 1.0.0
|
4
|
+
|
5
|
+
- Drop Ruby 2.6 support
|
6
|
+
- Change markdown parser from Greenmat to Qiita Marker
|
7
|
+
- Fix bug on rendering loose tasklist
|
8
|
+
|
9
|
+
### Braking change on HTML output
|
10
|
+
|
11
|
+
Some notations will be changed between Greenmat and Qiita Marker and rendering results may change. More details, see [#130](https://github.com/increments/qiita-markdown/issues/130).
|
12
|
+
|
13
|
+
## 0.44.1
|
14
|
+
|
15
|
+
- Rename package name from `Qiita::Markdown` to `Qiita Markdown` in README
|
16
|
+
- Bump rubocop from 1.27.0 to 1.39.0 and apply rubocop auto correct
|
17
|
+
|
3
18
|
## 0.44.0
|
4
19
|
|
5
20
|
- Support Figma embedding scripts
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Qiita
|
1
|
+
# Qiita Markdown
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/qiita-markdown)
|
4
4
|
[](https://travis-ci.org/increments/qiita-markdown)
|
@@ -16,6 +16,7 @@ Qiita-specified markdown processor.
|
|
16
16
|
- Syntax highlighting
|
17
17
|
- Mention
|
18
18
|
- Footnotes
|
19
|
+
- Note notation's custom block
|
19
20
|
|
20
21
|
## Basic Usage
|
21
22
|
|
@@ -42,7 +43,7 @@ processor.call(markdown)
|
|
42
43
|
|
43
44
|
### Filters
|
44
45
|
|
45
|
-
Qiita
|
46
|
+
Qiita Markdown is built on [jch/html-pipeline](https://github.com/jch/html-pipeline).
|
46
47
|
Add your favorite html-pipeline-compatible filters.
|
47
48
|
|
48
49
|
```ruby
|
@@ -68,7 +69,8 @@ processor.call(text)
|
|
68
69
|
:inline_code_color_class_name - Class name for inline code color. (String)
|
69
70
|
:language_aliases - Alias table for some language names. (Hash)
|
70
71
|
:markdown - A hash for enabling / disabling optional Markdown syntax. (Hash)
|
71
|
-
Currently
|
72
|
+
Currently :footnotes (default: true) and :sourcepos (defalut: false) are supported.
|
73
|
+
For more information on these options, please see [increments/qiita_marker](https://github.com/increments/qiita_marker).
|
72
74
|
:rule - Sanitization rule table. (Hash)
|
73
75
|
:script - A flag to allow to embed script element. (Boolean)
|
74
76
|
```
|
@@ -55,7 +55,11 @@ module Qiita
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def first_text_node
|
58
|
-
|
58
|
+
is_loose_list_node = @node.children.first&.text == "\n" && @node.children[1]&.name == "p"
|
59
|
+
|
60
|
+
if is_loose_list_node
|
61
|
+
@node.children[1].children.first
|
62
|
+
elsif @node.children.first && @node.children.first.name == "p"
|
59
63
|
@node.children.first.children.first
|
60
64
|
else
|
61
65
|
@node.children.first
|
@@ -16,19 +16,19 @@ module Qiita
|
|
16
16
|
def call
|
17
17
|
result[:codes] ||= []
|
18
18
|
doc.search("pre").each do |pre|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
19
|
+
next unless (code = pre.at("code"))
|
20
|
+
|
21
|
+
metadata = Metadata.new(code["data-metadata"])
|
22
|
+
filename = metadata.filename
|
23
|
+
language = metadata.language
|
24
|
+
language = language_aliases[language] || language
|
25
|
+
pre["filename"] = filename if filename
|
26
|
+
pre["lang"] = language if language
|
27
|
+
result[:codes] << {
|
28
|
+
code: pre.text,
|
29
|
+
filename: filename,
|
30
|
+
language: language,
|
31
|
+
}
|
32
32
|
end
|
33
33
|
doc
|
34
34
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Qiita
|
2
4
|
module Markdown
|
3
5
|
module Filters
|
@@ -8,6 +10,7 @@ module Qiita
|
|
8
10
|
doc.search('div[data-type="customblock"]').each do |div|
|
9
11
|
metadata = Metadata.new(div["data-metadata"])
|
10
12
|
next unless ALLOWED_TYPES.include?(metadata.type)
|
13
|
+
|
11
14
|
klass = Object.const_get("#{self.class}::#{metadata.type.capitalize}")
|
12
15
|
klass.new(div, metadata.subtype).convert
|
13
16
|
end
|
@@ -30,7 +33,7 @@ module Qiita
|
|
30
33
|
attr_reader :node, :type
|
31
34
|
|
32
35
|
ALLOWED_TYPES = %w[info warn alert].freeze
|
33
|
-
DEFAULT_TYPE = "info"
|
36
|
+
DEFAULT_TYPE = "info"
|
34
37
|
|
35
38
|
# @param node [Nokogiri::XML::Node]
|
36
39
|
# @param type [String, nil]
|
@@ -40,17 +43,16 @@ module Qiita
|
|
40
43
|
end
|
41
44
|
|
42
45
|
def convert
|
43
|
-
|
46
|
+
children = node.children
|
47
|
+
children.each(&:unlink)
|
48
|
+
node.add_child("<div></div>")
|
49
|
+
node.children.first.children = children
|
44
50
|
node["class"] = "note #{type}"
|
45
51
|
node.children.first.add_previous_sibling(icon) if icon
|
46
52
|
end
|
47
53
|
|
48
54
|
private
|
49
55
|
|
50
|
-
def message
|
51
|
-
"<p>#{node.text}</p>"
|
52
|
-
end
|
53
|
-
|
54
56
|
def icon
|
55
57
|
{
|
56
58
|
info: %(<span class="fa fa-fw fa-check-circle"></span>),
|
@@ -7,9 +7,11 @@ module Qiita
|
|
7
7
|
def call
|
8
8
|
doc.search("a").each do |anchor|
|
9
9
|
next unless anchor["href"]
|
10
|
+
|
10
11
|
href = anchor["href"].strip
|
11
12
|
href_host = host_of(href)
|
12
13
|
next unless href_host
|
14
|
+
|
13
15
|
if href_host != hostname
|
14
16
|
anchor["rel"] = "nofollow noopener"
|
15
17
|
anchor["target"] = "_blank"
|