@asciidoctor/core 3.0.4 → 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/README.md +42 -10
- package/build/browser/index.js +24156 -0
- package/build/node/index.cjs +24737 -0
- package/{dist/css/asciidoctor.css → data/asciidoctor-default.css} +54 -53
- package/package.json +55 -97
- package/src/abstract_block.js +857 -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 +1893 -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 +346 -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.cts +75 -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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class Footnote {
|
|
2
|
+
constructor(index: any, id: any, text: any);
|
|
3
|
+
index: any;
|
|
4
|
+
id: any;
|
|
5
|
+
text: any;
|
|
6
|
+
/**
|
|
7
|
+
* @returns {number} the index of this footnote.
|
|
8
|
+
*/
|
|
9
|
+
getIndex(): number;
|
|
10
|
+
/**
|
|
11
|
+
* @returns {string|null} the id of this footnote, or null if not set.
|
|
12
|
+
*/
|
|
13
|
+
getId(): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* @returns {string} the text of this footnote.
|
|
16
|
+
*/
|
|
17
|
+
getText(): string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prepare the source data Array for parsing.
|
|
3
|
+
*
|
|
4
|
+
* Strips a leading BOM from the first element if present, then trims trailing
|
|
5
|
+
* whitespace (trimEnd = true) or only the trailing newline (trimEnd = false)
|
|
6
|
+
* from every line.
|
|
7
|
+
*
|
|
8
|
+
* @param {string[]} data - the source data Array to prepare (no null/undefined entries allowed)
|
|
9
|
+
* @param {boolean} [trimEnd=true] - whether to strip all trailing whitespace (true) or only \n (false)
|
|
10
|
+
* @returns {string[]} Array of prepared lines
|
|
11
|
+
*/
|
|
12
|
+
export function prepareSourceArray(data: string[], trimEnd?: boolean): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Prepare the source data String for parsing.
|
|
15
|
+
*
|
|
16
|
+
* Strips a leading BOM if present, splits into an array, and trims trailing
|
|
17
|
+
* whitespace (trimEnd = true) or only the trailing newline (trimEnd = false)
|
|
18
|
+
* from every line.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} data - the source data String to prepare
|
|
21
|
+
* @param {boolean} [trimEnd=true] - whether to strip all trailing whitespace (true) or only \n (false)
|
|
22
|
+
* @returns {string[]} Array of prepared lines
|
|
23
|
+
*/
|
|
24
|
+
export function prepareSourceString(data: string, trimEnd?: boolean): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Efficiently check whether the specified String resembles a URI.
|
|
27
|
+
*
|
|
28
|
+
* Uses UriSniffRx to check whether the String begins with a URI prefix (e.g.
|
|
29
|
+
* http://). No validation of the URI is performed.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} str - the String to check
|
|
32
|
+
* @returns {boolean} true if the String resembles a URI, false otherwise
|
|
33
|
+
*/
|
|
34
|
+
export function isUriish(str: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Encode a URI component String for safe inclusion in a URI.
|
|
37
|
+
*
|
|
38
|
+
* Encodes all characters that are not unreserved per RFC-3986. Specifically,
|
|
39
|
+
* encodeURIComponent leaves !, ', (, ), and * unencoded; this function encodes
|
|
40
|
+
* those as well so the result matches CGI.escapeURIComponent (Ruby ≥ 3.2) /
|
|
41
|
+
* CGI.escape + gsub('+', '%20').
|
|
42
|
+
*
|
|
43
|
+
* @param {string} str - the URI component String to encode
|
|
44
|
+
* @returns {string} the encoded String
|
|
45
|
+
*/
|
|
46
|
+
export function encodeUriComponent(str: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Replace spaces with %20 in a URI path.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} str - the String to encode
|
|
51
|
+
* @returns {string} the String with all spaces replaced with %20
|
|
52
|
+
*/
|
|
53
|
+
export function encodeSpacesInUri(str: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Remove the file extension from a filename and return the result.
|
|
56
|
+
*
|
|
57
|
+
* The filename is expected to be a POSIX path. The extension is only stripped
|
|
58
|
+
* when no path separator follows the last dot, so paths like
|
|
59
|
+
* "dir.with.dots/file" are returned unchanged.
|
|
60
|
+
*
|
|
61
|
+
* @param {string} filename - the String file name to process
|
|
62
|
+
* @returns {string} the String filename with the file extension removed
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* rootname('part1/chapter1.adoc')
|
|
66
|
+
* // => "part1/chapter1"
|
|
67
|
+
*/
|
|
68
|
+
export function rootname(filename: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Retrieve the basename of a filename, optionally removing the extension.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} filename - the String file name to process
|
|
73
|
+
* @param {boolean|string|null} [dropExt=null] - a Boolean flag or an explicit String extension to drop
|
|
74
|
+
* @returns {string} the String filename with leading directories removed and, optionally, the extension removed
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* basename('images/tiger.png', true)
|
|
78
|
+
* // => "tiger"
|
|
79
|
+
*
|
|
80
|
+
* basename('images/tiger.png', '.png')
|
|
81
|
+
* // => "tiger"
|
|
82
|
+
*/
|
|
83
|
+
export function basename(filename: string, dropExt?: boolean | string | null): string;
|
|
84
|
+
/**
|
|
85
|
+
* Return whether this path has a file extension.
|
|
86
|
+
*
|
|
87
|
+
* @param {string} path - the path String to check (expects a POSIX path)
|
|
88
|
+
* @returns {boolean} true if the path has a file extension, false otherwise
|
|
89
|
+
*/
|
|
90
|
+
export function isExtname(path: string): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Retrieve the file extension of the specified path.
|
|
93
|
+
*
|
|
94
|
+
* The file extension is the portion of the last path segment starting from
|
|
95
|
+
* the last period. Differs from Node's path.extname in that the fallback value
|
|
96
|
+
* is configurable.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} path - the path String in which to look for a file extension
|
|
99
|
+
* @param {string} [fallback=''] - the fallback String to return if no file extension is present
|
|
100
|
+
* @returns {string} the String file extension (with the leading dot) or fallback
|
|
101
|
+
*/
|
|
102
|
+
export function extname(path: string, fallback?: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* Async-aware string replacement using matchAll.
|
|
105
|
+
*
|
|
106
|
+
* The replacer may return a string or a Promise<string>.
|
|
107
|
+
* The regex is treated as global regardless of its flags.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} str - the String to perform replacements on
|
|
110
|
+
* @param {RegExp} regex - the RegExp pattern to match
|
|
111
|
+
* @param {Function} replacer - an async function receiving the same arguments as String#replace callbacks
|
|
112
|
+
* @returns {Promise<string>} the String with all matches replaced
|
|
113
|
+
*/
|
|
114
|
+
export function asyncReplace(str: string, regex: RegExp, replacer: Function): Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Make a directory, creating all missing parent directories.
|
|
117
|
+
*
|
|
118
|
+
* @param {string} dir - the String path of the directory to create
|
|
119
|
+
* @returns {Promise<void>} Throws if the path cannot be created
|
|
120
|
+
*/
|
|
121
|
+
export function mkdirP(dir: string): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Convert an integer to a Roman numeral.
|
|
124
|
+
*
|
|
125
|
+
* @param {number} val - the integer value to convert
|
|
126
|
+
* @returns {string} the String Roman numeral
|
|
127
|
+
*/
|
|
128
|
+
export function intToRoman(val: number): string;
|
|
129
|
+
/**
|
|
130
|
+
* Convert an uppercase Roman numeral to an integer.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} val - the String Roman numeral in uppercase to convert
|
|
133
|
+
* @returns {number} the integer value
|
|
134
|
+
*/
|
|
135
|
+
export function romanToInt(val: string): number;
|
|
136
|
+
/**
|
|
137
|
+
* Get the next value in a sequence.
|
|
138
|
+
*
|
|
139
|
+
* Handles integer sequences (numeric increment) and alphabetic sequences
|
|
140
|
+
* (ASCII letter increment with carry, matching Ruby's String#succ for the
|
|
141
|
+
* alphanumeric subset used by Asciidoctor list labels).
|
|
142
|
+
*
|
|
143
|
+
* @param {string|number} current - the value to increment
|
|
144
|
+
* @returns {string|number} the next value in the sequence
|
|
145
|
+
*/
|
|
146
|
+
export function nextval(current: string | number): string | number;
|
|
@@ -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 };
|