asciidoctor 4.0.0-alpha.1 → 4.0.0-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asciidoctor",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.2",
4
4
  "description": "A JavaScript AsciiDoc processor powered by Asciidoctor",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "homepage": "https://github.com/asciidoctor/asciidoctor.js",
55
55
  "dependencies": {
56
- "@asciidoctor/core": "4.0.0-alpha.1"
56
+ "@asciidoctor/core": "4.0.0-alpha.2"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@biomejs/biome": "^2.4.13",
@@ -201,7 +201,7 @@ export abstract class AbstractBlock<TContent extends string | any[] = string> ex
201
201
  * - `'reject'` → skip the node and its children
202
202
  * - `'stop'` → include the node (if it matched) and stop the entire traversal
203
203
  *
204
- * @param {Object} [selector={}] - Selector criteria object.
204
+ * @param {Object|Function} [selector={}] - Selector criteria object, or a filter callback when called as `findBy(callback)`.
205
205
  * @param {Function|null} [filter=null] - Per-node filter callback.
206
206
  * @returns {AbstractBlock[]} array of matching block-level nodes.
207
207
  *
@@ -216,8 +216,11 @@ export abstract class AbstractBlock<TContent extends string | any[] = string> ex
216
216
  *
217
217
  * @example <caption>All image blocks including those inside AsciiDoc table cells</caption>
218
218
  * const images = doc.findBy({ context: 'image', traverseDocuments: true })
219
+ *
220
+ * @example <caption>Filter-only shorthand (no selector)</caption>
221
+ * const verbatim = doc.findBy((b) => b.contentModel === ContentModel.VERBATIM)
219
222
  */
220
- findBy(selector?: any, filter?: Function | null): AbstractBlock[];
223
+ findBy(selector?: any | Function, filter?: Function | null): AbstractBlock[];
221
224
  /** Alias for {@link findBy}. */
222
225
  query(selector?: {}, filter?: any): AbstractBlock<string>[];
223
226
  /**
@@ -0,0 +1,75 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Get the version of Asciidoctor.js.
4
+ *
5
+ * @returns {string} - the version of Asciidoctor.js
6
+ */
7
+ export function getVersion(): string;
8
+ /**
9
+ * Get Asciidoctor core version number.
10
+ *
11
+ * @returns {string} - the version of Asciidoctor core (Ruby)
12
+ */
13
+ export function getCoreVersion(): string;
14
+ /**
15
+ * Parse the AsciiDoc source input into a Document.
16
+ *
17
+ * @param {string|string[]|Buffer} input - the AsciiDoc source as a String, String Array, or Buffer
18
+ * @param {Object} [options={}] - a plain object of options to control processing
19
+ * @returns {Promise<Document>} - the parsed Document
20
+ */
21
+ export function load(input: string | string[] | Buffer, options?: any): Promise<Document>;
22
+ /**
23
+ * Parse the contents of the AsciiDoc source file into a Document.
24
+ *
25
+ * @param {string} filename - the path to the AsciiDoc source file
26
+ * @param {Object} [options={}] - a plain object of options to control processing
27
+ * @returns {Promise<Document>} - the parsed Document
28
+ */
29
+ export function loadFile(filename: string, options?: any): Promise<Document>;
30
+ import { Document } from './document.js';
31
+ import { convert } from './convert.js';
32
+ import { convertFile } from './convert.js';
33
+ import { DocumentTitle } from './document.js';
34
+ import { Author } from './document.js';
35
+ import { Footnote } from './document.js';
36
+ import { ImageReference } from './document.js';
37
+ import { RevisionInfo } from './document.js';
38
+ import { Logger } from './logging.js';
39
+ import { AbstractNode } from './abstract_node.js';
40
+ import { AbstractBlock } from './abstract_block.js';
41
+ import { Inline } from './inline.js';
42
+ import { Block } from './block.js';
43
+ import { List } from './list.js';
44
+ import { ListItem } from './list.js';
45
+ import { Section } from './section.js';
46
+ import { Reader } from './reader.js';
47
+ import { SyntaxHighlighterBase } from './syntax_highlighter.js';
48
+ import { LoggerManager } from './logging.js';
49
+ import { MemoryLogger } from './logging.js';
50
+ import { NullLogger } from './logging.js';
51
+ import { SafeMode } from './constants.js';
52
+ import { ContentModel } from './constants.js';
53
+ import { Timings } from './timings.js';
54
+ import { Registry } from './extensions.js';
55
+ import { Processor } from './extensions.js';
56
+ import { ProcessorExtension } from './extensions.js';
57
+ import { Preprocessor } from './extensions.js';
58
+ import { TreeProcessor } from './extensions.js';
59
+ import { Postprocessor } from './extensions.js';
60
+ import { IncludeProcessor } from './extensions.js';
61
+ import { DocinfoProcessor } from './extensions.js';
62
+ import { BlockProcessor } from './extensions.js';
63
+ import { InlineMacroProcessor } from './extensions.js';
64
+ import { BlockMacroProcessor } from './extensions.js';
65
+ import { Extensions } from './extensions.js';
66
+ import { Cursor } from './reader.js';
67
+ import { Converter } from './converter.js';
68
+ import { ConverterBase } from './converter.js';
69
+ import { CustomFactory } from './converter.js';
70
+ import { DefaultFactory as DefaultConverterFactory } from './converter.js';
71
+ import { deriveBackendTraits } from './converter.js';
72
+ import { DefaultFactory as DefaultSyntaxHighlighterFactory } from './syntax_highlighter.js';
73
+ import Html5Converter from './converter/html5.js';
74
+ import { SyntaxHighlighter } from './syntax_highlighter.js';
75
+ export { convert, convertFile, Document, DocumentTitle, Author, Footnote, ImageReference, RevisionInfo, Logger, AbstractNode, AbstractBlock, Inline, Block, List, ListItem, Section, Reader, SyntaxHighlighterBase, LoggerManager, MemoryLogger, NullLogger, SafeMode, ContentModel, Timings, Registry, Processor, ProcessorExtension, Preprocessor, TreeProcessor, Postprocessor, IncludeProcessor, DocinfoProcessor, BlockProcessor, InlineMacroProcessor, BlockMacroProcessor, Extensions, Cursor, Converter as ConverterFactory, ConverterBase, CustomFactory as ConverterCustomFactory, DefaultConverterFactory, deriveBackendTraits, DefaultSyntaxHighlighterFactory, Html5Converter, SyntaxHighlighter };