@asciidoctor/core 4.0.2 → 4.0.3
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/build/browser/index.js +148 -6
- package/build/node/index.cjs +148 -6
- package/package.json +2 -1
- package/src/document.js +4 -0
- package/src/extensions.js +143 -5
- package/src/index.js +4 -0
- package/types/extensions.d.ts +390 -14
- package/types/index.d.cts +4 -0
- package/types/index.d.ts +4 -0
package/build/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var version = "4.0.
|
|
1
|
+
var version = "4.0.3";
|
|
2
2
|
const packageJson = {
|
|
3
3
|
version: version};
|
|
4
4
|
|
|
@@ -13515,6 +13515,30 @@ function _uniform(str, chr, len) {
|
|
|
13515
13515
|
* @typedef {ProcessorDslInterface & { prefer(): void; prepend(): void }} DocumentProcessorDslInterface
|
|
13516
13516
|
*/
|
|
13517
13517
|
|
|
13518
|
+
/**
|
|
13519
|
+
* DSL interface for preprocessors.
|
|
13520
|
+
*
|
|
13521
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13522
|
+
* process(fn: (this: PreprocessorDslInterface, document: Document, reader: Reader) => Reader | void): void;
|
|
13523
|
+
* }} PreprocessorDslInterface
|
|
13524
|
+
*/
|
|
13525
|
+
|
|
13526
|
+
/**
|
|
13527
|
+
* DSL interface for tree processors.
|
|
13528
|
+
*
|
|
13529
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13530
|
+
* process(fn: (this: TreeProcessorDslInterface, document: Document) => Document | void): void;
|
|
13531
|
+
* }} TreeProcessorDslInterface
|
|
13532
|
+
*/
|
|
13533
|
+
|
|
13534
|
+
/**
|
|
13535
|
+
* DSL interface for postprocessors.
|
|
13536
|
+
*
|
|
13537
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13538
|
+
* process(fn: (this: PostprocessorDslInterface, document: Document, output: string) => string): void;
|
|
13539
|
+
* }} PostprocessorDslInterface
|
|
13540
|
+
*/
|
|
13541
|
+
|
|
13518
13542
|
/**
|
|
13519
13543
|
* DSL interface for syntax processors (BlockProcessor, BlockMacroProcessor, InlineMacroProcessor).
|
|
13520
13544
|
*
|
|
@@ -13535,28 +13559,35 @@ function _uniform(str, chr, len) {
|
|
|
13535
13559
|
/**
|
|
13536
13560
|
* DSL interface for include processors.
|
|
13537
13561
|
*
|
|
13538
|
-
* @typedef {DocumentProcessorDslInterface & {
|
|
13562
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13539
13563
|
* handles(fn: (target: string) => boolean): void;
|
|
13540
13564
|
* handles(fn: (doc: Document, target: string) => boolean): void;
|
|
13565
|
+
* process(fn: (this: IncludeProcessorDslInterface, document: Document, reader: Reader, target: string, attributes: Record<string, string>) => void): void;
|
|
13541
13566
|
* }} IncludeProcessorDslInterface
|
|
13542
13567
|
*/
|
|
13543
13568
|
|
|
13544
13569
|
/**
|
|
13545
13570
|
* DSL interface for docinfo processors.
|
|
13546
13571
|
*
|
|
13547
|
-
* @typedef {DocumentProcessorDslInterface & {
|
|
13572
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13548
13573
|
* atLocation(value: string): void;
|
|
13574
|
+
* process(fn: (this: DocinfoProcessorDslInterface, document: Document) => string): void;
|
|
13549
13575
|
* }} DocinfoProcessorDslInterface
|
|
13550
13576
|
*/
|
|
13551
13577
|
|
|
13552
13578
|
/**
|
|
13553
13579
|
* DSL interface for block processors.
|
|
13554
13580
|
*
|
|
13555
|
-
*
|
|
13581
|
+
* The `process` callback is bound to the processor instance, so `this` inside it
|
|
13582
|
+
* (and inside the registration function) exposes the `createBlock` helpers.
|
|
13583
|
+
*
|
|
13584
|
+
* @typedef {Omit<SyntaxProcessorDslInterface, 'process'> & {
|
|
13556
13585
|
* contexts(...value: (string | string[])[]): void;
|
|
13557
13586
|
* onContexts(...value: (string | string[])[]): void;
|
|
13558
13587
|
* onContext(...value: (string | string[])[]): void;
|
|
13559
13588
|
* bindTo(...value: (string | string[])[]): void;
|
|
13589
|
+
* createBlock(parent: AbstractBlock, context: string, source?: string | string[] | null, attrs?: object, opts?: object): Block;
|
|
13590
|
+
* process(fn: (this: BlockProcessorDslInterface, parent: AbstractBlock, reader: Reader, attributes: Record<string, unknown>) => AbstractBlock | void): void;
|
|
13560
13591
|
* }} BlockProcessorDslInterface
|
|
13561
13592
|
*/
|
|
13562
13593
|
|
|
@@ -13566,14 +13597,31 @@ function _uniform(str, chr, len) {
|
|
|
13566
13597
|
* @typedef {SyntaxProcessorDslInterface} MacroProcessorDslInterface
|
|
13567
13598
|
*/
|
|
13568
13599
|
|
|
13600
|
+
/**
|
|
13601
|
+
* DSL interface for block macro processors.
|
|
13602
|
+
*
|
|
13603
|
+
* The `process` callback is bound to the processor instance, so `this` inside it
|
|
13604
|
+
* (and inside the registration function) exposes the `createBlock` helpers.
|
|
13605
|
+
*
|
|
13606
|
+
* @typedef {Omit<MacroProcessorDslInterface, 'process'> & {
|
|
13607
|
+
* createBlock(parent: AbstractBlock, context: string, source?: string | string[] | null, attrs?: object, opts?: object): Block;
|
|
13608
|
+
* process(fn: (this: BlockMacroProcessorDslInterface, parent: AbstractBlock, target: string, attributes: Record<string, unknown>) => AbstractBlock | void): void;
|
|
13609
|
+
* }} BlockMacroProcessorDslInterface
|
|
13610
|
+
*/
|
|
13611
|
+
|
|
13569
13612
|
/**
|
|
13570
13613
|
* DSL interface for inline macro processors.
|
|
13571
13614
|
*
|
|
13572
|
-
*
|
|
13615
|
+
* The `process` callback is bound to the processor instance, so `this` inside it
|
|
13616
|
+
* (and inside the registration function) exposes the `createInline` helper.
|
|
13617
|
+
*
|
|
13618
|
+
* @typedef {Omit<MacroProcessorDslInterface, 'process'> & {
|
|
13573
13619
|
* format(value: string): void;
|
|
13574
13620
|
* matchFormat(value: string): void;
|
|
13575
13621
|
* usingFormat(value: string): void;
|
|
13576
13622
|
* match(value: RegExp): void;
|
|
13623
|
+
* createInline(parent: AbstractBlock, context: string, text: string, opts?: object): Inline;
|
|
13624
|
+
* process(fn: (this: InlineMacroProcessorDslInterface, parent: AbstractBlock, target: string, attributes: Record<string, unknown>) => Inline | void): void;
|
|
13577
13625
|
* }} InlineMacroProcessorDslInterface
|
|
13578
13626
|
*/
|
|
13579
13627
|
|
|
@@ -14294,7 +14342,15 @@ class IncludeProcessor extends Processor {
|
|
|
14294
14342
|
}
|
|
14295
14343
|
|
|
14296
14344
|
/**
|
|
14297
|
-
*
|
|
14345
|
+
* Decide whether this include processor handles the given target.
|
|
14346
|
+
*
|
|
14347
|
+
* Override this method in a subclass. The override may accept either just the
|
|
14348
|
+
* target string (Ruby-style, arity 1) or both the document and the target
|
|
14349
|
+
* (arity 2) — an arity-1 override is adapted at registration time so the
|
|
14350
|
+
* parser can always invoke it as `handles(doc, target)`. The first parameter
|
|
14351
|
+
* is therefore typed `Document | string` so both override shapes type-check.
|
|
14352
|
+
*
|
|
14353
|
+
* @param {Document|string} doc - The document being parsed, or (for a Ruby-style arity-1 override) the include target.
|
|
14298
14354
|
* @param {string} target - The target of the include directive.
|
|
14299
14355
|
* @returns {boolean} true if this processor handles the given target.
|
|
14300
14356
|
*/
|
|
@@ -14662,6 +14718,14 @@ class Registry {
|
|
|
14662
14718
|
* this.process(function (doc, reader) { ... })
|
|
14663
14719
|
* })
|
|
14664
14720
|
*
|
|
14721
|
+
* @overload
|
|
14722
|
+
* @param {typeof Preprocessor} processor - A Preprocessor subclass or instance.
|
|
14723
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14724
|
+
*
|
|
14725
|
+
* @overload
|
|
14726
|
+
* @param {(this: PreprocessorDslInterface) => void} fn - Registration function bound to the preprocessor DSL.
|
|
14727
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14728
|
+
*
|
|
14665
14729
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14666
14730
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14667
14731
|
*/
|
|
@@ -14695,6 +14759,14 @@ class Registry {
|
|
|
14695
14759
|
/**
|
|
14696
14760
|
* Register a TreeProcessor with the extension registry.
|
|
14697
14761
|
*
|
|
14762
|
+
* @overload
|
|
14763
|
+
* @param {typeof TreeProcessor} processor - A TreeProcessor subclass or instance.
|
|
14764
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14765
|
+
*
|
|
14766
|
+
* @overload
|
|
14767
|
+
* @param {(this: TreeProcessorDslInterface) => void} fn - Registration function bound to the tree processor DSL.
|
|
14768
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14769
|
+
*
|
|
14698
14770
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14699
14771
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14700
14772
|
*/
|
|
@@ -14748,6 +14820,14 @@ class Registry {
|
|
|
14748
14820
|
/**
|
|
14749
14821
|
* Register a Postprocessor with the extension registry.
|
|
14750
14822
|
*
|
|
14823
|
+
* @overload
|
|
14824
|
+
* @param {typeof Postprocessor} processor - A Postprocessor subclass or instance.
|
|
14825
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14826
|
+
*
|
|
14827
|
+
* @overload
|
|
14828
|
+
* @param {(this: PostprocessorDslInterface) => void} fn - Registration function bound to the postprocessor DSL.
|
|
14829
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14830
|
+
*
|
|
14751
14831
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14752
14832
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14753
14833
|
*/
|
|
@@ -14781,6 +14861,14 @@ class Registry {
|
|
|
14781
14861
|
/**
|
|
14782
14862
|
* Register an IncludeProcessor with the extension registry.
|
|
14783
14863
|
*
|
|
14864
|
+
* @overload
|
|
14865
|
+
* @param {typeof IncludeProcessor} processor - An IncludeProcessor subclass or instance.
|
|
14866
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14867
|
+
*
|
|
14868
|
+
* @overload
|
|
14869
|
+
* @param {(this: IncludeProcessorDslInterface) => void} fn - Registration function bound to the include processor DSL.
|
|
14870
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14871
|
+
*
|
|
14784
14872
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14785
14873
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14786
14874
|
*/
|
|
@@ -14819,6 +14907,14 @@ class Registry {
|
|
|
14819
14907
|
/**
|
|
14820
14908
|
* Register a DocinfoProcessor with the extension registry.
|
|
14821
14909
|
*
|
|
14910
|
+
* @overload
|
|
14911
|
+
* @param {typeof DocinfoProcessor} processor - A DocinfoProcessor subclass or instance.
|
|
14912
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14913
|
+
*
|
|
14914
|
+
* @overload
|
|
14915
|
+
* @param {(this: DocinfoProcessorDslInterface) => void} fn - Registration function bound to the docinfo processor DSL.
|
|
14916
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14917
|
+
*
|
|
14822
14918
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14823
14919
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14824
14920
|
*/
|
|
@@ -14886,6 +14982,20 @@ class Registry {
|
|
|
14886
14982
|
* this.process(function (parent, reader, attrs) { ... })
|
|
14887
14983
|
* })
|
|
14888
14984
|
*
|
|
14985
|
+
* @overload
|
|
14986
|
+
* @param {typeof BlockProcessor} processor - A BlockProcessor subclass.
|
|
14987
|
+
* @param {string} [name] - Optional explicit block name.
|
|
14988
|
+
* @returns {ProcessorExtension} an Extension proxy object.
|
|
14989
|
+
*
|
|
14990
|
+
* @overload
|
|
14991
|
+
* @param {string} name - The block name.
|
|
14992
|
+
* @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL.
|
|
14993
|
+
* @returns {ProcessorExtension} an Extension proxy object.
|
|
14994
|
+
*
|
|
14995
|
+
* @overload
|
|
14996
|
+
* @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL.
|
|
14997
|
+
* @returns {ProcessorExtension} an Extension proxy object.
|
|
14998
|
+
*
|
|
14889
14999
|
* @param {...*} args - Class constructor, instance, block function, or name + one of those.
|
|
14890
15000
|
* @returns {ProcessorExtension} an Extension proxy object.
|
|
14891
15001
|
*/
|
|
@@ -14936,6 +15046,20 @@ class Registry {
|
|
|
14936
15046
|
/**
|
|
14937
15047
|
* Register a BlockMacroProcessor with the extension registry.
|
|
14938
15048
|
*
|
|
15049
|
+
* @overload
|
|
15050
|
+
* @param {typeof BlockMacroProcessor} processor - A BlockMacroProcessor subclass.
|
|
15051
|
+
* @param {string} [name] - Optional explicit macro name.
|
|
15052
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15053
|
+
*
|
|
15054
|
+
* @overload
|
|
15055
|
+
* @param {string} name - The macro name.
|
|
15056
|
+
* @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL.
|
|
15057
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15058
|
+
*
|
|
15059
|
+
* @overload
|
|
15060
|
+
* @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL.
|
|
15061
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15062
|
+
*
|
|
14939
15063
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14940
15064
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14941
15065
|
*/
|
|
@@ -14991,6 +15115,20 @@ class Registry {
|
|
|
14991
15115
|
/**
|
|
14992
15116
|
* Register an InlineMacroProcessor with the extension registry.
|
|
14993
15117
|
*
|
|
15118
|
+
* @overload
|
|
15119
|
+
* @param {typeof InlineMacroProcessor} processor - An InlineMacroProcessor subclass.
|
|
15120
|
+
* @param {string} [name] - Optional explicit macro name.
|
|
15121
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15122
|
+
*
|
|
15123
|
+
* @overload
|
|
15124
|
+
* @param {string} name - The macro name.
|
|
15125
|
+
* @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL.
|
|
15126
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15127
|
+
*
|
|
15128
|
+
* @overload
|
|
15129
|
+
* @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL.
|
|
15130
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15131
|
+
*
|
|
14994
15132
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14995
15133
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14996
15134
|
*/
|
|
@@ -17300,6 +17438,10 @@ class Document extends AbstractBlock {
|
|
|
17300
17438
|
cell._innerDocument &&
|
|
17301
17439
|
cell._innerContent == null
|
|
17302
17440
|
) {
|
|
17441
|
+
// Recurse into the inner document first so that AsciiDoc cells
|
|
17442
|
+
// of any nested table have their content computed before the
|
|
17443
|
+
// inner document (and the nested table) is rendered.
|
|
17444
|
+
await this._convertAsciiDocCells(cell._innerDocument);
|
|
17303
17445
|
cell._innerContent = await cell._innerDocument.convert();
|
|
17304
17446
|
}
|
|
17305
17447
|
}
|
package/build/node/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ const node_fs = require('node:fs');
|
|
|
6
6
|
const path = require('node:path');
|
|
7
7
|
|
|
8
8
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
9
|
-
var version = "4.0.
|
|
9
|
+
var version = "4.0.3";
|
|
10
10
|
const packageJson = {
|
|
11
11
|
version: version};
|
|
12
12
|
|
|
@@ -13523,6 +13523,30 @@ function _uniform(str, chr, len) {
|
|
|
13523
13523
|
* @typedef {ProcessorDslInterface & { prefer(): void; prepend(): void }} DocumentProcessorDslInterface
|
|
13524
13524
|
*/
|
|
13525
13525
|
|
|
13526
|
+
/**
|
|
13527
|
+
* DSL interface for preprocessors.
|
|
13528
|
+
*
|
|
13529
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13530
|
+
* process(fn: (this: PreprocessorDslInterface, document: Document, reader: Reader) => Reader | void): void;
|
|
13531
|
+
* }} PreprocessorDslInterface
|
|
13532
|
+
*/
|
|
13533
|
+
|
|
13534
|
+
/**
|
|
13535
|
+
* DSL interface for tree processors.
|
|
13536
|
+
*
|
|
13537
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13538
|
+
* process(fn: (this: TreeProcessorDslInterface, document: Document) => Document | void): void;
|
|
13539
|
+
* }} TreeProcessorDslInterface
|
|
13540
|
+
*/
|
|
13541
|
+
|
|
13542
|
+
/**
|
|
13543
|
+
* DSL interface for postprocessors.
|
|
13544
|
+
*
|
|
13545
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13546
|
+
* process(fn: (this: PostprocessorDslInterface, document: Document, output: string) => string): void;
|
|
13547
|
+
* }} PostprocessorDslInterface
|
|
13548
|
+
*/
|
|
13549
|
+
|
|
13526
13550
|
/**
|
|
13527
13551
|
* DSL interface for syntax processors (BlockProcessor, BlockMacroProcessor, InlineMacroProcessor).
|
|
13528
13552
|
*
|
|
@@ -13543,28 +13567,35 @@ function _uniform(str, chr, len) {
|
|
|
13543
13567
|
/**
|
|
13544
13568
|
* DSL interface for include processors.
|
|
13545
13569
|
*
|
|
13546
|
-
* @typedef {DocumentProcessorDslInterface & {
|
|
13570
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13547
13571
|
* handles(fn: (target: string) => boolean): void;
|
|
13548
13572
|
* handles(fn: (doc: Document, target: string) => boolean): void;
|
|
13573
|
+
* process(fn: (this: IncludeProcessorDslInterface, document: Document, reader: Reader, target: string, attributes: Record<string, string>) => void): void;
|
|
13549
13574
|
* }} IncludeProcessorDslInterface
|
|
13550
13575
|
*/
|
|
13551
13576
|
|
|
13552
13577
|
/**
|
|
13553
13578
|
* DSL interface for docinfo processors.
|
|
13554
13579
|
*
|
|
13555
|
-
* @typedef {DocumentProcessorDslInterface & {
|
|
13580
|
+
* @typedef {Omit<DocumentProcessorDslInterface, 'process'> & {
|
|
13556
13581
|
* atLocation(value: string): void;
|
|
13582
|
+
* process(fn: (this: DocinfoProcessorDslInterface, document: Document) => string): void;
|
|
13557
13583
|
* }} DocinfoProcessorDslInterface
|
|
13558
13584
|
*/
|
|
13559
13585
|
|
|
13560
13586
|
/**
|
|
13561
13587
|
* DSL interface for block processors.
|
|
13562
13588
|
*
|
|
13563
|
-
*
|
|
13589
|
+
* The `process` callback is bound to the processor instance, so `this` inside it
|
|
13590
|
+
* (and inside the registration function) exposes the `createBlock` helpers.
|
|
13591
|
+
*
|
|
13592
|
+
* @typedef {Omit<SyntaxProcessorDslInterface, 'process'> & {
|
|
13564
13593
|
* contexts(...value: (string | string[])[]): void;
|
|
13565
13594
|
* onContexts(...value: (string | string[])[]): void;
|
|
13566
13595
|
* onContext(...value: (string | string[])[]): void;
|
|
13567
13596
|
* bindTo(...value: (string | string[])[]): void;
|
|
13597
|
+
* createBlock(parent: AbstractBlock, context: string, source?: string | string[] | null, attrs?: object, opts?: object): Block;
|
|
13598
|
+
* process(fn: (this: BlockProcessorDslInterface, parent: AbstractBlock, reader: Reader, attributes: Record<string, unknown>) => AbstractBlock | void): void;
|
|
13568
13599
|
* }} BlockProcessorDslInterface
|
|
13569
13600
|
*/
|
|
13570
13601
|
|
|
@@ -13574,14 +13605,31 @@ function _uniform(str, chr, len) {
|
|
|
13574
13605
|
* @typedef {SyntaxProcessorDslInterface} MacroProcessorDslInterface
|
|
13575
13606
|
*/
|
|
13576
13607
|
|
|
13608
|
+
/**
|
|
13609
|
+
* DSL interface for block macro processors.
|
|
13610
|
+
*
|
|
13611
|
+
* The `process` callback is bound to the processor instance, so `this` inside it
|
|
13612
|
+
* (and inside the registration function) exposes the `createBlock` helpers.
|
|
13613
|
+
*
|
|
13614
|
+
* @typedef {Omit<MacroProcessorDslInterface, 'process'> & {
|
|
13615
|
+
* createBlock(parent: AbstractBlock, context: string, source?: string | string[] | null, attrs?: object, opts?: object): Block;
|
|
13616
|
+
* process(fn: (this: BlockMacroProcessorDslInterface, parent: AbstractBlock, target: string, attributes: Record<string, unknown>) => AbstractBlock | void): void;
|
|
13617
|
+
* }} BlockMacroProcessorDslInterface
|
|
13618
|
+
*/
|
|
13619
|
+
|
|
13577
13620
|
/**
|
|
13578
13621
|
* DSL interface for inline macro processors.
|
|
13579
13622
|
*
|
|
13580
|
-
*
|
|
13623
|
+
* The `process` callback is bound to the processor instance, so `this` inside it
|
|
13624
|
+
* (and inside the registration function) exposes the `createInline` helper.
|
|
13625
|
+
*
|
|
13626
|
+
* @typedef {Omit<MacroProcessorDslInterface, 'process'> & {
|
|
13581
13627
|
* format(value: string): void;
|
|
13582
13628
|
* matchFormat(value: string): void;
|
|
13583
13629
|
* usingFormat(value: string): void;
|
|
13584
13630
|
* match(value: RegExp): void;
|
|
13631
|
+
* createInline(parent: AbstractBlock, context: string, text: string, opts?: object): Inline;
|
|
13632
|
+
* process(fn: (this: InlineMacroProcessorDslInterface, parent: AbstractBlock, target: string, attributes: Record<string, unknown>) => Inline | void): void;
|
|
13585
13633
|
* }} InlineMacroProcessorDslInterface
|
|
13586
13634
|
*/
|
|
13587
13635
|
|
|
@@ -14302,7 +14350,15 @@ class IncludeProcessor extends Processor {
|
|
|
14302
14350
|
}
|
|
14303
14351
|
|
|
14304
14352
|
/**
|
|
14305
|
-
*
|
|
14353
|
+
* Decide whether this include processor handles the given target.
|
|
14354
|
+
*
|
|
14355
|
+
* Override this method in a subclass. The override may accept either just the
|
|
14356
|
+
* target string (Ruby-style, arity 1) or both the document and the target
|
|
14357
|
+
* (arity 2) — an arity-1 override is adapted at registration time so the
|
|
14358
|
+
* parser can always invoke it as `handles(doc, target)`. The first parameter
|
|
14359
|
+
* is therefore typed `Document | string` so both override shapes type-check.
|
|
14360
|
+
*
|
|
14361
|
+
* @param {Document|string} doc - The document being parsed, or (for a Ruby-style arity-1 override) the include target.
|
|
14306
14362
|
* @param {string} target - The target of the include directive.
|
|
14307
14363
|
* @returns {boolean} true if this processor handles the given target.
|
|
14308
14364
|
*/
|
|
@@ -14670,6 +14726,14 @@ class Registry {
|
|
|
14670
14726
|
* this.process(function (doc, reader) { ... })
|
|
14671
14727
|
* })
|
|
14672
14728
|
*
|
|
14729
|
+
* @overload
|
|
14730
|
+
* @param {typeof Preprocessor} processor - A Preprocessor subclass or instance.
|
|
14731
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14732
|
+
*
|
|
14733
|
+
* @overload
|
|
14734
|
+
* @param {(this: PreprocessorDslInterface) => void} fn - Registration function bound to the preprocessor DSL.
|
|
14735
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14736
|
+
*
|
|
14673
14737
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14674
14738
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14675
14739
|
*/
|
|
@@ -14703,6 +14767,14 @@ class Registry {
|
|
|
14703
14767
|
/**
|
|
14704
14768
|
* Register a TreeProcessor with the extension registry.
|
|
14705
14769
|
*
|
|
14770
|
+
* @overload
|
|
14771
|
+
* @param {typeof TreeProcessor} processor - A TreeProcessor subclass or instance.
|
|
14772
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14773
|
+
*
|
|
14774
|
+
* @overload
|
|
14775
|
+
* @param {(this: TreeProcessorDslInterface) => void} fn - Registration function bound to the tree processor DSL.
|
|
14776
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14777
|
+
*
|
|
14706
14778
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14707
14779
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14708
14780
|
*/
|
|
@@ -14756,6 +14828,14 @@ class Registry {
|
|
|
14756
14828
|
/**
|
|
14757
14829
|
* Register a Postprocessor with the extension registry.
|
|
14758
14830
|
*
|
|
14831
|
+
* @overload
|
|
14832
|
+
* @param {typeof Postprocessor} processor - A Postprocessor subclass or instance.
|
|
14833
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14834
|
+
*
|
|
14835
|
+
* @overload
|
|
14836
|
+
* @param {(this: PostprocessorDslInterface) => void} fn - Registration function bound to the postprocessor DSL.
|
|
14837
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14838
|
+
*
|
|
14759
14839
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14760
14840
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14761
14841
|
*/
|
|
@@ -14789,6 +14869,14 @@ class Registry {
|
|
|
14789
14869
|
/**
|
|
14790
14870
|
* Register an IncludeProcessor with the extension registry.
|
|
14791
14871
|
*
|
|
14872
|
+
* @overload
|
|
14873
|
+
* @param {typeof IncludeProcessor} processor - An IncludeProcessor subclass or instance.
|
|
14874
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14875
|
+
*
|
|
14876
|
+
* @overload
|
|
14877
|
+
* @param {(this: IncludeProcessorDslInterface) => void} fn - Registration function bound to the include processor DSL.
|
|
14878
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14879
|
+
*
|
|
14792
14880
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14793
14881
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14794
14882
|
*/
|
|
@@ -14827,6 +14915,14 @@ class Registry {
|
|
|
14827
14915
|
/**
|
|
14828
14916
|
* Register a DocinfoProcessor with the extension registry.
|
|
14829
14917
|
*
|
|
14918
|
+
* @overload
|
|
14919
|
+
* @param {typeof DocinfoProcessor} processor - A DocinfoProcessor subclass or instance.
|
|
14920
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14921
|
+
*
|
|
14922
|
+
* @overload
|
|
14923
|
+
* @param {(this: DocinfoProcessorDslInterface) => void} fn - Registration function bound to the docinfo processor DSL.
|
|
14924
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14925
|
+
*
|
|
14830
14926
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14831
14927
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14832
14928
|
*/
|
|
@@ -14894,6 +14990,20 @@ class Registry {
|
|
|
14894
14990
|
* this.process(function (parent, reader, attrs) { ... })
|
|
14895
14991
|
* })
|
|
14896
14992
|
*
|
|
14993
|
+
* @overload
|
|
14994
|
+
* @param {typeof BlockProcessor} processor - A BlockProcessor subclass.
|
|
14995
|
+
* @param {string} [name] - Optional explicit block name.
|
|
14996
|
+
* @returns {ProcessorExtension} an Extension proxy object.
|
|
14997
|
+
*
|
|
14998
|
+
* @overload
|
|
14999
|
+
* @param {string} name - The block name.
|
|
15000
|
+
* @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL.
|
|
15001
|
+
* @returns {ProcessorExtension} an Extension proxy object.
|
|
15002
|
+
*
|
|
15003
|
+
* @overload
|
|
15004
|
+
* @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL.
|
|
15005
|
+
* @returns {ProcessorExtension} an Extension proxy object.
|
|
15006
|
+
*
|
|
14897
15007
|
* @param {...*} args - Class constructor, instance, block function, or name + one of those.
|
|
14898
15008
|
* @returns {ProcessorExtension} an Extension proxy object.
|
|
14899
15009
|
*/
|
|
@@ -14944,6 +15054,20 @@ class Registry {
|
|
|
14944
15054
|
/**
|
|
14945
15055
|
* Register a BlockMacroProcessor with the extension registry.
|
|
14946
15056
|
*
|
|
15057
|
+
* @overload
|
|
15058
|
+
* @param {typeof BlockMacroProcessor} processor - A BlockMacroProcessor subclass.
|
|
15059
|
+
* @param {string} [name] - Optional explicit macro name.
|
|
15060
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15061
|
+
*
|
|
15062
|
+
* @overload
|
|
15063
|
+
* @param {string} name - The macro name.
|
|
15064
|
+
* @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL.
|
|
15065
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15066
|
+
*
|
|
15067
|
+
* @overload
|
|
15068
|
+
* @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL.
|
|
15069
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15070
|
+
*
|
|
14947
15071
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
14948
15072
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
14949
15073
|
*/
|
|
@@ -14999,6 +15123,20 @@ class Registry {
|
|
|
14999
15123
|
/**
|
|
15000
15124
|
* Register an InlineMacroProcessor with the extension registry.
|
|
15001
15125
|
*
|
|
15126
|
+
* @overload
|
|
15127
|
+
* @param {typeof InlineMacroProcessor} processor - An InlineMacroProcessor subclass.
|
|
15128
|
+
* @param {string} [name] - Optional explicit macro name.
|
|
15129
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15130
|
+
*
|
|
15131
|
+
* @overload
|
|
15132
|
+
* @param {string} name - The macro name.
|
|
15133
|
+
* @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL.
|
|
15134
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15135
|
+
*
|
|
15136
|
+
* @overload
|
|
15137
|
+
* @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL.
|
|
15138
|
+
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15139
|
+
*
|
|
15002
15140
|
* @param {...*} args - Class constructor, instance, or block function.
|
|
15003
15141
|
* @returns {ProcessorExtension} the Extension stored in the registry.
|
|
15004
15142
|
*/
|
|
@@ -17308,6 +17446,10 @@ class Document extends AbstractBlock {
|
|
|
17308
17446
|
cell._innerDocument &&
|
|
17309
17447
|
cell._innerContent == null
|
|
17310
17448
|
) {
|
|
17449
|
+
// Recurse into the inner document first so that AsciiDoc cells
|
|
17450
|
+
// of any nested table have their content computed before the
|
|
17451
|
+
// inner document (and the nested table) is rendered.
|
|
17452
|
+
await this._convertAsciiDocCells(cell._innerDocument);
|
|
17311
17453
|
cell._innerContent = await cell._innerDocument.convert();
|
|
17312
17454
|
}
|
|
17313
17455
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asciidoctor/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Asciidoctor.js: AsciiDoc in JavaScript powered by Asciidoctor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/node/index.cjs",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"test:deno": "deno test --allow-env --no-check --allow-read --allow-sys --allow-write --allow-run --allow-net test/*.test.js",
|
|
32
32
|
"test:coverage": "node --test --experimental-test-coverage --test-coverage-include='src/**' test/**.test.js",
|
|
33
33
|
"test:browser": "vitest run --config vitest.browser.config.js",
|
|
34
|
+
"test:types": "tsc -p test/types/tsconfig.json",
|
|
34
35
|
"lint": "biome lint src test",
|
|
35
36
|
"format": "biome format --write src test",
|
|
36
37
|
"check": "biome check src test"
|
package/src/document.js
CHANGED
|
@@ -1594,6 +1594,10 @@ export class Document extends AbstractBlock {
|
|
|
1594
1594
|
cell._innerDocument &&
|
|
1595
1595
|
cell._innerContent == null
|
|
1596
1596
|
) {
|
|
1597
|
+
// Recurse into the inner document first so that AsciiDoc cells
|
|
1598
|
+
// of any nested table have their content computed before the
|
|
1599
|
+
// inner document (and the nested table) is rendered.
|
|
1600
|
+
await this._convertAsciiDocCells(cell._innerDocument)
|
|
1597
1601
|
cell._innerContent = await cell._innerDocument.convert()
|
|
1598
1602
|
}
|
|
1599
1603
|
}
|