@baiyibai-antora/extensions 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.
- package/CHANGELOG.adoc +130 -0
- package/LICENSE +21 -0
- package/README.adoc +645 -0
- package/dist/extensions/asciidoctorconfig/index.d.ts +71 -0
- package/dist/extensions/asciidoctorconfig/index.d.ts.map +1 -0
- package/dist/extensions/asciidoctorconfig/index.js +207 -0
- package/dist/extensions/asciidoctorconfig/index.js.map +1 -0
- package/dist/extensions/assembler-rename-pdf/index.d.ts +79 -0
- package/dist/extensions/assembler-rename-pdf/index.d.ts.map +1 -0
- package/dist/extensions/assembler-rename-pdf/index.js +267 -0
- package/dist/extensions/assembler-rename-pdf/index.js.map +1 -0
- package/dist/extensions/assembler-ruby-preflight/index.d.ts +76 -0
- package/dist/extensions/assembler-ruby-preflight/index.d.ts.map +1 -0
- package/dist/extensions/assembler-ruby-preflight/index.js +458 -0
- package/dist/extensions/assembler-ruby-preflight/index.js.map +1 -0
- package/dist/extensions/collector-writer/index.d.ts +79 -0
- package/dist/extensions/collector-writer/index.d.ts.map +1 -0
- package/dist/extensions/collector-writer/index.js +248 -0
- package/dist/extensions/collector-writer/index.js.map +1 -0
- package/dist/extensions/external-asset-downloader/index.d.ts +73 -0
- package/dist/extensions/external-asset-downloader/index.d.ts.map +1 -0
- package/dist/extensions/external-asset-downloader/index.js +387 -0
- package/dist/extensions/external-asset-downloader/index.js.map +1 -0
- package/dist/extensions/vale-integration/index.d.ts +76 -0
- package/dist/extensions/vale-integration/index.d.ts.map +1 -0
- package/dist/extensions/vale-integration/index.js +409 -0
- package/dist/extensions/vale-integration/index.js.map +1 -0
- package/package.json +72 -0
package/README.adoc
ADDED
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
= Baiyibai Docs Extensions
|
|
2
|
+
:toc: left
|
|
3
|
+
:toclevels: 3
|
|
4
|
+
:sectnums:
|
|
5
|
+
:source-highlighter: highlight.js
|
|
6
|
+
|
|
7
|
+
A consolidated package of Antora extensions for documentation workflows.
|
|
8
|
+
|
|
9
|
+
== Overview
|
|
10
|
+
|
|
11
|
+
This package provides six Antora extensions:
|
|
12
|
+
|
|
13
|
+
[cols="1,3"]
|
|
14
|
+
|===
|
|
15
|
+
|Extension |Description
|
|
16
|
+
|
|
17
|
+
|<<collector-writer>>
|
|
18
|
+
|Writes collected content (themes, Vale rules) from Antora's content catalog to disk
|
|
19
|
+
|
|
20
|
+
|<<assembler-ruby-preflight>>
|
|
21
|
+
|Validates Ruby/Ghostscript versions and manages gem dependencies for PDF generation
|
|
22
|
+
|
|
23
|
+
|<<assembler-rename-pdf>>
|
|
24
|
+
|Renames PDF exports based on document attributes
|
|
25
|
+
|
|
26
|
+
|<<external-asset-downloader>>
|
|
27
|
+
|Downloads external assets from HTTP/HTTPS URLs
|
|
28
|
+
|
|
29
|
+
|<<vale-integration>>
|
|
30
|
+
|Integrates Vale linting into the Antora build pipeline
|
|
31
|
+
|
|
32
|
+
|<<asciidoctorconfig>>
|
|
33
|
+
|Copies `.asciidoctorconfig` files from content catalog to project root
|
|
34
|
+
|===
|
|
35
|
+
|
|
36
|
+
== Installation
|
|
37
|
+
|
|
38
|
+
[source,bash]
|
|
39
|
+
----
|
|
40
|
+
npm install @baiyibai-antora/extensions
|
|
41
|
+
----
|
|
42
|
+
|
|
43
|
+
== Quick Start
|
|
44
|
+
|
|
45
|
+
Add extensions to your `antora-playbook.yml`:
|
|
46
|
+
|
|
47
|
+
[source,yaml]
|
|
48
|
+
----
|
|
49
|
+
antora:
|
|
50
|
+
extensions:
|
|
51
|
+
- require: '@baiyibai-antora/extensions/collector-writer'
|
|
52
|
+
collectorWriter:
|
|
53
|
+
enabled: true
|
|
54
|
+
targets:
|
|
55
|
+
- component: vale-styles
|
|
56
|
+
write_dir: ./vale-rules
|
|
57
|
+
ephemeral: true
|
|
58
|
+
----
|
|
59
|
+
|
|
60
|
+
== Extension Pairings
|
|
61
|
+
|
|
62
|
+
Some extensions work well together:
|
|
63
|
+
|
|
64
|
+
=== PDF Generation Pipeline
|
|
65
|
+
|
|
66
|
+
For PDF generation, use these extensions in order:
|
|
67
|
+
|
|
68
|
+
1. **collector-writer** - Writes PDF themes (Gemfile, YAML configs) to disk
|
|
69
|
+
2. **assembler-ruby-preflight** - Validates Ruby/Ghostscript and installs gems
|
|
70
|
+
3. **assembler-rename-pdf** - Renames generated PDFs based on attributes
|
|
71
|
+
|
|
72
|
+
[source,yaml]
|
|
73
|
+
----
|
|
74
|
+
antora:
|
|
75
|
+
extensions:
|
|
76
|
+
# 1. Write themes to disk
|
|
77
|
+
- require: '@baiyibai-antora/extensions/collector-writer'
|
|
78
|
+
collectorWriter:
|
|
79
|
+
enabled: true
|
|
80
|
+
targets:
|
|
81
|
+
- component: pdf-themes
|
|
82
|
+
write_dir: ./assembler-themes
|
|
83
|
+
ephemeral: false
|
|
84
|
+
|
|
85
|
+
# 2. Validate Ruby and install gems
|
|
86
|
+
- require: '@baiyibai-antora/extensions/assembler-ruby-preflight'
|
|
87
|
+
preflight:
|
|
88
|
+
enabled: true
|
|
89
|
+
gemfile_path: './assembler-themes/Gemfile'
|
|
90
|
+
|
|
91
|
+
# 3. Rename PDFs after generation
|
|
92
|
+
- require: '@baiyibai-antora/extensions/assembler-rename-pdf'
|
|
93
|
+
renamer:
|
|
94
|
+
enabled: true
|
|
95
|
+
pdf_filename_attribute: 'pdf-filename'
|
|
96
|
+
----
|
|
97
|
+
|
|
98
|
+
=== Vale Linting Pipeline
|
|
99
|
+
|
|
100
|
+
For Vale integration, use these extensions:
|
|
101
|
+
|
|
102
|
+
1. **collector-writer** - Writes Vale styles/rules to disk
|
|
103
|
+
2. **vale-integration** - Runs Vale linting on content
|
|
104
|
+
|
|
105
|
+
[source,yaml]
|
|
106
|
+
----
|
|
107
|
+
antora:
|
|
108
|
+
extensions:
|
|
109
|
+
# 1. Write Vale rules to disk
|
|
110
|
+
- require: '@baiyibai-antora/extensions/collector-writer'
|
|
111
|
+
collectorWriter:
|
|
112
|
+
enabled: true
|
|
113
|
+
targets:
|
|
114
|
+
- component: vale-styles
|
|
115
|
+
write_dir: ./vale-rules
|
|
116
|
+
ephemeral: true
|
|
117
|
+
|
|
118
|
+
# 2. Run Vale linting
|
|
119
|
+
- require: '@baiyibai-antora/extensions/vale-integration'
|
|
120
|
+
vale:
|
|
121
|
+
enabled: true
|
|
122
|
+
config_file: './vale-rules/.vale.ini'
|
|
123
|
+
----
|
|
124
|
+
|
|
125
|
+
== Extension Reference
|
|
126
|
+
|
|
127
|
+
[[collector-writer]]
|
|
128
|
+
=== collector-writer
|
|
129
|
+
|
|
130
|
+
Copies assets discovered by `@antora/collector-extension` from the Antora content catalog into local folders.
|
|
131
|
+
|
|
132
|
+
==== Configuration
|
|
133
|
+
|
|
134
|
+
[cols="2,1,3,2"]
|
|
135
|
+
|===
|
|
136
|
+
|Key |Type |Description |Default
|
|
137
|
+
|
|
138
|
+
|`enabled`
|
|
139
|
+
|boolean
|
|
140
|
+
|Enable/disable the extension
|
|
141
|
+
|`true`
|
|
142
|
+
|
|
143
|
+
|`quiet`
|
|
144
|
+
|boolean
|
|
145
|
+
|Suppress informational output
|
|
146
|
+
|`true`
|
|
147
|
+
|
|
148
|
+
|`output_dir`
|
|
149
|
+
|string
|
|
150
|
+
|Base output directory
|
|
151
|
+
|`'vale-output'`
|
|
152
|
+
|
|
153
|
+
|`targets`
|
|
154
|
+
|array
|
|
155
|
+
|List of target configurations
|
|
156
|
+
|`[]`
|
|
157
|
+
|
|
158
|
+
|`required`
|
|
159
|
+
|array
|
|
160
|
+
|List of required component targets
|
|
161
|
+
|`[]`
|
|
162
|
+
|===
|
|
163
|
+
|
|
164
|
+
==== Target Configuration
|
|
165
|
+
|
|
166
|
+
[cols="2,1,3,2"]
|
|
167
|
+
|===
|
|
168
|
+
|Key |Type |Description |Default
|
|
169
|
+
|
|
170
|
+
|`component`
|
|
171
|
+
|string
|
|
172
|
+
|Component name to match in content catalog
|
|
173
|
+
|_(required)_
|
|
174
|
+
|
|
175
|
+
|`write_dir`
|
|
176
|
+
|string
|
|
177
|
+
|Directory to write files to
|
|
178
|
+
|`'target'`
|
|
179
|
+
|
|
180
|
+
|`ephemeral`
|
|
181
|
+
|boolean
|
|
182
|
+
|Delete directory after site is published
|
|
183
|
+
|`true`
|
|
184
|
+
|===
|
|
185
|
+
|
|
186
|
+
==== Playbook Configuration
|
|
187
|
+
|
|
188
|
+
[source,yaml]
|
|
189
|
+
----
|
|
190
|
+
- require: '@baiyibai-antora/extensions/collector-writer'
|
|
191
|
+
collectorWriter:
|
|
192
|
+
enabled: true
|
|
193
|
+
quiet: false
|
|
194
|
+
targets:
|
|
195
|
+
- component: pdf-themes
|
|
196
|
+
write_dir: ./assembler-themes
|
|
197
|
+
ephemeral: false
|
|
198
|
+
- component: vale-styles
|
|
199
|
+
write_dir: ./vale-rules
|
|
200
|
+
ephemeral: true
|
|
201
|
+
----
|
|
202
|
+
|
|
203
|
+
[[assembler-ruby-preflight]]
|
|
204
|
+
=== assembler-ruby-preflight
|
|
205
|
+
|
|
206
|
+
Coordinates Ruby/Ghostscript version checks and gem bundling for PDF generation.
|
|
207
|
+
|
|
208
|
+
==== Configuration
|
|
209
|
+
|
|
210
|
+
[cols="2,1,3,2"]
|
|
211
|
+
|===
|
|
212
|
+
|Key |Type |Description |Default
|
|
213
|
+
|
|
214
|
+
|`enabled`
|
|
215
|
+
|boolean
|
|
216
|
+
|Enable/disable the extension
|
|
217
|
+
|`true`
|
|
218
|
+
|
|
219
|
+
|`quiet`
|
|
220
|
+
|boolean
|
|
221
|
+
|Suppress informational output
|
|
222
|
+
|`true`
|
|
223
|
+
|
|
224
|
+
|`gemfile_path`
|
|
225
|
+
|string
|
|
226
|
+
|Path to source Gemfile
|
|
227
|
+
|_(required for gem bundling)_
|
|
228
|
+
|
|
229
|
+
|`use_system_gems`
|
|
230
|
+
|boolean
|
|
231
|
+
|Use system-installed gems instead of vendor/bundle
|
|
232
|
+
|`false`
|
|
233
|
+
|
|
234
|
+
|`platforms`
|
|
235
|
+
|object
|
|
236
|
+
|Per-platform configuration
|
|
237
|
+
|_(see below)_
|
|
238
|
+
|===
|
|
239
|
+
|
|
240
|
+
==== Platform Configuration
|
|
241
|
+
|
|
242
|
+
Each platform (`win32`, `linux`, `darwin`) supports:
|
|
243
|
+
|
|
244
|
+
[cols="2,1,3,2"]
|
|
245
|
+
|===
|
|
246
|
+
|Key |Type |Description |Default
|
|
247
|
+
|
|
248
|
+
|`ruby_version`
|
|
249
|
+
|string
|
|
250
|
+
|Expected Ruby version (e.g., `'3.3.8'`)
|
|
251
|
+
|_(none)_
|
|
252
|
+
|
|
253
|
+
|`ruby_revision`
|
|
254
|
+
|string
|
|
255
|
+
|Expected Ruby revision hash
|
|
256
|
+
|_(none)_
|
|
257
|
+
|
|
258
|
+
|`ruby_guidance`
|
|
259
|
+
|string
|
|
260
|
+
|Message shown if Ruby check fails
|
|
261
|
+
|_(none)_
|
|
262
|
+
|
|
263
|
+
|`gs_version`
|
|
264
|
+
|string
|
|
265
|
+
|Expected Ghostscript version
|
|
266
|
+
|_(none)_
|
|
267
|
+
|
|
268
|
+
|`gs_guidance`
|
|
269
|
+
|string
|
|
270
|
+
|Message shown if Ghostscript check fails
|
|
271
|
+
|_(none)_
|
|
272
|
+
|
|
273
|
+
|`check_ruby`
|
|
274
|
+
|boolean
|
|
275
|
+
|Enable Ruby version check
|
|
276
|
+
|`true`
|
|
277
|
+
|
|
278
|
+
|`check_gs`
|
|
279
|
+
|boolean
|
|
280
|
+
|Enable Ghostscript version check
|
|
281
|
+
|`false` (linux), `true` (others)
|
|
282
|
+
|===
|
|
283
|
+
|
|
284
|
+
==== Playbook Configuration
|
|
285
|
+
|
|
286
|
+
[source,yaml]
|
|
287
|
+
----
|
|
288
|
+
- require: '@baiyibai-antora/extensions/assembler-ruby-preflight'
|
|
289
|
+
preflight:
|
|
290
|
+
enabled: true
|
|
291
|
+
quiet: false
|
|
292
|
+
gemfile_path: './assembler-themes/Gemfile'
|
|
293
|
+
use_system_gems: true
|
|
294
|
+
platforms:
|
|
295
|
+
linux:
|
|
296
|
+
ruby_version: '3.3.8'
|
|
297
|
+
ruby_revision: 'b200bad6cd'
|
|
298
|
+
check_ruby: true
|
|
299
|
+
check_gs: false
|
|
300
|
+
win32:
|
|
301
|
+
ruby_version: '3.3.8'
|
|
302
|
+
gs_version: '10.05.1'
|
|
303
|
+
check_ruby: true
|
|
304
|
+
check_gs: true
|
|
305
|
+
----
|
|
306
|
+
|
|
307
|
+
[[assembler-rename-pdf]]
|
|
308
|
+
=== assembler-rename-pdf
|
|
309
|
+
|
|
310
|
+
Renames exported PDF files based on document attributes.
|
|
311
|
+
|
|
312
|
+
==== Configuration
|
|
313
|
+
|
|
314
|
+
[cols="2,1,3,2"]
|
|
315
|
+
|===
|
|
316
|
+
|Key |Type |Description |Default
|
|
317
|
+
|
|
318
|
+
|`enabled`
|
|
319
|
+
|boolean
|
|
320
|
+
|Enable/disable the extension
|
|
321
|
+
|`true`
|
|
322
|
+
|
|
323
|
+
|`quiet`
|
|
324
|
+
|boolean
|
|
325
|
+
|Suppress informational output
|
|
326
|
+
|`true`
|
|
327
|
+
|
|
328
|
+
|`pdf_filename_attribute`
|
|
329
|
+
|string
|
|
330
|
+
|Document attribute containing the desired PDF filename
|
|
331
|
+
|`'pdf-filename'`
|
|
332
|
+
|
|
333
|
+
|`assembler_base_dir`
|
|
334
|
+
|string
|
|
335
|
+
|Base directory for assembler output
|
|
336
|
+
|`'build/assembler-pdf'`
|
|
337
|
+
|
|
338
|
+
|`site_base_dir`
|
|
339
|
+
|string
|
|
340
|
+
|Base directory for site output
|
|
341
|
+
|_(uses playbook output.dir)_
|
|
342
|
+
|
|
343
|
+
|`exports_subdir`
|
|
344
|
+
|string
|
|
345
|
+
|Subdirectory containing exports
|
|
346
|
+
|`'_exports'`
|
|
347
|
+
|
|
348
|
+
|`copy_target_dir`
|
|
349
|
+
|string
|
|
350
|
+
|Directory to copy renamed PDFs to
|
|
351
|
+
|_(disabled)_
|
|
352
|
+
|===
|
|
353
|
+
|
|
354
|
+
==== Playbook Configuration
|
|
355
|
+
|
|
356
|
+
[source,yaml]
|
|
357
|
+
----
|
|
358
|
+
- require: '@baiyibai-antora/extensions/assembler-rename-pdf'
|
|
359
|
+
renamer:
|
|
360
|
+
enabled: true
|
|
361
|
+
quiet: false
|
|
362
|
+
pdf_filename_attribute: 'pdf-filename'
|
|
363
|
+
assembler_base_dir: 'build/assembler-pdf'
|
|
364
|
+
exports_subdir: '_exports'
|
|
365
|
+
copy_target_dir: '.'
|
|
366
|
+
----
|
|
367
|
+
|
|
368
|
+
[[external-asset-downloader]]
|
|
369
|
+
=== external-asset-downloader
|
|
370
|
+
|
|
371
|
+
Downloads external assets from HTTP/HTTPS URLs into component directories.
|
|
372
|
+
|
|
373
|
+
==== Configuration
|
|
374
|
+
|
|
375
|
+
[cols="2,1,3,2"]
|
|
376
|
+
|===
|
|
377
|
+
|Key |Type |Description |Default
|
|
378
|
+
|
|
379
|
+
|`enabled`
|
|
380
|
+
|boolean
|
|
381
|
+
|Enable/disable the extension
|
|
382
|
+
|`true`
|
|
383
|
+
|
|
384
|
+
|`quiet`
|
|
385
|
+
|boolean
|
|
386
|
+
|Suppress informational output
|
|
387
|
+
|`true`
|
|
388
|
+
|
|
389
|
+
|`attribute_prefix`
|
|
390
|
+
|string
|
|
391
|
+
|Attribute name prefix to scan (matches `image`, `image2`, etc.)
|
|
392
|
+
|`'image'`
|
|
393
|
+
|
|
394
|
+
|`include_commented`
|
|
395
|
+
|boolean
|
|
396
|
+
|Also scan commented attributes in antora.yml
|
|
397
|
+
|`true`
|
|
398
|
+
|
|
399
|
+
|`target_dir`
|
|
400
|
+
|string
|
|
401
|
+
|Directory to download assets to
|
|
402
|
+
|_(required)_
|
|
403
|
+
|
|
404
|
+
|`overwrite`
|
|
405
|
+
|string
|
|
406
|
+
|Overwrite behavior: `'never'` or `'always'`
|
|
407
|
+
|`'never'`
|
|
408
|
+
|
|
409
|
+
|`concurrency`
|
|
410
|
+
|number
|
|
411
|
+
|Number of concurrent downloads
|
|
412
|
+
|`5`
|
|
413
|
+
|
|
414
|
+
|`directory_listing`
|
|
415
|
+
|boolean
|
|
416
|
+
|Enable HTTP directory listing crawl
|
|
417
|
+
|`false`
|
|
418
|
+
|
|
419
|
+
|`url_replace`
|
|
420
|
+
|array
|
|
421
|
+
|URL transformation rules
|
|
422
|
+
|`[]`
|
|
423
|
+
|===
|
|
424
|
+
|
|
425
|
+
==== URL Replace Rules
|
|
426
|
+
|
|
427
|
+
[cols="2,1,3"]
|
|
428
|
+
|===
|
|
429
|
+
|Key |Type |Description
|
|
430
|
+
|
|
431
|
+
|`pattern`
|
|
432
|
+
|string
|
|
433
|
+
|Regex pattern to match
|
|
434
|
+
|
|
435
|
+
|`replacement`
|
|
436
|
+
|string
|
|
437
|
+
|Replacement string
|
|
438
|
+
|===
|
|
439
|
+
|
|
440
|
+
==== Playbook Configuration
|
|
441
|
+
|
|
442
|
+
[source,yaml]
|
|
443
|
+
----
|
|
444
|
+
- require: '@baiyibai-antora/extensions/external-asset-downloader'
|
|
445
|
+
assetDownloader:
|
|
446
|
+
enabled: true
|
|
447
|
+
quiet: false
|
|
448
|
+
attribute_prefix: 'image'
|
|
449
|
+
target_dir: 'modules/ROOT/images'
|
|
450
|
+
overwrite: 'never'
|
|
451
|
+
concurrency: 5
|
|
452
|
+
directory_listing: true
|
|
453
|
+
url_replace:
|
|
454
|
+
- pattern: '/artifactory/'
|
|
455
|
+
replacement: '/artifactory/api/storage/'
|
|
456
|
+
----
|
|
457
|
+
|
|
458
|
+
[[vale-integration]]
|
|
459
|
+
=== vale-integration
|
|
460
|
+
|
|
461
|
+
Integrates Vale linting into the Antora build pipeline.
|
|
462
|
+
|
|
463
|
+
==== Configuration
|
|
464
|
+
|
|
465
|
+
[cols="2,1,3,2"]
|
|
466
|
+
|===
|
|
467
|
+
|Key |Type |Description |Default
|
|
468
|
+
|
|
469
|
+
|`enabled`
|
|
470
|
+
|boolean
|
|
471
|
+
|Enable/disable the extension
|
|
472
|
+
|`true`
|
|
473
|
+
|
|
474
|
+
|`quiet`
|
|
475
|
+
|boolean
|
|
476
|
+
|Suppress informational output
|
|
477
|
+
|`true`
|
|
478
|
+
|
|
479
|
+
|`output_dir`
|
|
480
|
+
|string
|
|
481
|
+
|Directory for Vale log files
|
|
482
|
+
|`'vale-output'`
|
|
483
|
+
|
|
484
|
+
|`config_file`
|
|
485
|
+
|string
|
|
486
|
+
|Path to Vale configuration file
|
|
487
|
+
|`'./.vale.ini'`
|
|
488
|
+
|
|
489
|
+
|`ignore_files`
|
|
490
|
+
|array
|
|
491
|
+
|Patterns for files to ignore
|
|
492
|
+
|`[]`
|
|
493
|
+
|
|
494
|
+
|`toolchain_config_path`
|
|
495
|
+
|string
|
|
496
|
+
|Path to toolchain config with additional ignores
|
|
497
|
+
|`'./toolchain-config.ini'`
|
|
498
|
+
|
|
499
|
+
|`max_logs`
|
|
500
|
+
|number
|
|
501
|
+
|Maximum number of log files to keep
|
|
502
|
+
|`10`
|
|
503
|
+
|
|
504
|
+
|`list_limit`
|
|
505
|
+
|number
|
|
506
|
+
|Maximum files to list in verbose output
|
|
507
|
+
|`20`
|
|
508
|
+
|===
|
|
509
|
+
|
|
510
|
+
==== Playbook Configuration
|
|
511
|
+
|
|
512
|
+
[source,yaml]
|
|
513
|
+
----
|
|
514
|
+
- require: '@baiyibai-antora/extensions/vale-integration'
|
|
515
|
+
vale:
|
|
516
|
+
enabled: true
|
|
517
|
+
quiet: false
|
|
518
|
+
output_dir: 'vale-output'
|
|
519
|
+
config_file: './vale-rules/.vale.ini'
|
|
520
|
+
ignore_files:
|
|
521
|
+
- 'partials/generated'
|
|
522
|
+
toolchain_config_path: './toolchain-config.ini'
|
|
523
|
+
max_logs: 10
|
|
524
|
+
----
|
|
525
|
+
|
|
526
|
+
[[asciidoctorconfig]]
|
|
527
|
+
=== asciidoctorconfig
|
|
528
|
+
|
|
529
|
+
Copies `.asciidoctorconfig.adoc` and `.asciidoctorconfig` files from content catalog to project root.
|
|
530
|
+
|
|
531
|
+
==== Configuration
|
|
532
|
+
|
|
533
|
+
[cols="2,1,3,2"]
|
|
534
|
+
|===
|
|
535
|
+
|Key |Type |Description |Default
|
|
536
|
+
|
|
537
|
+
|`enabled`
|
|
538
|
+
|boolean
|
|
539
|
+
|Enable/disable the extension
|
|
540
|
+
|`true`
|
|
541
|
+
|
|
542
|
+
|`quiet`
|
|
543
|
+
|boolean
|
|
544
|
+
|Suppress informational output
|
|
545
|
+
|`true`
|
|
546
|
+
|
|
547
|
+
|`version`
|
|
548
|
+
|string
|
|
549
|
+
|Version prefix for resource ID (e.g., `'1.0'`)
|
|
550
|
+
|`''`
|
|
551
|
+
|
|
552
|
+
|`component`
|
|
553
|
+
|string
|
|
554
|
+
|Component containing config files
|
|
555
|
+
|`'asciidoctorconfig'`
|
|
556
|
+
|
|
557
|
+
|`module`
|
|
558
|
+
|string
|
|
559
|
+
|Module containing config files
|
|
560
|
+
|`'ROOT'`
|
|
561
|
+
|
|
562
|
+
|`location`
|
|
563
|
+
|string
|
|
564
|
+
|Location family for config files
|
|
565
|
+
|`'partial$'`
|
|
566
|
+
|
|
567
|
+
|`asciidoctorconfig_adoc_filename`
|
|
568
|
+
|string
|
|
569
|
+
|Source filename for `.asciidoctorconfig.adoc`
|
|
570
|
+
|_(disabled)_
|
|
571
|
+
|
|
572
|
+
|`asciidoctorconfig_filename`
|
|
573
|
+
|string
|
|
574
|
+
|Source filename for `.asciidoctorconfig`
|
|
575
|
+
|_(disabled)_
|
|
576
|
+
|===
|
|
577
|
+
|
|
578
|
+
==== Playbook Configuration
|
|
579
|
+
|
|
580
|
+
[source,yaml]
|
|
581
|
+
----
|
|
582
|
+
- require: '@baiyibai-antora/extensions/asciidoctorconfig'
|
|
583
|
+
asciidoctorconfig:
|
|
584
|
+
enabled: true
|
|
585
|
+
quiet: false
|
|
586
|
+
component: 'asciidoctorconfig'
|
|
587
|
+
module: 'ROOT'
|
|
588
|
+
location: 'partial$'
|
|
589
|
+
asciidoctorconfig_adoc_filename: 'asciidoctorconfig.adoc'
|
|
590
|
+
asciidoctorconfig_filename: 'asciidoctorconfig'
|
|
591
|
+
----
|
|
592
|
+
|
|
593
|
+
== Vendorization
|
|
594
|
+
|
|
595
|
+
To vendorize extensions into your project:
|
|
596
|
+
|
|
597
|
+
[source,bash]
|
|
598
|
+
----
|
|
599
|
+
# Copy the dist folder to your project
|
|
600
|
+
cp -r node_modules/@baiyibai-antora/extensions/dist ./lib/docs-extensions
|
|
601
|
+
|
|
602
|
+
# Update your playbook to use local paths
|
|
603
|
+
----
|
|
604
|
+
|
|
605
|
+
[source,yaml]
|
|
606
|
+
----
|
|
607
|
+
antora:
|
|
608
|
+
extensions:
|
|
609
|
+
- require: './lib/docs-extensions/collector-writer'
|
|
610
|
+
collectorWriter:
|
|
611
|
+
enabled: true
|
|
612
|
+
----
|
|
613
|
+
|
|
614
|
+
== Development
|
|
615
|
+
|
|
616
|
+
=== Building
|
|
617
|
+
|
|
618
|
+
[source,bash]
|
|
619
|
+
----
|
|
620
|
+
npm install
|
|
621
|
+
npm run build
|
|
622
|
+
----
|
|
623
|
+
|
|
624
|
+
=== Project Structure
|
|
625
|
+
|
|
626
|
+
[source]
|
|
627
|
+
----
|
|
628
|
+
baiyibai-extensions/
|
|
629
|
+
├── package.json
|
|
630
|
+
├── tsconfig.json
|
|
631
|
+
├── README.adoc
|
|
632
|
+
├── src/
|
|
633
|
+
│ └── extensions/
|
|
634
|
+
│ ├── collector-writer/
|
|
635
|
+
│ ├── assembler-ruby-preflight/
|
|
636
|
+
│ ├── assembler-rename-pdf/
|
|
637
|
+
│ ├── external-asset-downloader/
|
|
638
|
+
│ ├── vale-integration/
|
|
639
|
+
│ └── asciidoctorconfig/
|
|
640
|
+
└── dist/ # Built output
|
|
641
|
+
----
|
|
642
|
+
|
|
643
|
+
== License
|
|
644
|
+
|
|
645
|
+
MIT
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @baiyibai-antora/docs-extensions - asciidoctorconfig
|
|
3
|
+
*
|
|
4
|
+
* Copies .asciidoctorconfig.adoc and .asciidoctorconfig files from the content
|
|
5
|
+
* catalog to the project root for AsciiDoctor tooling.
|
|
6
|
+
*
|
|
7
|
+
* Configuration in antora-playbook.yml:
|
|
8
|
+
*
|
|
9
|
+
* antora:
|
|
10
|
+
* extensions:
|
|
11
|
+
* - require: '@baiyibai-antora/docs-extensions/asciidoc-extensions/asciidoctorconfig'
|
|
12
|
+
* asciidoctorconfig:
|
|
13
|
+
* enabled: true
|
|
14
|
+
* quiet: false
|
|
15
|
+
* version: ''
|
|
16
|
+
* component: 'asciidoctorconfig'
|
|
17
|
+
* module: 'ROOT'
|
|
18
|
+
* location: 'partial$'
|
|
19
|
+
* asciidoctorconfig_adoc_filename: 'asciidoctorconfig.adoc'
|
|
20
|
+
* asciidoctorconfig_filename: 'asciidoctorconfig'
|
|
21
|
+
*/
|
|
22
|
+
interface AsciidoctorconfigConfig {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
quiet: boolean;
|
|
25
|
+
version: string;
|
|
26
|
+
component: string;
|
|
27
|
+
module: string;
|
|
28
|
+
location: string;
|
|
29
|
+
asciidoctorconfig_adoc_filename: string | undefined;
|
|
30
|
+
asciidoctorconfig_filename: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
interface AntoraLogger {
|
|
33
|
+
debug?: (msg: string) => void;
|
|
34
|
+
info?: (msg: string) => void;
|
|
35
|
+
warn?: (msg: string) => void;
|
|
36
|
+
error?: (msg: string) => void;
|
|
37
|
+
}
|
|
38
|
+
interface ExtensionEntry {
|
|
39
|
+
require?: string;
|
|
40
|
+
asciidoctorconfig?: Partial<AsciidoctorconfigConfig>;
|
|
41
|
+
}
|
|
42
|
+
interface Playbook {
|
|
43
|
+
dir?: string;
|
|
44
|
+
antora?: {
|
|
45
|
+
extensions?: ExtensionEntry[];
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
interface VirtualFile {
|
|
49
|
+
src?: {
|
|
50
|
+
component?: string;
|
|
51
|
+
module?: string;
|
|
52
|
+
family?: string;
|
|
53
|
+
relative?: string;
|
|
54
|
+
basename?: string;
|
|
55
|
+
};
|
|
56
|
+
contents: Buffer | Uint8Array;
|
|
57
|
+
}
|
|
58
|
+
interface ContentCatalog {
|
|
59
|
+
getFiles: () => VirtualFile[];
|
|
60
|
+
resolveResource: (resourceId: string, context?: unknown) => VirtualFile | undefined;
|
|
61
|
+
}
|
|
62
|
+
interface Registry {
|
|
63
|
+
getLogger?: (name: string) => AntoraLogger;
|
|
64
|
+
once: (event: string, callback: (context: {
|
|
65
|
+
playbook: Playbook;
|
|
66
|
+
contentCatalog?: ContentCatalog;
|
|
67
|
+
}) => Promise<void>) => void;
|
|
68
|
+
}
|
|
69
|
+
export declare function register(context: Registry): void;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/asciidoctorconfig/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,+BAA+B,EAAE,MAAM,GAAG,SAAS,CAAC;IACpD,0BAA0B,EAAE,MAAM,GAAG,SAAS,CAAC;CAChD;AAUD,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AAED,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACtD;AAED,UAAU,QAAQ;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;KAC/B,CAAC;CACH;AAED,UAAU,WAAW;IACnB,GAAG,CAAC,EAAE;QACJ,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC;CAC/B;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,WAAW,EAAE,CAAC;IAC9B,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,WAAW,GAAG,SAAS,CAAC;CACrF;AAED,UAAU,QAAQ;IAChB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,CAAC;IAC3C,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,cAAc,CAAC,EAAE,cAAc,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CAC9H;AAoID,wBAAgB,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI,CA8DhD"}
|