obsohtml 1.9.5 → 1.9.7
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.
- package/.github/FUNDING.yml +2 -2
- package/.github/dependabot.yml +1 -1
- package/LICENSE +21 -428
- package/README.md +4 -2
- package/bin/obsohtml.js +57 -19
- package/bin/obsohtml.test.js +70 -26
- package/package.json +3 -3
package/.github/FUNDING.yml
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
buy_me_a_coffee: meiert
|
|
1
|
+
# buy_me_a_coffee: meiert
|
|
2
2
|
github: j9t
|
|
3
|
-
liberapay: j9t
|
|
3
|
+
# liberapay: j9t
|
package/.github/dependabot.yml
CHANGED
package/LICENSE
CHANGED
|
@@ -1,428 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
exhaustive, and do not form part of our licenses.
|
|
23
|
-
|
|
24
|
-
Considerations for licensors: Our public licenses are
|
|
25
|
-
intended for use by those authorized to give the public
|
|
26
|
-
permission to use material in ways otherwise restricted by
|
|
27
|
-
copyright and certain other rights. Our licenses are
|
|
28
|
-
irrevocable. Licensors should read and understand the terms
|
|
29
|
-
and conditions of the license they choose before applying it.
|
|
30
|
-
Licensors should also secure all rights necessary before
|
|
31
|
-
applying our licenses so that the public can reuse the
|
|
32
|
-
material as expected. Licensors should clearly mark any
|
|
33
|
-
material not subject to the license. This includes other CC-
|
|
34
|
-
licensed material, or material used under an exception or
|
|
35
|
-
limitation to copyright. More considerations for licensors:
|
|
36
|
-
wiki.creativecommons.org/Considerations_for_licensors
|
|
37
|
-
|
|
38
|
-
Considerations for the public: By using one of our public
|
|
39
|
-
licenses, a licensor grants the public permission to use the
|
|
40
|
-
licensed material under specified terms and conditions. If
|
|
41
|
-
the licensor's permission is not necessary for any reason--for
|
|
42
|
-
example, because of any applicable exception or limitation to
|
|
43
|
-
copyright--then that use is not regulated by the license. Our
|
|
44
|
-
licenses grant only permissions under copyright and certain
|
|
45
|
-
other rights that a licensor has authority to grant. Use of
|
|
46
|
-
the licensed material may still be restricted for other
|
|
47
|
-
reasons, including because others have copyright or other
|
|
48
|
-
rights in the material. A licensor may make special requests,
|
|
49
|
-
such as asking that all changes be marked or described.
|
|
50
|
-
Although not required by our licenses, you are encouraged to
|
|
51
|
-
respect those requests where reasonable. More considerations
|
|
52
|
-
for the public:
|
|
53
|
-
wiki.creativecommons.org/Considerations_for_licensees
|
|
54
|
-
|
|
55
|
-
=======================================================================
|
|
56
|
-
|
|
57
|
-
Creative Commons Attribution-ShareAlike 4.0 International Public
|
|
58
|
-
License
|
|
59
|
-
|
|
60
|
-
By exercising the Licensed Rights (defined below), You accept and agree
|
|
61
|
-
to be bound by the terms and conditions of this Creative Commons
|
|
62
|
-
Attribution-ShareAlike 4.0 International Public License ("Public
|
|
63
|
-
License"). To the extent this Public License may be interpreted as a
|
|
64
|
-
contract, You are granted the Licensed Rights in consideration of Your
|
|
65
|
-
acceptance of these terms and conditions, and the Licensor grants You
|
|
66
|
-
such rights in consideration of benefits the Licensor receives from
|
|
67
|
-
making the Licensed Material available under these terms and
|
|
68
|
-
conditions.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Section 1 -- Definitions.
|
|
72
|
-
|
|
73
|
-
a. Adapted Material means material subject to Copyright and Similar
|
|
74
|
-
Rights that is derived from or based upon the Licensed Material
|
|
75
|
-
and in which the Licensed Material is translated, altered,
|
|
76
|
-
arranged, transformed, or otherwise modified in a manner requiring
|
|
77
|
-
permission under the Copyright and Similar Rights held by the
|
|
78
|
-
Licensor. For purposes of this Public License, where the Licensed
|
|
79
|
-
Material is a musical work, performance, or sound recording,
|
|
80
|
-
Adapted Material is always produced where the Licensed Material is
|
|
81
|
-
synched in timed relation with a moving image.
|
|
82
|
-
|
|
83
|
-
b. Adapter's License means the license You apply to Your Copyright
|
|
84
|
-
and Similar Rights in Your contributions to Adapted Material in
|
|
85
|
-
accordance with the terms and conditions of this Public License.
|
|
86
|
-
|
|
87
|
-
c. BY-SA Compatible License means a license listed at
|
|
88
|
-
creativecommons.org/compatiblelicenses, approved by Creative
|
|
89
|
-
Commons as essentially the equivalent of this Public License.
|
|
90
|
-
|
|
91
|
-
d. Copyright and Similar Rights means copyright and/or similar rights
|
|
92
|
-
closely related to copyright including, without limitation,
|
|
93
|
-
performance, broadcast, sound recording, and Sui Generis Database
|
|
94
|
-
Rights, without regard to how the rights are labeled or
|
|
95
|
-
categorized. For purposes of this Public License, the rights
|
|
96
|
-
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
|
97
|
-
Rights.
|
|
98
|
-
|
|
99
|
-
e. Effective Technological Measures means those measures that, in the
|
|
100
|
-
absence of proper authority, may not be circumvented under laws
|
|
101
|
-
fulfilling obligations under Article 11 of the WIPO Copyright
|
|
102
|
-
Treaty adopted on December 20, 1996, and/or similar international
|
|
103
|
-
agreements.
|
|
104
|
-
|
|
105
|
-
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
|
106
|
-
any other exception or limitation to Copyright and Similar Rights
|
|
107
|
-
that applies to Your use of the Licensed Material.
|
|
108
|
-
|
|
109
|
-
g. License Elements means the license attributes listed in the name
|
|
110
|
-
of a Creative Commons Public License. The License Elements of this
|
|
111
|
-
Public License are Attribution and ShareAlike.
|
|
112
|
-
|
|
113
|
-
h. Licensed Material means the artistic or literary work, database,
|
|
114
|
-
or other material to which the Licensor applied this Public
|
|
115
|
-
License.
|
|
116
|
-
|
|
117
|
-
i. Licensed Rights means the rights granted to You subject to the
|
|
118
|
-
terms and conditions of this Public License, which are limited to
|
|
119
|
-
all Copyright and Similar Rights that apply to Your use of the
|
|
120
|
-
Licensed Material and that the Licensor has authority to license.
|
|
121
|
-
|
|
122
|
-
j. Licensor means the individual(s) or entity(ies) granting rights
|
|
123
|
-
under this Public License.
|
|
124
|
-
|
|
125
|
-
k. Share means to provide material to the public by any means or
|
|
126
|
-
process that requires permission under the Licensed Rights, such
|
|
127
|
-
as reproduction, public display, public performance, distribution,
|
|
128
|
-
dissemination, communication, or importation, and to make material
|
|
129
|
-
available to the public including in ways that members of the
|
|
130
|
-
public may access the material from a place and at a time
|
|
131
|
-
individually chosen by them.
|
|
132
|
-
|
|
133
|
-
l. Sui Generis Database Rights means rights other than copyright
|
|
134
|
-
resulting from Directive 96/9/EC of the European Parliament and of
|
|
135
|
-
the Council of 11 March 1996 on the legal protection of databases,
|
|
136
|
-
as amended and/or succeeded, as well as other essentially
|
|
137
|
-
equivalent rights anywhere in the world.
|
|
138
|
-
|
|
139
|
-
m. You means the individual or entity exercising the Licensed Rights
|
|
140
|
-
under this Public License. Your has a corresponding meaning.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
Section 2 -- Scope.
|
|
144
|
-
|
|
145
|
-
a. License grant.
|
|
146
|
-
|
|
147
|
-
1. Subject to the terms and conditions of this Public License,
|
|
148
|
-
the Licensor hereby grants You a worldwide, royalty-free,
|
|
149
|
-
non-sublicensable, non-exclusive, irrevocable license to
|
|
150
|
-
exercise the Licensed Rights in the Licensed Material to:
|
|
151
|
-
|
|
152
|
-
a. reproduce and Share the Licensed Material, in whole or
|
|
153
|
-
in part; and
|
|
154
|
-
|
|
155
|
-
b. produce, reproduce, and Share Adapted Material.
|
|
156
|
-
|
|
157
|
-
2. Exceptions and Limitations. For the avoidance of doubt, where
|
|
158
|
-
Exceptions and Limitations apply to Your use, this Public
|
|
159
|
-
License does not apply, and You do not need to comply with
|
|
160
|
-
its terms and conditions.
|
|
161
|
-
|
|
162
|
-
3. Term. The term of this Public License is specified in Section
|
|
163
|
-
6(a).
|
|
164
|
-
|
|
165
|
-
4. Media and formats; technical modifications allowed. The
|
|
166
|
-
Licensor authorizes You to exercise the Licensed Rights in
|
|
167
|
-
all media and formats whether now known or hereafter created,
|
|
168
|
-
and to make technical modifications necessary to do so. The
|
|
169
|
-
Licensor waives and/or agrees not to assert any right or
|
|
170
|
-
authority to forbid You from making technical modifications
|
|
171
|
-
necessary to exercise the Licensed Rights, including
|
|
172
|
-
technical modifications necessary to circumvent Effective
|
|
173
|
-
Technological Measures. For purposes of this Public License,
|
|
174
|
-
simply making modifications authorized by this Section 2(a)
|
|
175
|
-
(4) never produces Adapted Material.
|
|
176
|
-
|
|
177
|
-
5. Downstream recipients.
|
|
178
|
-
|
|
179
|
-
a. Offer from the Licensor -- Licensed Material. Every
|
|
180
|
-
recipient of the Licensed Material automatically
|
|
181
|
-
receives an offer from the Licensor to exercise the
|
|
182
|
-
Licensed Rights under the terms and conditions of this
|
|
183
|
-
Public License.
|
|
184
|
-
|
|
185
|
-
b. Additional offer from the Licensor -- Adapted Material.
|
|
186
|
-
Every recipient of Adapted Material from You
|
|
187
|
-
automatically receives an offer from the Licensor to
|
|
188
|
-
exercise the Licensed Rights in the Adapted Material
|
|
189
|
-
under the conditions of the Adapter's License You apply.
|
|
190
|
-
|
|
191
|
-
c. No downstream restrictions. You may not offer or impose
|
|
192
|
-
any additional or different terms or conditions on, or
|
|
193
|
-
apply any Effective Technological Measures to, the
|
|
194
|
-
Licensed Material if doing so restricts exercise of the
|
|
195
|
-
Licensed Rights by any recipient of the Licensed
|
|
196
|
-
Material.
|
|
197
|
-
|
|
198
|
-
6. No endorsement. Nothing in this Public License constitutes or
|
|
199
|
-
may be construed as permission to assert or imply that You
|
|
200
|
-
are, or that Your use of the Licensed Material is, connected
|
|
201
|
-
with, or sponsored, endorsed, or granted official status by,
|
|
202
|
-
the Licensor or others designated to receive attribution as
|
|
203
|
-
provided in Section 3(a)(1)(A)(i).
|
|
204
|
-
|
|
205
|
-
b. Other rights.
|
|
206
|
-
|
|
207
|
-
1. Moral rights, such as the right of integrity, are not
|
|
208
|
-
licensed under this Public License, nor are publicity,
|
|
209
|
-
privacy, and/or other similar personality rights; however, to
|
|
210
|
-
the extent possible, the Licensor waives and/or agrees not to
|
|
211
|
-
assert any such rights held by the Licensor to the limited
|
|
212
|
-
extent necessary to allow You to exercise the Licensed
|
|
213
|
-
Rights, but not otherwise.
|
|
214
|
-
|
|
215
|
-
2. Patent and trademark rights are not licensed under this
|
|
216
|
-
Public License.
|
|
217
|
-
|
|
218
|
-
3. To the extent possible, the Licensor waives any right to
|
|
219
|
-
collect royalties from You for the exercise of the Licensed
|
|
220
|
-
Rights, whether directly or through a collecting society
|
|
221
|
-
under any voluntary or waivable statutory or compulsory
|
|
222
|
-
licensing scheme. In all other cases the Licensor expressly
|
|
223
|
-
reserves any right to collect such royalties.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
Section 3 -- License Conditions.
|
|
227
|
-
|
|
228
|
-
Your exercise of the Licensed Rights is expressly made subject to the
|
|
229
|
-
following conditions.
|
|
230
|
-
|
|
231
|
-
a. Attribution.
|
|
232
|
-
|
|
233
|
-
1. If You Share the Licensed Material (including in modified
|
|
234
|
-
form), You must:
|
|
235
|
-
|
|
236
|
-
a. retain the following if it is supplied by the Licensor
|
|
237
|
-
with the Licensed Material:
|
|
238
|
-
|
|
239
|
-
i. identification of the creator(s) of the Licensed
|
|
240
|
-
Material and any others designated to receive
|
|
241
|
-
attribution, in any reasonable manner requested by
|
|
242
|
-
the Licensor (including by pseudonym if
|
|
243
|
-
designated);
|
|
244
|
-
|
|
245
|
-
ii. a copyright notice;
|
|
246
|
-
|
|
247
|
-
iii. a notice that refers to this Public License;
|
|
248
|
-
|
|
249
|
-
iv. a notice that refers to the disclaimer of
|
|
250
|
-
warranties;
|
|
251
|
-
|
|
252
|
-
v. a URI or hyperlink to the Licensed Material to the
|
|
253
|
-
extent reasonably practicable;
|
|
254
|
-
|
|
255
|
-
b. indicate if You modified the Licensed Material and
|
|
256
|
-
retain an indication of any previous modifications; and
|
|
257
|
-
|
|
258
|
-
c. indicate the Licensed Material is licensed under this
|
|
259
|
-
Public License, and include the text of, or the URI or
|
|
260
|
-
hyperlink to, this Public License.
|
|
261
|
-
|
|
262
|
-
2. You may satisfy the conditions in Section 3(a)(1) in any
|
|
263
|
-
reasonable manner based on the medium, means, and context in
|
|
264
|
-
which You Share the Licensed Material. For example, it may be
|
|
265
|
-
reasonable to satisfy the conditions by providing a URI or
|
|
266
|
-
hyperlink to a resource that includes the required
|
|
267
|
-
information.
|
|
268
|
-
|
|
269
|
-
3. If requested by the Licensor, You must remove any of the
|
|
270
|
-
information required by Section 3(a)(1)(A) to the extent
|
|
271
|
-
reasonably practicable.
|
|
272
|
-
|
|
273
|
-
b. ShareAlike.
|
|
274
|
-
|
|
275
|
-
In addition to the conditions in Section 3(a), if You Share
|
|
276
|
-
Adapted Material You produce, the following conditions also apply.
|
|
277
|
-
|
|
278
|
-
1. The Adapter's License You apply must be a Creative Commons
|
|
279
|
-
license with the same License Elements, this version or
|
|
280
|
-
later, or a BY-SA Compatible License.
|
|
281
|
-
|
|
282
|
-
2. You must include the text of, or the URI or hyperlink to, the
|
|
283
|
-
Adapter's License You apply. You may satisfy this condition
|
|
284
|
-
in any reasonable manner based on the medium, means, and
|
|
285
|
-
context in which You Share Adapted Material.
|
|
286
|
-
|
|
287
|
-
3. You may not offer or impose any additional or different terms
|
|
288
|
-
or conditions on, or apply any Effective Technological
|
|
289
|
-
Measures to, Adapted Material that restrict exercise of the
|
|
290
|
-
rights granted under the Adapter's License You apply.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
Section 4 -- Sui Generis Database Rights.
|
|
294
|
-
|
|
295
|
-
Where the Licensed Rights include Sui Generis Database Rights that
|
|
296
|
-
apply to Your use of the Licensed Material:
|
|
297
|
-
|
|
298
|
-
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
|
299
|
-
to extract, reuse, reproduce, and Share all or a substantial
|
|
300
|
-
portion of the contents of the database;
|
|
301
|
-
|
|
302
|
-
b. if You include all or a substantial portion of the database
|
|
303
|
-
contents in a database in which You have Sui Generis Database
|
|
304
|
-
Rights, then the database in which You have Sui Generis Database
|
|
305
|
-
Rights (but not its individual contents) is Adapted Material,
|
|
306
|
-
|
|
307
|
-
including for purposes of Section 3(b); and
|
|
308
|
-
c. You must comply with the conditions in Section 3(a) if You Share
|
|
309
|
-
all or a substantial portion of the contents of the database.
|
|
310
|
-
|
|
311
|
-
For the avoidance of doubt, this Section 4 supplements and does not
|
|
312
|
-
replace Your obligations under this Public License where the Licensed
|
|
313
|
-
Rights include other Copyright and Similar Rights.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
|
317
|
-
|
|
318
|
-
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
|
319
|
-
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
|
320
|
-
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
|
321
|
-
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
|
322
|
-
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
|
323
|
-
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
324
|
-
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
|
325
|
-
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
|
326
|
-
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
|
327
|
-
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
|
328
|
-
|
|
329
|
-
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
|
330
|
-
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
|
331
|
-
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
|
332
|
-
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
|
333
|
-
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
|
334
|
-
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
|
335
|
-
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
|
336
|
-
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
|
337
|
-
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
|
338
|
-
|
|
339
|
-
c. The disclaimer of warranties and limitation of liability provided
|
|
340
|
-
above shall be interpreted in a manner that, to the extent
|
|
341
|
-
possible, most closely approximates an absolute disclaimer and
|
|
342
|
-
waiver of all liability.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
Section 6 -- Term and Termination.
|
|
346
|
-
|
|
347
|
-
a. This Public License applies for the term of the Copyright and
|
|
348
|
-
Similar Rights licensed here. However, if You fail to comply with
|
|
349
|
-
this Public License, then Your rights under this Public License
|
|
350
|
-
terminate automatically.
|
|
351
|
-
|
|
352
|
-
b. Where Your right to use the Licensed Material has terminated under
|
|
353
|
-
Section 6(a), it reinstates:
|
|
354
|
-
|
|
355
|
-
1. automatically as of the date the violation is cured, provided
|
|
356
|
-
it is cured within 30 days of Your discovery of the
|
|
357
|
-
violation; or
|
|
358
|
-
|
|
359
|
-
2. upon express reinstatement by the Licensor.
|
|
360
|
-
|
|
361
|
-
For the avoidance of doubt, this Section 6(b) does not affect any
|
|
362
|
-
right the Licensor may have to seek remedies for Your violations
|
|
363
|
-
of this Public License.
|
|
364
|
-
|
|
365
|
-
c. For the avoidance of doubt, the Licensor may also offer the
|
|
366
|
-
Licensed Material under separate terms or conditions or stop
|
|
367
|
-
distributing the Licensed Material at any time; however, doing so
|
|
368
|
-
will not terminate this Public License.
|
|
369
|
-
|
|
370
|
-
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
|
371
|
-
License.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
Section 7 -- Other Terms and Conditions.
|
|
375
|
-
|
|
376
|
-
a. The Licensor shall not be bound by any additional or different
|
|
377
|
-
terms or conditions communicated by You unless expressly agreed.
|
|
378
|
-
|
|
379
|
-
b. Any arrangements, understandings, or agreements regarding the
|
|
380
|
-
Licensed Material not stated herein are separate from and
|
|
381
|
-
independent of the terms and conditions of this Public License.
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
Section 8 -- Interpretation.
|
|
385
|
-
|
|
386
|
-
a. For the avoidance of doubt, this Public License does not, and
|
|
387
|
-
shall not be interpreted to, reduce, limit, restrict, or impose
|
|
388
|
-
conditions on any use of the Licensed Material that could lawfully
|
|
389
|
-
be made without permission under this Public License.
|
|
390
|
-
|
|
391
|
-
b. To the extent possible, if any provision of this Public License is
|
|
392
|
-
deemed unenforceable, it shall be automatically reformed to the
|
|
393
|
-
minimum extent necessary to make it enforceable. If the provision
|
|
394
|
-
cannot be reformed, it shall be severed from this Public License
|
|
395
|
-
without affecting the enforceability of the remaining terms and
|
|
396
|
-
conditions.
|
|
397
|
-
|
|
398
|
-
c. No term or condition of this Public License will be waived and no
|
|
399
|
-
failure to comply consented to unless expressly agreed to by the
|
|
400
|
-
Licensor.
|
|
401
|
-
|
|
402
|
-
d. Nothing in this Public License constitutes or may be interpreted
|
|
403
|
-
as a limitation upon, or waiver of, any privileges and immunities
|
|
404
|
-
that apply to the Licensor or You, including from the legal
|
|
405
|
-
processes of any jurisdiction or authority.
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
=======================================================================
|
|
409
|
-
|
|
410
|
-
Creative Commons is not a party to its public
|
|
411
|
-
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
|
412
|
-
its public licenses to material it publishes and in those instances
|
|
413
|
-
will be considered the “Licensor.” The text of the Creative Commons
|
|
414
|
-
public licenses is dedicated to the public domain under the CC0 Public
|
|
415
|
-
Domain Dedication. Except for the limited purpose of indicating that
|
|
416
|
-
material is shared under a Creative Commons public license or as
|
|
417
|
-
otherwise permitted by the Creative Commons policies published at
|
|
418
|
-
creativecommons.org/policies, Creative Commons does not authorize the
|
|
419
|
-
use of the trademark "Creative Commons" or any other trademark or logo
|
|
420
|
-
of Creative Commons without its prior written consent including,
|
|
421
|
-
without limitation, in connection with any unauthorized modifications
|
|
422
|
-
to any of its public licenses or any other arrangements,
|
|
423
|
-
understandings, or agreements concerning use of licensed material. For
|
|
424
|
-
the avoidance of doubt, this paragraph does not form part of the
|
|
425
|
-
public licenses.
|
|
426
|
-
|
|
427
|
-
Creative Commons may be contacted at creativecommons.org.
|
|
428
|
-
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2024 Jens Oliver Meiert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/obsohtml) [](https://github.com/j9t/obsohtml/actions) [](https://socket.dev/npm/package/obsohtml)
|
|
4
4
|
|
|
5
|
-
ObsoHTML is a Node.js script designed to scan HTML, PHP, Nunjucks, Twig, JavaScript, and TypeScript files for obsolete or proprietary HTML attributes and elements
|
|
5
|
+
ObsoHTML is a Node.js script designed to scan HTML, PHP, Nunjucks, Twig, JavaScript, and TypeScript files for obsolete or proprietary HTML attributes and elements. It helps you identify and update deprecated HTML code to be more sure to use web standards.
|
|
6
6
|
|
|
7
7
|
ObsoHTML has inherent limitations and may not find all obsolete attributes and elements. If you run into a problem, please [file an issue](https://github.com/j9t/obsohtml/issues).
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ npm i obsohtml
|
|
|
20
20
|
|
|
21
21
|
#### Execution
|
|
22
22
|
|
|
23
|
-
The script accepts a folder path as a command line option, which can be specified in both short form (`-f`) and long form (`--folder`). The
|
|
23
|
+
The script accepts a folder or file path as a command line option, which can be specified in both short form (`-f`) and long form (`--folder`). The path can be either absolute or relative.
|
|
24
24
|
|
|
25
25
|
The script can be run in “verbose” mode by appending `-v` or `--verbose` to the command. This will show information about files and directories that were skipped.
|
|
26
26
|
|
|
@@ -80,6 +80,8 @@ node bin/obsohtml.js -f ../path/to/folder
|
|
|
80
80
|
|
|
81
81
|
The script will output messages to the console indicating any obsolete attributes or elements found in the scanned files, along with the file paths where they were detected.
|
|
82
82
|
|
|
83
|
+
The script exits with code `1` if any obsolete HTML is found, and `0` if none is found, making it suitable for use in CI pipelines.
|
|
84
|
+
|
|
83
85
|
## Background
|
|
84
86
|
|
|
85
87
|
This started as an experiment, in which I used AI to produce this little HTML quality helper, its tests, and its documentation. While it’s pretty straightforward, I’m sure to have missed something. Please [file an issue](https://github.com/j9t/obsohtml/issues) or contact me directly if you spot a problem or have a suggestion.
|
package/bin/obsohtml.js
CHANGED
|
@@ -18,35 +18,54 @@ const obsoleteAttributes = [
|
|
|
18
18
|
'align', 'background', 'bgcolor', 'border', 'frameborder', 'hspace', 'marginheight', 'marginwidth', 'noshade', 'nowrap', 'scrolling', 'valign', 'vspace'
|
|
19
19
|
];
|
|
20
20
|
|
|
21
|
+
// Pre-compile regexes once at startup
|
|
22
|
+
const elementRegexes = obsoleteElements.map(element => ({
|
|
23
|
+
element,
|
|
24
|
+
regex: new RegExp(`<\\s*${element}\\b`, 'i'),
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
const attributeRegexes = obsoleteAttributes.map(attribute => ({
|
|
28
|
+
attribute,
|
|
29
|
+
// Matches the attribute preceded by whitespace anywhere in a tag, without
|
|
30
|
+
// requiring it to be the last attribute before the closing bracket.
|
|
31
|
+
regex: new RegExp(`<[^>]*\\s${attribute}\\b(\\s*=\\s*(?:"[^"]*"|'[^']*'|[^"'\\s>]+))?`, 'i'),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
// Directories to skip during traversal
|
|
35
|
+
const EXCLUDED_DIRS = new Set(['node_modules', '.git', 'dist', 'build', 'vendor']);
|
|
36
|
+
|
|
21
37
|
// Default project directory (user’s home directory)
|
|
22
38
|
const defaultProjectDirectory = os.homedir();
|
|
23
39
|
|
|
40
|
+
// Track whether any obsolete HTML was found
|
|
41
|
+
let foundObsolete = false;
|
|
42
|
+
|
|
24
43
|
// Function to find obsolete elements and attributes in a file
|
|
25
|
-
|
|
44
|
+
function findObsolete(filePath) {
|
|
26
45
|
const content = fs.readFileSync(filePath, 'utf8');
|
|
27
46
|
|
|
28
47
|
// Check for obsolete elements
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
48
|
+
for (const { element, regex } of elementRegexes) {
|
|
49
|
+
if (regex.test(content)) {
|
|
50
|
+
foundObsolete = true;
|
|
32
51
|
const message = styleText('blue', `Found obsolete element ${styleText('bold', `'${element}'`)} in ${filePath}`);
|
|
33
52
|
console.log(message);
|
|
34
53
|
}
|
|
35
|
-
}
|
|
54
|
+
}
|
|
36
55
|
|
|
37
56
|
// Check for obsolete attributes
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
for (const { attribute, regex } of attributeRegexes) {
|
|
58
|
+
if (regex.test(content)) {
|
|
59
|
+
foundObsolete = true;
|
|
41
60
|
const message = styleText('green', `Found obsolete attribute ${styleText('bold', `'${attribute}'`)} in ${filePath}`);
|
|
42
61
|
console.log(message);
|
|
43
62
|
}
|
|
44
|
-
}
|
|
63
|
+
}
|
|
45
64
|
}
|
|
46
65
|
|
|
47
|
-
// Function to walk through the project directory, excluding
|
|
66
|
+
// Function to walk through the project directory, excluding common build/VCS directories
|
|
48
67
|
function walkDirectory(directory, verbose) {
|
|
49
|
-
const MAX_PATH_LENGTH = 255;
|
|
68
|
+
const MAX_PATH_LENGTH = 255;
|
|
50
69
|
let files;
|
|
51
70
|
|
|
52
71
|
try {
|
|
@@ -63,25 +82,31 @@ function walkDirectory(directory, verbose) {
|
|
|
63
82
|
}
|
|
64
83
|
}
|
|
65
84
|
|
|
66
|
-
|
|
85
|
+
for (const file of files) {
|
|
67
86
|
const fullPath = path.join(directory, file);
|
|
68
87
|
|
|
69
88
|
if (fullPath.length > MAX_PATH_LENGTH) {
|
|
70
89
|
if (verbose) console.warn(`Skipping file or directory with path too long: ${fullPath}`);
|
|
71
|
-
|
|
90
|
+
continue;
|
|
72
91
|
}
|
|
73
92
|
|
|
74
93
|
try {
|
|
75
94
|
const stats = fs.lstatSync(fullPath);
|
|
76
95
|
if (stats.isSymbolicLink()) {
|
|
77
96
|
if (verbose) console.warn(`Skipping symbolic link: ${fullPath}`);
|
|
78
|
-
|
|
97
|
+
continue;
|
|
79
98
|
}
|
|
80
99
|
if (stats.isDirectory()) {
|
|
81
|
-
if (file
|
|
100
|
+
if (!EXCLUDED_DIRS.has(file)) {
|
|
82
101
|
walkDirectory(fullPath, verbose);
|
|
83
102
|
}
|
|
84
|
-
} else if (
|
|
103
|
+
} else if (
|
|
104
|
+
fullPath.endsWith('.html') || fullPath.endsWith('.htm') ||
|
|
105
|
+
fullPath.endsWith('.php') ||
|
|
106
|
+
fullPath.endsWith('.njk') || fullPath.endsWith('.twig') ||
|
|
107
|
+
fullPath.endsWith('.js') || fullPath.endsWith('.jsx') ||
|
|
108
|
+
fullPath.endsWith('.ts') || fullPath.endsWith('.tsx')
|
|
109
|
+
) {
|
|
85
110
|
findObsolete(fullPath);
|
|
86
111
|
}
|
|
87
112
|
} catch (err) {
|
|
@@ -91,12 +116,25 @@ function walkDirectory(directory, verbose) {
|
|
|
91
116
|
throw err;
|
|
92
117
|
}
|
|
93
118
|
}
|
|
94
|
-
}
|
|
119
|
+
}
|
|
95
120
|
}
|
|
96
121
|
|
|
97
122
|
// Main function to execute the script
|
|
98
|
-
|
|
99
|
-
|
|
123
|
+
function main(projectDirectory = defaultProjectDirectory, verbose = false) {
|
|
124
|
+
let stats;
|
|
125
|
+
try {
|
|
126
|
+
stats = fs.lstatSync(projectDirectory);
|
|
127
|
+
} catch (err) {
|
|
128
|
+
if (err.code !== 'ENOENT') throw err;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (stats?.isFile()) {
|
|
132
|
+
findObsolete(projectDirectory);
|
|
133
|
+
} else {
|
|
134
|
+
walkDirectory(projectDirectory, verbose);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (foundObsolete) process.exit(1);
|
|
100
138
|
}
|
|
101
139
|
|
|
102
140
|
// Define command line options
|
package/bin/obsohtml.test.js
CHANGED
|
@@ -9,71 +9,115 @@ import { stripVTControlCharacters } from 'node:util';
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
const scriptPath = path.join(__dirname, 'obsohtml.js');
|
|
11
11
|
|
|
12
|
+
function run(args) {
|
|
13
|
+
const result = spawnSync('node', [scriptPath, ...args], { encoding: 'utf-8' });
|
|
14
|
+
return {
|
|
15
|
+
stdout: stripVTControlCharacters(result.stdout),
|
|
16
|
+
stderr: stripVTControlCharacters(result.stderr),
|
|
17
|
+
status: result.status,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
describe('ObsoHTML', () => {
|
|
13
22
|
const tempDir = path.join(__dirname, 'temp_test_dir');
|
|
14
23
|
const tempFile = path.join(tempDir, 'test.html');
|
|
15
24
|
const tempFileWithAttributes = path.join(tempDir, 'test_with_attributes.html');
|
|
25
|
+
const tempFileWithMidTagAttribute = path.join(tempDir, 'test_mid_tag_attribute.html');
|
|
16
26
|
const tempFileWithMinimizedAttributes = path.join(tempDir, 'test_with_minimized_attributes.html');
|
|
17
27
|
const tempTwigFile = path.join(tempDir, 'test.twig');
|
|
28
|
+
const tempJsxFile = path.join(tempDir, 'test.jsx');
|
|
29
|
+
const tempTsxFile = path.join(tempDir, 'test.tsx');
|
|
18
30
|
|
|
19
31
|
before(() => {
|
|
20
|
-
// Create a temporary directory and files
|
|
21
32
|
if (!fs.existsSync(tempDir)) {
|
|
22
33
|
fs.mkdirSync(tempDir);
|
|
23
34
|
}
|
|
24
35
|
fs.writeFileSync(tempFile, '<!DOCTYPE html><html><title>Test</title><body><center>Test</center></body></html>');
|
|
25
36
|
fs.writeFileSync(tempFileWithAttributes, '<!DOCTYPE html><html><title>Test</title><body><img src=test.jpg alt=Test align=left></body></html>');
|
|
37
|
+
fs.writeFileSync(tempFileWithMidTagAttribute, '<!DOCTYPE html><html><title>Test</title><body><img align=left src=test.jpg></body></html>');
|
|
26
38
|
fs.writeFileSync(tempFileWithMinimizedAttributes, '<!DOCTYPE html><html><title>Test</title><hr noshade><table><tr><th class=nowrap></table>');
|
|
27
39
|
fs.writeFileSync(tempTwigFile, '<!DOCTYPE html><html><title>Test</title><isindex>');
|
|
40
|
+
fs.writeFileSync(tempJsxFile, 'export default () => <center>Hello</center>;');
|
|
41
|
+
fs.writeFileSync(tempTsxFile, 'export default (): JSX.Element => <marquee>Hello</marquee>;');
|
|
28
42
|
});
|
|
29
43
|
|
|
30
44
|
after(() => {
|
|
31
|
-
// Clean up the temporary directory and files
|
|
32
45
|
fs.unlinkSync(tempFile);
|
|
33
46
|
fs.unlinkSync(tempFileWithAttributes);
|
|
47
|
+
fs.unlinkSync(tempFileWithMidTagAttribute);
|
|
34
48
|
fs.unlinkSync(tempFileWithMinimizedAttributes);
|
|
35
49
|
fs.unlinkSync(tempTwigFile);
|
|
50
|
+
fs.unlinkSync(tempJsxFile);
|
|
51
|
+
fs.unlinkSync(tempTsxFile);
|
|
36
52
|
fs.rmdirSync(tempDir);
|
|
37
53
|
});
|
|
38
54
|
|
|
39
55
|
test('Detect obsolete elements', () => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
assert.ok(output.includes("Found obsolete element 'center'"));
|
|
56
|
+
const { stdout } = run(['-f', tempDir]);
|
|
57
|
+
assert.ok(stdout.includes("Found obsolete element 'center'"));
|
|
43
58
|
});
|
|
44
59
|
|
|
45
60
|
test('Detect obsolete attributes', () => {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
assert.ok(output.includes("Found obsolete attribute 'align'"));
|
|
61
|
+
const { stdout } = run(['-f', tempDir]);
|
|
62
|
+
assert.ok(stdout.includes("Found obsolete attribute 'align'"));
|
|
49
63
|
});
|
|
50
64
|
|
|
51
65
|
test('Detect obsolete elements and attributes using absolute path', () => {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
assert.ok(output.includes("Found obsolete element 'center'"));
|
|
56
|
-
assert.ok(output.includes("Found obsolete attribute 'align'"));
|
|
66
|
+
const { stdout } = run(['-f', path.resolve(tempDir)]);
|
|
67
|
+
assert.ok(stdout.includes("Found obsolete element 'center'"));
|
|
68
|
+
assert.ok(stdout.includes("Found obsolete attribute 'align'"));
|
|
57
69
|
});
|
|
58
70
|
|
|
59
71
|
test('Detect obsolete elements and attributes using relative path', () => {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
assert.ok(output.includes("Found obsolete element 'center'"));
|
|
64
|
-
assert.ok(output.includes("Found obsolete attribute 'align'"));
|
|
72
|
+
const { stdout } = run(['--folder', path.relative(process.cwd(), tempDir)]);
|
|
73
|
+
assert.ok(stdout.includes("Found obsolete element 'center'"));
|
|
74
|
+
assert.ok(stdout.includes("Found obsolete attribute 'align'"));
|
|
65
75
|
});
|
|
66
76
|
|
|
67
77
|
test('Detect obsolete minimized attributes', () => {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
assert.ok(
|
|
71
|
-
assert.ok(!output.includes("Found obsolete attribute 'nowrap'"));
|
|
78
|
+
const { stdout } = run(['-f', tempDir]);
|
|
79
|
+
assert.ok(stdout.includes("Found obsolete attribute 'noshade'"));
|
|
80
|
+
assert.ok(!stdout.includes("Found obsolete attribute 'nowrap'"));
|
|
72
81
|
});
|
|
73
82
|
|
|
74
83
|
test('Detect obsolete elements in Twig file', () => {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
const { stdout } = run(['-f', tempDir]);
|
|
85
|
+
assert.ok(stdout.includes("Found obsolete element 'isindex'"));
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('Detect obsolete attribute when it is not the last attribute in a tag', () => {
|
|
89
|
+
const { stdout } = run(['-f', tempFileWithMidTagAttribute]);
|
|
90
|
+
assert.ok(stdout.includes("Found obsolete attribute 'align'"));
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('Detect obsolete elements in JSX file', () => {
|
|
94
|
+
const { stdout } = run(['-f', tempJsxFile]);
|
|
95
|
+
assert.ok(stdout.includes("Found obsolete element 'center'"));
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('Detect obsolete elements in TSX file', () => {
|
|
99
|
+
const { stdout } = run(['-f', tempTsxFile]);
|
|
100
|
+
assert.ok(stdout.includes("Found obsolete element 'marquee'"));
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('Exit with code 1 when obsolete HTML is found', () => {
|
|
104
|
+
const { status } = run(['-f', tempDir]);
|
|
105
|
+
assert.strictEqual(status, 1);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('Exit with code 0 when no obsolete HTML is found', () => {
|
|
109
|
+
const cleanFile = path.join(tempDir, 'clean.html');
|
|
110
|
+
fs.writeFileSync(cleanFile, '<!DOCTYPE html><html><title>Clean</title><body><p>No issues here.</p></body></html>');
|
|
111
|
+
try {
|
|
112
|
+
const { status } = run(['-f', cleanFile]);
|
|
113
|
+
assert.strictEqual(status, 0);
|
|
114
|
+
} finally {
|
|
115
|
+
fs.unlinkSync(cleanFile);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('Verbose mode reports skipped non-existent directory', () => {
|
|
120
|
+
const { stderr } = run(['-f', path.join(tempDir, 'nonexistent'), '-v']);
|
|
121
|
+
assert.ok(stderr.includes('Skipping non-existent directory'));
|
|
78
122
|
});
|
|
79
|
-
});
|
|
123
|
+
});
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"commander": "^14.0.0"
|
|
8
8
|
},
|
|
9
|
-
"description": "
|
|
9
|
+
"description": "Obsolete and proprietary HTML finder",
|
|
10
10
|
"funding": "https://github.com/j9t/obsohtml?sponsor=1",
|
|
11
11
|
"homepage": "https://github.com/j9t/obsohtml",
|
|
12
12
|
"keywords": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"qc",
|
|
16
16
|
"semantics"
|
|
17
17
|
],
|
|
18
|
-
"license": "
|
|
18
|
+
"license": "MIT",
|
|
19
19
|
"name": "obsohtml",
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"test": "node --test bin/obsohtml.test.js"
|
|
27
27
|
},
|
|
28
28
|
"type": "module",
|
|
29
|
-
"version": "1.9.
|
|
29
|
+
"version": "1.9.7"
|
|
30
30
|
}
|