@asciidoctor/core 3.0.3 → 4.0.0-alpha.1
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/README.md +42 -10
- package/build/browser/index.js +24154 -0
- package/build/node/index.cjs +24735 -0
- package/{dist/css/asciidoctor.css → data/asciidoctor-default.css} +54 -53
- package/package.json +53 -100
- package/src/abstract_block.js +849 -0
- package/src/abstract_node.js +954 -0
- package/src/attribute_entry.js +12 -0
- package/src/attribute_list.js +380 -0
- package/src/block.js +168 -0
- package/src/browser/asset.js +22 -0
- package/src/browser/reader.js +138 -0
- package/src/browser.js +121 -0
- package/src/callouts.js +85 -0
- package/src/compliance.js +54 -0
- package/src/constants.js +665 -0
- package/src/convert.js +370 -0
- package/src/converter/composite.js +83 -0
- package/src/converter/docbook5.js +1031 -0
- package/src/converter/html5.js +1899 -0
- package/src/converter/manpage.js +935 -0
- package/src/converter/template.js +459 -0
- package/src/converter.js +478 -0
- package/src/data/stylesheet-data.js +2 -0
- package/src/document.js +2134 -0
- package/src/extensions.js +1952 -0
- package/src/footnote.js +28 -0
- package/src/helpers.js +355 -0
- package/src/index.js +138 -0
- package/src/inline.js +158 -0
- package/src/list.js +240 -0
- package/src/load.js +276 -0
- package/src/logging.js +526 -0
- package/src/parser.js +3661 -0
- package/src/path_resolver.js +472 -0
- package/src/reader.js +1755 -0
- package/src/rx.js +829 -0
- package/src/section.js +354 -0
- package/src/stylesheets.js +30 -0
- package/src/substitutors.js +2241 -0
- package/src/syntaxHighlighter/highlightjs.js +90 -0
- package/src/syntaxHighlighter/html_pipeline.js +33 -0
- package/src/syntax_highlighter.js +304 -0
- package/src/table.js +952 -0
- package/src/timings.js +78 -0
- package/types/abstract_block.d.ts +343 -0
- package/types/abstract_node.d.ts +471 -0
- package/types/attribute_entry.d.ts +7 -0
- package/types/attribute_list.d.ts +52 -0
- package/types/block.d.ts +55 -0
- package/types/browser/asset.d.ts +7 -0
- package/types/browser/reader.d.ts +29 -0
- package/types/callouts.d.ts +36 -0
- package/types/compliance.d.ts +23 -0
- package/types/constants.d.ts +268 -0
- package/types/convert.d.ts +34 -0
- package/types/converter/composite.d.ts +20 -0
- package/types/converter/docbook5.d.ts +41 -0
- package/types/converter/html5.d.ts +51 -0
- package/types/converter/manpage.d.ts +59 -0
- package/types/converter/template.d.ts +83 -0
- package/types/converter.d.ts +150 -0
- package/types/data/stylesheet-data.d.ts +2 -0
- package/types/document.d.ts +495 -0
- package/types/extensions.d.ts +876 -0
- package/types/footnote.d.ts +18 -0
- package/types/helpers.d.ts +146 -0
- package/types/index.d.ts +73 -3731
- package/types/inline.d.ts +69 -0
- package/types/list.d.ts +114 -0
- package/types/load.d.ts +39 -0
- package/types/logging.d.ts +187 -0
- package/types/parser.d.ts +114 -0
- package/types/path_resolver.d.ts +103 -0
- package/types/reader.d.ts +184 -0
- package/types/rx.d.ts +513 -0
- package/types/section.d.ts +122 -0
- package/types/stylesheets.d.ts +10 -0
- package/types/substitutors.d.ts +208 -0
- package/types/syntaxHighlighter/highlightjs.d.ts +33 -0
- package/types/syntaxHighlighter/html_pipeline.d.ts +16 -0
- package/types/syntax_highlighter.d.ts +167 -0
- package/types/table.d.ts +231 -0
- package/types/timings.d.ts +25 -0
- package/types/tsconfig.json +9 -0
- package/LICENSE +0 -21
- package/dist/browser/asciidoctor.js +0 -47654
- package/dist/browser/asciidoctor.min.js +0 -1452
- package/dist/graalvm/asciidoctor.js +0 -47402
- package/dist/node/asciidoctor.cjs +0 -21567
- package/dist/node/asciidoctor.js +0 -23037
package/src/timings.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// ESM conversion of timings.rb
|
|
2
|
+
//
|
|
3
|
+
// Ruby-to-JavaScript notes:
|
|
4
|
+
// - Process.clock_gettime(CLOCK_MONOTONIC) → performance.now() (ms, not s).
|
|
5
|
+
// All stored values are in milliseconds.
|
|
6
|
+
// - print_report writes to a stream; in JS the default is console.log.
|
|
7
|
+
// Pass a { write(line) } object to customise the output destination.
|
|
8
|
+
|
|
9
|
+
export class Timings {
|
|
10
|
+
static create() {
|
|
11
|
+
return new Timings()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
this._log = {}
|
|
16
|
+
this._timers = {}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
start(key) {
|
|
20
|
+
this._timers[key] = this._now()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
record(key) {
|
|
24
|
+
this._log[key] = this._now() - (this._timers[key] ?? 0)
|
|
25
|
+
delete this._timers[key]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
time(...keys) {
|
|
29
|
+
const total = keys.reduce((sum, key) => sum + (this._log[key] || 0), 0)
|
|
30
|
+
return total > 0 ? total : null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
read() {
|
|
34
|
+
return this.time('read')
|
|
35
|
+
}
|
|
36
|
+
parse() {
|
|
37
|
+
return this.time('parse')
|
|
38
|
+
}
|
|
39
|
+
readParse() {
|
|
40
|
+
return this.time('read', 'parse')
|
|
41
|
+
}
|
|
42
|
+
convert() {
|
|
43
|
+
return this.time('convert')
|
|
44
|
+
}
|
|
45
|
+
readParseConvert() {
|
|
46
|
+
return this.time('read', 'parse', 'convert')
|
|
47
|
+
}
|
|
48
|
+
write() {
|
|
49
|
+
return this.time('write')
|
|
50
|
+
}
|
|
51
|
+
total() {
|
|
52
|
+
return this.time('read', 'parse', 'convert', 'write')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Print a summary report.
|
|
57
|
+
* @param {{ write?: (s: string) => void, log?: (s: string) => void }} [out=console] - Output sink.
|
|
58
|
+
* @param {string|null} [subject=null] - Optional label for the input file.
|
|
59
|
+
*/
|
|
60
|
+
printReport(out = console, subject = null) {
|
|
61
|
+
const writeln =
|
|
62
|
+
typeof out.write === 'function'
|
|
63
|
+
? (s) => out.write(`${s}\n`)
|
|
64
|
+
: (s) => out.log(s)
|
|
65
|
+
if (subject) writeln(`Input file: ${subject}`)
|
|
66
|
+
writeln(
|
|
67
|
+
` Time to read and parse source: ${(this.readParse() ?? 0).toFixed(5)}`
|
|
68
|
+
)
|
|
69
|
+
writeln(` Time to convert document: ${(this.convert() ?? 0).toFixed(5)}`)
|
|
70
|
+
writeln(
|
|
71
|
+
` Total time (read, parse and convert): ${(this.readParseConvert() ?? 0).toFixed(5)}`
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_now() {
|
|
76
|
+
return typeof performance !== 'undefined' ? performance.now() : Date.now()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @template {string | any[]} [TContent=string]
|
|
3
|
+
* @abstract
|
|
4
|
+
*/
|
|
5
|
+
export abstract class AbstractBlock<TContent extends string | any[] = string> extends AbstractNode {
|
|
6
|
+
/**
|
|
7
|
+
* @param {AbstractBlock} parent
|
|
8
|
+
* @param {string} context
|
|
9
|
+
* @param {object} [opts={}]
|
|
10
|
+
*/
|
|
11
|
+
constructor(parent: AbstractBlock, context: string, opts?: object);
|
|
12
|
+
/** @type {string[]} */
|
|
13
|
+
subs: string[];
|
|
14
|
+
/** @type {string[]|null} */
|
|
15
|
+
defaultSubs: string[] | null;
|
|
16
|
+
/** @type {string|number|null} */
|
|
17
|
+
numeral: string | number | null;
|
|
18
|
+
/** @type {Cursor|null} */
|
|
19
|
+
sourceLocation: Cursor | null;
|
|
20
|
+
/**
|
|
21
|
+
* Describes the type of content this block accepts and how it should be converted. Acceptable values are:
|
|
22
|
+
* - `compound` - this block contains other blocks
|
|
23
|
+
* - `simple` - this block holds a paragraph of prose that receives normal substitutions
|
|
24
|
+
* - `verbatim` - this block holds verbatim text (displayed "as is") that receives verbatim substitutions
|
|
25
|
+
* - `raw` - this block holds unprocessed content passed directly to the output with no substitutions applied
|
|
26
|
+
* - `empty` - this block has no content
|
|
27
|
+
* @type {string}
|
|
28
|
+
*/
|
|
29
|
+
contentModel: string;
|
|
30
|
+
/**
|
|
31
|
+
* Array of {@link AbstractBlock} child blocks for this block. Only applies if content model is `compound`.
|
|
32
|
+
* @type {AbstractBlock[]}
|
|
33
|
+
*/
|
|
34
|
+
blocks: AbstractBlock[];
|
|
35
|
+
style: string;
|
|
36
|
+
level: number;
|
|
37
|
+
/**
|
|
38
|
+
* Set the String block title (clears the memoised converted title).
|
|
39
|
+
* @param {string|null} val
|
|
40
|
+
*/
|
|
41
|
+
set title(val: string | null);
|
|
42
|
+
/**
|
|
43
|
+
* Get the String title of this block with title substitutions applied.
|
|
44
|
+
* The result is pre-computed during Document.parse() via precomputeTitle().
|
|
45
|
+
* Falls back to applyHeaderSubs (sync) if precomputeTitle() has not been called yet
|
|
46
|
+
* (e.g. when a title is set via the API after parsing).
|
|
47
|
+
* @returns {string|null} the converted String title, or null if the source title is falsy.
|
|
48
|
+
*/
|
|
49
|
+
get title(): string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Pre-compute the converted title asynchronously.
|
|
52
|
+
* Called during Document.parse() so the synchronous getter works during conversion.
|
|
53
|
+
* Re-entrant calls (circular title references) are detected via _computingTitle and
|
|
54
|
+
* silently skipped so that {@link Section.xreftext()} can return null (→ "[refid]" fallback).
|
|
55
|
+
* @returns {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
precomputeTitle(): Promise<void>;
|
|
58
|
+
_computingTitle: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Check whether the title of this block is defined.
|
|
61
|
+
* @returns {boolean}
|
|
62
|
+
*/
|
|
63
|
+
hasTitle(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Set the caption for this block.
|
|
66
|
+
* @param {string|null} val
|
|
67
|
+
*/
|
|
68
|
+
set caption(val: string | null);
|
|
69
|
+
/**
|
|
70
|
+
* Get the caption for this block.
|
|
71
|
+
* For admonition blocks, returns the 'textlabel' attribute instead.
|
|
72
|
+
* @returns {string|null}
|
|
73
|
+
*/
|
|
74
|
+
get caption(): string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Get the source file where this block started.
|
|
77
|
+
* @returns {string|null}
|
|
78
|
+
*/
|
|
79
|
+
get file(): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Get the source line number where this block started.
|
|
82
|
+
* @returns {number|null}
|
|
83
|
+
*/
|
|
84
|
+
get lineno(): number | null;
|
|
85
|
+
/**
|
|
86
|
+
* Update the context of this block, also updating the node name.
|
|
87
|
+
* @param {string} context - The String context to assign to this block.
|
|
88
|
+
*/
|
|
89
|
+
setContext(context: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated
|
|
92
|
+
* @param {number|string} val
|
|
93
|
+
*/
|
|
94
|
+
set number(val: number | string);
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated Get/set the numeral of this section as an integer when possible.
|
|
97
|
+
* @returns {number|string}
|
|
98
|
+
*/
|
|
99
|
+
get number(): number | string;
|
|
100
|
+
/**
|
|
101
|
+
* Convert this block and return the converted String content.
|
|
102
|
+
* @returns {Promise<string>} the result of the converter.
|
|
103
|
+
*/
|
|
104
|
+
convert(): Promise<string>;
|
|
105
|
+
/** @deprecated Use convert() instead. */
|
|
106
|
+
render(): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Get the converted result of all child blocks joined with a newline.
|
|
109
|
+
* @returns {Promise<TContent>}
|
|
110
|
+
*/
|
|
111
|
+
content(): Promise<TContent>;
|
|
112
|
+
/**
|
|
113
|
+
* Alias for the content method — mirrors the core API.
|
|
114
|
+
* @returns {Promise<TContent>}
|
|
115
|
+
*/
|
|
116
|
+
getContent(): Promise<TContent>;
|
|
117
|
+
/**
|
|
118
|
+
* Append a content block to this block's list of blocks.
|
|
119
|
+
* @param {AbstractBlock} block - The new child block.
|
|
120
|
+
* @returns {AbstractBlock} this block (enables chaining).
|
|
121
|
+
*/
|
|
122
|
+
append(block: AbstractBlock): AbstractBlock;
|
|
123
|
+
/**
|
|
124
|
+
* Determine whether this block contains block content.
|
|
125
|
+
* @returns {boolean}
|
|
126
|
+
*/
|
|
127
|
+
hasBlocks(): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Check whether this block has any child Section objects.
|
|
130
|
+
* Overridden by Document and Section.
|
|
131
|
+
* @returns {boolean}
|
|
132
|
+
*/
|
|
133
|
+
hasSections(): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Get the child Section objects of this block.
|
|
136
|
+
* Only applies to Document and Section instances.
|
|
137
|
+
* @returns {AbstractBlock[]} array of Section objects (may be empty).
|
|
138
|
+
*/
|
|
139
|
+
sections(): AbstractBlock[];
|
|
140
|
+
/**
|
|
141
|
+
* Get the converted alt text for this block image.
|
|
142
|
+
* @returns {string} string with XML special character and replacement substitutions applied.
|
|
143
|
+
*/
|
|
144
|
+
alt(): string;
|
|
145
|
+
/**
|
|
146
|
+
* Get the converted alt text for this block image (alias of alt).
|
|
147
|
+
* @returns {string}
|
|
148
|
+
*/
|
|
149
|
+
getAlt(): string;
|
|
150
|
+
/**
|
|
151
|
+
* Get the converted title prefixed with the caption.
|
|
152
|
+
* @returns {string} the captioned title.
|
|
153
|
+
*/
|
|
154
|
+
captionedTitle(): string;
|
|
155
|
+
/**
|
|
156
|
+
* Get the list marker keyword for the specified list type.
|
|
157
|
+
* @param {string|null} [listType=null] - The String list type (default: this.style).
|
|
158
|
+
* @returns {string|undefined} the single-character String keyword for the list marker.
|
|
159
|
+
*/
|
|
160
|
+
listMarkerKeyword(listType?: string | null): string | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Check whether the specified substitution is enabled for this block.
|
|
163
|
+
* @param {string} name - The String substitution name.
|
|
164
|
+
* @returns {boolean}
|
|
165
|
+
*/
|
|
166
|
+
hasSub(name: string): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Remove a substitution from this block.
|
|
169
|
+
* @param {string} name - The String substitution name to remove.
|
|
170
|
+
*/
|
|
171
|
+
removeSub(name: string): void;
|
|
172
|
+
/**
|
|
173
|
+
* Alias for {@link getXrefText}.
|
|
174
|
+
* @param {string|null} [xrefstyle=null] - Optional String style: 'full', 'short', or 'basic'.
|
|
175
|
+
* @returns {Promise<string|null>} the xreftext, or null.
|
|
176
|
+
* @see {getXrefText}
|
|
177
|
+
*/
|
|
178
|
+
xreftext(xrefstyle?: string | null): Promise<string | null>;
|
|
179
|
+
/**
|
|
180
|
+
* Generate and assign a caption to this block if not already assigned.
|
|
181
|
+
* If the block has a title and a caption prefix is available, builds a caption
|
|
182
|
+
* from the prefix and a counter, then stores it.
|
|
183
|
+
* @param {string|null} [value=null] - The String caption to assign, or null to derive from document attributes.
|
|
184
|
+
* @param {string} [captionContext=this.context] - The String context used to look up caption attributes.
|
|
185
|
+
*/
|
|
186
|
+
assignCaption(value?: string | null, captionContext?: string): void;
|
|
187
|
+
/**
|
|
188
|
+
* Walk the document tree and find all block-level nodes that match
|
|
189
|
+
* the selector and optional filter function.
|
|
190
|
+
*
|
|
191
|
+
* The selector is a plain object whose keys narrow the search:
|
|
192
|
+
* - `context` {string} — node context (e.g. `'section'`, `'listing'`, `'paragraph'`, `'image'`)
|
|
193
|
+
* - `style` {string} — block style (e.g. `'source'`, `'NOTE'`)
|
|
194
|
+
* - `role` {string} — a CSS role that must appear in the node's role list
|
|
195
|
+
* - `id` {string} — exact node id; stops traversal after the first match
|
|
196
|
+
* - `traverseDocuments` {boolean} — when `true`, recurse into AsciiDoc table cells
|
|
197
|
+
*
|
|
198
|
+
* The optional filter function receives each candidate node and must return:
|
|
199
|
+
* - a truthy value (or `true`) → include the node
|
|
200
|
+
* - `'prune'` → include the node but do **not** recurse into its children
|
|
201
|
+
* - `'reject'` → skip the node and its children
|
|
202
|
+
* - `'stop'` → include the node (if it matched) and stop the entire traversal
|
|
203
|
+
*
|
|
204
|
+
* @param {Object} [selector={}] - Selector criteria object.
|
|
205
|
+
* @param {Function|null} [filter=null] - Per-node filter callback.
|
|
206
|
+
* @returns {AbstractBlock[]} array of matching block-level nodes.
|
|
207
|
+
*
|
|
208
|
+
* @example <caption>All source listing blocks</caption>
|
|
209
|
+
* const listings = doc.findBy({ context: 'listing', style: 'source' })
|
|
210
|
+
*
|
|
211
|
+
* @example <caption>All sections up to level 2</caption>
|
|
212
|
+
* const sections = doc.findBy({ context: 'section' }, (node) => node.level <= 2 || 'prune')
|
|
213
|
+
*
|
|
214
|
+
* @example <caption>Find a block by id</caption>
|
|
215
|
+
* const [block] = doc.findBy({ id: 'my-anchor' })
|
|
216
|
+
*
|
|
217
|
+
* @example <caption>All image blocks including those inside AsciiDoc table cells</caption>
|
|
218
|
+
* const images = doc.findBy({ context: 'image', traverseDocuments: true })
|
|
219
|
+
*/
|
|
220
|
+
findBy(selector?: any, filter?: Function | null): AbstractBlock[];
|
|
221
|
+
/** Alias for {@link findBy}. */
|
|
222
|
+
query(selector?: {}, filter?: any): AbstractBlock<string>[];
|
|
223
|
+
/**
|
|
224
|
+
* Move to the next adjacent block in document order.
|
|
225
|
+
* If the current block is the last item in a list, returns the following
|
|
226
|
+
* sibling of the list block.
|
|
227
|
+
* @returns {AbstractBlock|null} the next AbstractBlock, or null.
|
|
228
|
+
*/
|
|
229
|
+
nextAdjacentBlock(): AbstractBlock | null;
|
|
230
|
+
/**
|
|
231
|
+
* Get the content model of this block.
|
|
232
|
+
* @returns {string}
|
|
233
|
+
*/
|
|
234
|
+
getContentModel(): string;
|
|
235
|
+
/**
|
|
236
|
+
* Set the content model of this block.
|
|
237
|
+
* @param {string} val
|
|
238
|
+
*/
|
|
239
|
+
setContentModel(val: string): void;
|
|
240
|
+
/**
|
|
241
|
+
* Get the child blocks of this block.
|
|
242
|
+
* @returns {AbstractBlock[]}
|
|
243
|
+
*/
|
|
244
|
+
getBlocks(): AbstractBlock[];
|
|
245
|
+
/**
|
|
246
|
+
* Get the child Section blocks of this block.
|
|
247
|
+
* @returns {AbstractBlock[]}
|
|
248
|
+
*/
|
|
249
|
+
getSections(): AbstractBlock[];
|
|
250
|
+
/**
|
|
251
|
+
* Get the title of this block with substitutions applied.
|
|
252
|
+
* @returns {string|null}
|
|
253
|
+
*/
|
|
254
|
+
getTitle(): string | null;
|
|
255
|
+
/**
|
|
256
|
+
* Set the raw title of this block.
|
|
257
|
+
* @param {string|null} val
|
|
258
|
+
*/
|
|
259
|
+
setTitle(val: string | null): void;
|
|
260
|
+
/**
|
|
261
|
+
* Get the caption of this block.
|
|
262
|
+
* @returns {string|undefined}
|
|
263
|
+
*/
|
|
264
|
+
getCaption(): string | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* Set the caption of this block.
|
|
267
|
+
* @param {string|null} val
|
|
268
|
+
*/
|
|
269
|
+
setCaption(val: string | null): void;
|
|
270
|
+
/**
|
|
271
|
+
* Get the captioned title of this block.
|
|
272
|
+
* @returns {string}
|
|
273
|
+
*/
|
|
274
|
+
getCaptionedTitle(): string;
|
|
275
|
+
/**
|
|
276
|
+
* Get the style of this block.
|
|
277
|
+
* @returns {string|null}
|
|
278
|
+
*/
|
|
279
|
+
getStyle(): string | null;
|
|
280
|
+
/**
|
|
281
|
+
* Set the style of this block.
|
|
282
|
+
* @param {string|null} val
|
|
283
|
+
*/
|
|
284
|
+
setStyle(val: string | null): void;
|
|
285
|
+
/**
|
|
286
|
+
* Get the level of this block.
|
|
287
|
+
* @returns {number|null}
|
|
288
|
+
*/
|
|
289
|
+
getLevel(): number | null;
|
|
290
|
+
/**
|
|
291
|
+
* Set the level of this block.
|
|
292
|
+
* @param {number|null} val
|
|
293
|
+
*/
|
|
294
|
+
setLevel(val: number | null): void;
|
|
295
|
+
/**
|
|
296
|
+
* Get the source file where this block started.
|
|
297
|
+
* @returns {string|undefined} the file path, or undefined when sourcemap is disabled.
|
|
298
|
+
*/
|
|
299
|
+
getFile(): string | undefined;
|
|
300
|
+
/**
|
|
301
|
+
* Get the source line number where this block started.
|
|
302
|
+
* @returns {number|undefined} line number, or undefined when sourcemap is disabled.
|
|
303
|
+
*/
|
|
304
|
+
getLineNumber(): number | undefined;
|
|
305
|
+
/**
|
|
306
|
+
* Generate cross-reference text (xreftext) used to refer to this block.
|
|
307
|
+
* Uses the explicit reftext if set. For sections or captioned blocks (blocks
|
|
308
|
+
* with both a title and a caption), formats the text according to xrefstyle.
|
|
309
|
+
* Falls back to the title, or null if no title is available.
|
|
310
|
+
* @param {string|null} [xrefstyle=null] - Optional String style: 'full', 'short', or 'basic'.
|
|
311
|
+
* @returns {Promise<string|null>} the xreftext, or null.
|
|
312
|
+
*/
|
|
313
|
+
getXrefText(xrefstyle?: string | null): Promise<string | null>;
|
|
314
|
+
/**
|
|
315
|
+
* Get the source location of this block.
|
|
316
|
+
* @returns {Cursor|undefined} the Cursor source location object, or undefined when sourcemap is disabled.
|
|
317
|
+
*/
|
|
318
|
+
getSourceLocation(): Cursor | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Get the list of substitutions enabled for this block.
|
|
321
|
+
* @returns {string[]}
|
|
322
|
+
*/
|
|
323
|
+
getSubstitutions(): string[];
|
|
324
|
+
/**
|
|
325
|
+
* Check whether the specified substitution is enabled for this block.
|
|
326
|
+
* @param {string} name
|
|
327
|
+
* @returns {boolean}
|
|
328
|
+
*/
|
|
329
|
+
hasSubstitution(name: string): boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Add the specified substitution to this block's substitutions list.
|
|
332
|
+
* @param {string} name
|
|
333
|
+
*/
|
|
334
|
+
addSubstitution(name: string): void;
|
|
335
|
+
/**
|
|
336
|
+
* Remove the specified substitution from this block's substitutions list.
|
|
337
|
+
* @param {string} name
|
|
338
|
+
*/
|
|
339
|
+
removeSubstitution(name: string): void;
|
|
340
|
+
#private;
|
|
341
|
+
}
|
|
342
|
+
import { AbstractNode } from './abstract_node.js';
|
|
343
|
+
import type { Cursor } from './reader.js';
|