qiita-markdown 0.44.0 → 0.44.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +14 -200
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/benchmark/heading_anchor_rendering.rb +1 -1
- data/lib/qiita/markdown/filters/code_block.rb +13 -13
- data/lib/qiita/markdown/filters/custom_block.rb +1 -0
- data/lib/qiita/markdown/filters/external_link.rb +2 -0
- data/lib/qiita/markdown/filters/final_sanitizer.rb +118 -118
- data/lib/qiita/markdown/filters/footnote.rb +2 -0
- data/lib/qiita/markdown/filters/group_mention.rb +2 -2
- 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/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 +22 -22
- data/lib/qiita/markdown/greenmat/heading_rendering.rb +2 -2
- data/lib/qiita/markdown/greenmat/html_toc_renderer.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/qiita-markdown.gemspec +6 -6
- data/spec/qiita/markdown/processor_spec.rb +16 -16
- data/spec/qiita/markdown/summary_processor_spec.rb +2 -2
- metadata +90 -96
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15a4f04515ad1a13dca22d1cdb61272ddb7fca2066dbc5bc82b7ccfa3db06b74
|
4
|
+
data.tar.gz: 4fd57bd43763ee38486898592e63ddd2c945f54450557c08a4d66ea95b2a00ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e648c8b60f7457028a3aaa89c891815fa5b283f553a02c1f6e516d658de480b2626508039fc41247a86b3d8ea931366a108f6bd8a119983906622596a5cb129b
|
7
|
+
data.tar.gz: 9f291ae053a36028df40a665d83a7e3acf1a82d5496c2cb1ead5a54e9369b71d2a43276d7ac5ccd6449e5e52bd9b29df13e3da1371d9531da53ba042c2d66ad4
|
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-14 07:37:46 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: 1
|
33
|
-
# This cop supports safe auto-correction (--auto-correct).
|
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
16
|
# Offense count: 5
|
75
|
-
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
17
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
76
18
|
Metrics/AbcSize:
|
77
19
|
Max: 22
|
78
20
|
|
79
|
-
# Offense count:
|
80
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
21
|
+
# Offense count: 9
|
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:
|
@@ -121,27 +55,13 @@ Naming/MemoizedInstanceVariableName:
|
|
121
55
|
|
122
56
|
# Offense count: 1
|
123
57
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
124
|
-
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
|
58
|
+
# AllowedNames: as, at, by, db, id, if, in, io, ip, of, on, os, pp, to
|
125
59
|
Naming/MethodParameterName:
|
126
60
|
Exclude:
|
127
61
|
- 'lib/qiita/markdown/filters/footnote.rb'
|
128
62
|
|
129
|
-
# Offense count: 3
|
130
|
-
# This cop supports safe auto-correction (--auto-correct).
|
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
63
|
# Offense count: 47
|
144
|
-
# This cop supports
|
64
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
145
65
|
# Configuration parameters: EnforcedStyle.
|
146
66
|
# SupportedStyles: always, always_true, never
|
147
67
|
Style/FrozenStringLiteralComment:
|
@@ -194,51 +114,26 @@ Style/FrozenStringLiteralComment:
|
|
194
114
|
- 'spec/qiita/markdown/summary_processor_spec.rb'
|
195
115
|
- 'spec/spec_helper.rb'
|
196
116
|
|
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
117
|
# Offense count: 17
|
214
|
-
# This cop supports
|
118
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
215
119
|
# Configuration parameters: EnforcedStyle.
|
216
120
|
# SupportedStyles: literals, strict
|
217
121
|
Style/MutableConstant:
|
218
122
|
Exclude:
|
219
123
|
- '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
124
|
- 'lib/qiita/markdown/embed/tweet.rb'
|
224
125
|
- 'lib/qiita/markdown/filters/checkbox.rb'
|
225
126
|
- 'lib/qiita/markdown/filters/code_block.rb'
|
127
|
+
- 'lib/qiita/markdown/filters/group_mention.rb'
|
128
|
+
- 'lib/qiita/markdown/filters/inline_code_color.rb'
|
129
|
+
- 'lib/qiita/markdown/filters/mention.rb'
|
226
130
|
- 'lib/qiita/markdown/filters/simplify.rb'
|
227
131
|
- 'lib/qiita/markdown/filters/syntax_highlight.rb'
|
228
132
|
- 'lib/qiita/markdown/version.rb'
|
229
133
|
|
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
134
|
# Offense count: 5
|
240
|
-
# This cop supports unsafe
|
241
|
-
# Configuration parameters: EnforcedStyle, IgnoredMethods.
|
135
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
136
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
242
137
|
# SupportedStyles: predicate, comparison
|
243
138
|
Style/NumericPredicate:
|
244
139
|
Exclude:
|
@@ -255,98 +150,17 @@ Style/OptionalBooleanParameter:
|
|
255
150
|
- 'lib/qiita/markdown/greenmat/heading_rendering.rb'
|
256
151
|
|
257
152
|
# Offense count: 1
|
258
|
-
# This cop supports
|
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
|
-
# Offense count: 1
|
275
|
-
# This cop supports safe auto-correction (--auto-correct).
|
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).
|
153
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
282
154
|
# Configuration parameters: Methods.
|
283
155
|
Style/RedundantArgument:
|
284
156
|
Exclude:
|
285
157
|
- 'lib/qiita/markdown/filters/custom_block.rb'
|
286
158
|
|
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
159
|
# Offense count: 2
|
318
|
-
# This cop supports
|
160
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
319
161
|
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
320
162
|
# AllowedMethods: present?, blank?, presence, try, try!
|
321
163
|
Style/SafeNavigation:
|
322
164
|
Exclude:
|
323
165
|
- 'lib/qiita/markdown/filters/custom_block.rb'
|
324
166
|
- '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
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Qiita
|
1
|
+
# Qiita Markdown
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/qiita-markdown.svg)](https://badge.fury.io/rb/qiita-markdown)
|
4
4
|
[![Build Status](https://travis-ci.org/increments/qiita-markdown.svg)](https://travis-ci.org/increments/qiita-markdown)
|
@@ -42,7 +42,7 @@ processor.call(markdown)
|
|
42
42
|
|
43
43
|
### Filters
|
44
44
|
|
45
|
-
Qiita
|
45
|
+
Qiita Markdown is built on [jch/html-pipeline](https://github.com/jch/html-pipeline).
|
46
46
|
Add your favorite html-pipeline-compatible filters.
|
47
47
|
|
48
48
|
```ruby
|
@@ -61,7 +61,7 @@ module PostProcess
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def anchor_element
|
64
|
-
%
|
64
|
+
%(<span id="#{suffixed_id}" class="fragment"></span><a href="##{suffixed_id}"><i class="fa fa-link"></i></a>)
|
65
65
|
end
|
66
66
|
|
67
67
|
def content
|
@@ -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
|
@@ -8,6 +8,7 @@ module Qiita
|
|
8
8
|
doc.search('div[data-type="customblock"]').each do |div|
|
9
9
|
metadata = Metadata.new(div["data-metadata"])
|
10
10
|
next unless ALLOWED_TYPES.include?(metadata.type)
|
11
|
+
|
11
12
|
klass = Object.const_get("#{self.class}::#{metadata.type.capitalize}")
|
12
13
|
klass.new(div, metadata.subtype).convert
|
13
14
|
end
|
@@ -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"
|
@@ -12,41 +12,41 @@ module Qiita
|
|
12
12
|
class FinalSanitizer < HTML::Pipeline::Filter
|
13
13
|
RULE = {
|
14
14
|
attributes: {
|
15
|
-
"a" => [
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
"a" => %w[
|
16
|
+
data-hovercard-target-name
|
17
|
+
data-hovercard-target-type
|
18
|
+
href
|
19
|
+
rel
|
20
20
|
],
|
21
21
|
"blockquote" => Embed::Tweet::ATTRIBUTES,
|
22
|
-
"iframe" => [
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
"iframe" => %w[
|
23
|
+
allowfullscreen
|
24
|
+
frameborder
|
25
|
+
height
|
26
|
+
marginheight
|
27
|
+
marginwidth
|
28
|
+
scrolling
|
29
|
+
src
|
30
|
+
style
|
31
|
+
width
|
32
32
|
],
|
33
33
|
"img" => [
|
34
34
|
"src",
|
35
35
|
],
|
36
|
-
"input" => [
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
"input" => %w[
|
37
|
+
checked
|
38
|
+
disabled
|
39
|
+
type
|
40
40
|
],
|
41
|
-
"div" => [
|
42
|
-
|
43
|
-
|
41
|
+
"div" => %w[
|
42
|
+
itemscope
|
43
|
+
itemtype
|
44
44
|
],
|
45
45
|
"p" => Embed::CodePen::ATTRIBUTES,
|
46
|
-
"script" => [
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
"script" => %w[
|
47
|
+
async
|
48
|
+
src
|
49
|
+
type
|
50
50
|
].concat(
|
51
51
|
Embed::SpeekerDeck::ATTRIBUTES,
|
52
52
|
Embed::Docswell::ATTRIBUTES,
|
@@ -60,104 +60,104 @@ module Qiita
|
|
60
60
|
"th" => [
|
61
61
|
"style",
|
62
62
|
],
|
63
|
-
"video" => [
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
63
|
+
"video" => %w[
|
64
|
+
src
|
65
|
+
autoplay
|
66
|
+
controls
|
67
|
+
loop
|
68
|
+
muted
|
69
|
+
poster
|
70
70
|
],
|
71
|
-
all: [
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
71
|
+
all: %w[
|
72
|
+
abbr
|
73
|
+
align
|
74
|
+
alt
|
75
|
+
border
|
76
|
+
cellpadding
|
77
|
+
cellspacing
|
78
|
+
cite
|
79
|
+
class
|
80
|
+
color
|
81
|
+
cols
|
82
|
+
colspan
|
83
|
+
data-lang
|
84
|
+
datetime
|
85
|
+
height
|
86
|
+
hreflang
|
87
|
+
id
|
88
|
+
itemprop
|
89
|
+
lang
|
90
|
+
name
|
91
|
+
rowspan
|
92
|
+
tabindex
|
93
|
+
target
|
94
|
+
title
|
95
|
+
width
|
96
96
|
],
|
97
97
|
},
|
98
98
|
css: {
|
99
|
-
properties: [
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
properties: %w[
|
100
|
+
background-color
|
101
|
+
border
|
102
|
+
text-align
|
103
103
|
],
|
104
104
|
},
|
105
|
-
elements: [
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
105
|
+
elements: %w[
|
106
|
+
a
|
107
|
+
b
|
108
|
+
blockquote
|
109
|
+
br
|
110
|
+
code
|
111
|
+
dd
|
112
|
+
del
|
113
|
+
details
|
114
|
+
div
|
115
|
+
dl
|
116
|
+
dt
|
117
|
+
em
|
118
|
+
font
|
119
|
+
h1
|
120
|
+
h2
|
121
|
+
h3
|
122
|
+
h4
|
123
|
+
h5
|
124
|
+
h6
|
125
|
+
h7
|
126
|
+
h8
|
127
|
+
hr
|
128
|
+
i
|
129
|
+
img
|
130
|
+
input
|
131
|
+
ins
|
132
|
+
kbd
|
133
|
+
li
|
134
|
+
ol
|
135
|
+
p
|
136
|
+
pre
|
137
|
+
q
|
138
|
+
rp
|
139
|
+
rt
|
140
|
+
ruby
|
141
|
+
s
|
142
|
+
samp
|
143
|
+
script
|
144
|
+
iframe
|
145
|
+
span
|
146
|
+
strike
|
147
|
+
strong
|
148
|
+
sub
|
149
|
+
summary
|
150
|
+
sup
|
151
|
+
table
|
152
|
+
tbody
|
153
|
+
td
|
154
|
+
tfoot
|
155
|
+
th
|
156
|
+
thead
|
157
|
+
tr
|
158
|
+
tt
|
159
|
+
ul
|
160
|
+
var
|
161
161
|
],
|
162
162
|
protocols: {
|
163
163
|
"a" => {
|
@@ -6,6 +6,7 @@ module Qiita
|
|
6
6
|
doc.search("sup > a").each do |a|
|
7
7
|
footnote = find_footnote(a)
|
8
8
|
next unless footnote
|
9
|
+
|
9
10
|
a[:title] = footnote.text.gsub(/\A\n/, "").gsub(/ ↩\n\z/, "")
|
10
11
|
end
|
11
12
|
doc
|
@@ -16,6 +17,7 @@ module Qiita
|
|
16
17
|
def find_footnote(a)
|
17
18
|
href = a["href"]
|
18
19
|
return nil if !href || href.match(/\A#fn\d+\z/).nil?
|
20
|
+
|
19
21
|
doc.search(href).first
|
20
22
|
end
|
21
23
|
end
|