@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.
Files changed (92) hide show
  1. package/README.md +42 -10
  2. package/build/browser/index.js +24156 -0
  3. package/build/node/index.cjs +24737 -0
  4. package/{dist/css/asciidoctor.css → data/asciidoctor-default.css} +54 -53
  5. package/package.json +55 -97
  6. package/src/abstract_block.js +857 -0
  7. package/src/abstract_node.js +954 -0
  8. package/src/attribute_entry.js +12 -0
  9. package/src/attribute_list.js +380 -0
  10. package/src/block.js +168 -0
  11. package/src/browser/asset.js +22 -0
  12. package/src/browser/reader.js +138 -0
  13. package/src/browser.js +121 -0
  14. package/src/callouts.js +85 -0
  15. package/src/compliance.js +54 -0
  16. package/src/constants.js +665 -0
  17. package/src/convert.js +370 -0
  18. package/src/converter/composite.js +83 -0
  19. package/src/converter/docbook5.js +1031 -0
  20. package/src/converter/html5.js +1893 -0
  21. package/src/converter/manpage.js +935 -0
  22. package/src/converter/template.js +459 -0
  23. package/src/converter.js +478 -0
  24. package/src/data/stylesheet-data.js +2 -0
  25. package/src/document.js +2134 -0
  26. package/src/extensions.js +1952 -0
  27. package/src/footnote.js +28 -0
  28. package/src/helpers.js +355 -0
  29. package/src/index.js +138 -0
  30. package/src/inline.js +158 -0
  31. package/src/list.js +240 -0
  32. package/src/load.js +276 -0
  33. package/src/logging.js +526 -0
  34. package/src/parser.js +3661 -0
  35. package/src/path_resolver.js +472 -0
  36. package/src/reader.js +1755 -0
  37. package/src/rx.js +829 -0
  38. package/src/section.js +354 -0
  39. package/src/stylesheets.js +30 -0
  40. package/src/substitutors.js +2241 -0
  41. package/src/syntaxHighlighter/highlightjs.js +90 -0
  42. package/src/syntaxHighlighter/html_pipeline.js +33 -0
  43. package/src/syntax_highlighter.js +304 -0
  44. package/src/table.js +952 -0
  45. package/src/timings.js +78 -0
  46. package/types/abstract_block.d.ts +346 -0
  47. package/types/abstract_node.d.ts +471 -0
  48. package/types/attribute_entry.d.ts +7 -0
  49. package/types/attribute_list.d.ts +52 -0
  50. package/types/block.d.ts +55 -0
  51. package/types/browser/asset.d.ts +7 -0
  52. package/types/browser/reader.d.ts +29 -0
  53. package/types/callouts.d.ts +36 -0
  54. package/types/compliance.d.ts +23 -0
  55. package/types/constants.d.ts +268 -0
  56. package/types/convert.d.ts +34 -0
  57. package/types/converter/composite.d.ts +20 -0
  58. package/types/converter/docbook5.d.ts +41 -0
  59. package/types/converter/html5.d.ts +51 -0
  60. package/types/converter/manpage.d.ts +59 -0
  61. package/types/converter/template.d.ts +83 -0
  62. package/types/converter.d.ts +150 -0
  63. package/types/data/stylesheet-data.d.ts +2 -0
  64. package/types/document.d.ts +495 -0
  65. package/types/extensions.d.ts +876 -0
  66. package/types/footnote.d.ts +18 -0
  67. package/types/helpers.d.ts +146 -0
  68. package/types/index.d.cts +75 -0
  69. package/types/index.d.ts +73 -3731
  70. package/types/inline.d.ts +69 -0
  71. package/types/list.d.ts +114 -0
  72. package/types/load.d.ts +39 -0
  73. package/types/logging.d.ts +187 -0
  74. package/types/parser.d.ts +114 -0
  75. package/types/path_resolver.d.ts +103 -0
  76. package/types/reader.d.ts +184 -0
  77. package/types/rx.d.ts +513 -0
  78. package/types/section.d.ts +122 -0
  79. package/types/stylesheets.d.ts +10 -0
  80. package/types/substitutors.d.ts +208 -0
  81. package/types/syntaxHighlighter/highlightjs.d.ts +33 -0
  82. package/types/syntaxHighlighter/html_pipeline.d.ts +16 -0
  83. package/types/syntax_highlighter.d.ts +167 -0
  84. package/types/table.d.ts +231 -0
  85. package/types/timings.d.ts +25 -0
  86. package/types/tsconfig.json +9 -0
  87. package/LICENSE +0 -21
  88. package/dist/browser/asciidoctor.js +0 -47654
  89. package/dist/browser/asciidoctor.min.js +0 -1452
  90. package/dist/graalvm/asciidoctor.js +0 -47402
  91. package/dist/node/asciidoctor.cjs +0 -21567
  92. package/dist/node/asciidoctor.js +0 -23037
@@ -0,0 +1,23 @@
1
+ export namespace Compliance {
2
+ let keys: Set<string>;
3
+ /** AsciiDoc terminates paragraphs adjacent to block content (delimiter or block attribute list). Compliance value: true */
4
+ let blockTerminatesParagraph: boolean;
5
+ /** AsciiDoc does not parse paragraphs with a verbatim style as verbatim content. Compliance value: false (Asciidoctor default: true) */
6
+ let strictVerbatimParagraphs: boolean;
7
+ /** AsciiDoc supports both atx (single-line) and setext (underlined) section titles. Compliance value: true */
8
+ let underlineStyleSectionTitles: boolean;
9
+ /** Asciidoctor will unwrap the content in a preamble if the document has a title and no sections. Compliance value: false (Asciidoctor default: true) */
10
+ let unwrapStandalonePreamble: boolean;
11
+ /** AsciiDoc drops lines that contain references to missing attributes. Possible values: 'skip', 'drop', 'drop-line', 'warn'. Compliance value: 'drop-line' (Asciidoctor default: 'skip') */
12
+ let attributeMissing: string;
13
+ /** AsciiDoc drops lines that contain an attribute unassignment. Compliance value: 'drop-line' */
14
+ let attributeUndefined: string;
15
+ /** Shorthand syntax for id, role and options on blocks (e.g. #id.role%opt). Compliance value: false (Asciidoctor default: true) */
16
+ let shorthandPropertySyntax: boolean;
17
+ /** Resolve cross-reference targets by matching reftext or title. Compliance value: false (Asciidoctor default: true) */
18
+ let naturalXrefs: boolean;
19
+ /** Starting counter when generating a unique id on conflict. Compliance value: 2 */
20
+ let uniqueIdStartIndex: number;
21
+ /** Recognize commonly-used Markdown syntax where it does not conflict. Compliance value: false (Asciidoctor default: true) */
22
+ let markdownSyntax: boolean;
23
+ }
@@ -0,0 +1,268 @@
1
+ export * from "./rx.js";
2
+ export namespace SafeMode {
3
+ /**
4
+ * A safe mode level that disables any of the security features enforced
5
+ * by Asciidoctor (Node is still subject to its own restrictions).
6
+ */
7
+ let UNSAFE: number;
8
+ /**
9
+ * A safe mode level that closely parallels safe mode in AsciiDoc. This value
10
+ * prevents access to files which reside outside the parent directory of
11
+ * the source file and disables any macro other than the `include::[]` directive.
12
+ */
13
+ let SAFE: number;
14
+ /**
15
+ * A safe mode level that disallows the document from setting attributes
16
+ * that would affect the conversion of the document, in addition to all the
17
+ * security features of {@link SafeMode.SAFE}. For instance, this level forbids
18
+ * changing the backend or source-highlighter using an attribute defined
19
+ * in the source document header. This is the most fundamental level of
20
+ * security for server deployments (hence the name).
21
+ */
22
+ let SERVER: number;
23
+ /**
24
+ * A safe mode level that disallows the document from attempting to read
25
+ * files from the file system and including the contents of them into the
26
+ * document, in additional to all the security features of {@link SafeMode.SERVER}.
27
+ * For instance, this level disallows use of the `include::[]` directive and the
28
+ * embedding of binary content (data uri), stylesheets and JavaScripts
29
+ * referenced by the document. (Asciidoctor and trusted extensions may still
30
+ * be allowed to embed trusted content into the document).
31
+ *
32
+ * Since Asciidoctor is aiming for wide adoption, this level is the default
33
+ * and is recommended for server deployments.
34
+ */
35
+ let SECURE: number;
36
+ /**
37
+ * Returns the numeric value for a safe-mode name string, or undefined.
38
+ * @param {string} name
39
+ * @returns {number|undefined}
40
+ */
41
+ function valueForName(name: string): number | undefined;
42
+ /**
43
+ * @param {string} name
44
+ * @returns {number|undefined}
45
+ */
46
+ function getValueForName(name: string): number | undefined;
47
+ /**
48
+ * Returns the lowercase name for a numeric safe-mode value, or undefined.
49
+ * @param {number} value
50
+ * @returns {string|undefined}
51
+ */
52
+ function nameForValue(value: number): string | undefined;
53
+ /**
54
+ * @param {number} value
55
+ * @returns {string|undefined}
56
+ */
57
+ function getNameForValue(value: number): string | undefined;
58
+ /**
59
+ * Returns all safe-mode names in ascending value order.
60
+ * @returns {string[]}
61
+ */
62
+ function names(): string[];
63
+ /**
64
+ * @returns {string[]}
65
+ */
66
+ function getNames(): string[];
67
+ }
68
+ export namespace ContentModel {
69
+ /** The block contains other blocks (sections, sidebars, admonitions, …). */
70
+ let COMPOUND: string;
71
+ /** The block holds a paragraph of prose that receives normal substitutions. */
72
+ let SIMPLE: string;
73
+ /** The block holds verbatim text displayed as-is with verbatim substitutions (listing, literal). */
74
+ let VERBATIM: string;
75
+ /** The block holds unprocessed content passed directly to output with no substitutions (pass). */
76
+ let RAW: string;
77
+ /** The block has no content (e.g. image, thematic break). */
78
+ let EMPTY: string;
79
+ }
80
+ export const LF: "\n";
81
+ export const NULL: "\0";
82
+ export const TAB: "\t";
83
+ export const MAX_INT: 9007199254740991;
84
+ export const DEFAULT_DOCTYPE: "article";
85
+ export const DEFAULT_BACKEND: "html5";
86
+ export const DEFAULT_STYLESHEET_KEYS: Set<string>;
87
+ export const DEFAULT_STYLESHEET_NAME: "asciidoctor.css";
88
+ export namespace BACKEND_ALIASES {
89
+ let html: string;
90
+ let docbook: string;
91
+ }
92
+ export namespace DEFAULT_PAGE_WIDTHS {
93
+ let docbook_1: number;
94
+ export { docbook_1 as docbook };
95
+ }
96
+ export namespace DEFAULT_EXTENSIONS {
97
+ let html_1: string;
98
+ export { html_1 as html };
99
+ let docbook_2: string;
100
+ export { docbook_2 as docbook };
101
+ export let pdf: string;
102
+ export let epub: string;
103
+ export let manpage: string;
104
+ export let asciidoc: string;
105
+ }
106
+ export const ASCIIDOC_EXTENSIONS: {
107
+ '.adoc': boolean;
108
+ '.asciidoc': boolean;
109
+ '.asc': boolean;
110
+ '.ad': boolean;
111
+ '.txt': boolean;
112
+ };
113
+ export const SETEXT_SECTION_LEVELS: {
114
+ '=': number;
115
+ '-': number;
116
+ '~': number;
117
+ '^': number;
118
+ '+': number;
119
+ };
120
+ export const ADMONITION_STYLES: Set<string>;
121
+ export const ADMONITION_STYLE_HEADS: Set<string>;
122
+ export const PARAGRAPH_STYLES: Set<string>;
123
+ export const VERBATIM_STYLES: Set<string>;
124
+ export const DELIMITED_BLOCKS: {
125
+ '--': (string | Set<string>)[];
126
+ '----': (string | Set<string>)[];
127
+ '....': (string | Set<string>)[];
128
+ '====': (string | Set<string>)[];
129
+ '****': (string | Set<any>)[];
130
+ ____: (string | Set<string>)[];
131
+ '++++': (string | Set<string>)[];
132
+ '|===': (string | Set<any>)[];
133
+ ',===': (string | Set<any>)[];
134
+ ':===': (string | Set<any>)[];
135
+ '!===': (string | Set<any>)[];
136
+ '~~~~': (string | Set<string>)[];
137
+ '////': (string | Set<any>)[];
138
+ '```': (string | Set<any>)[];
139
+ };
140
+ export const DELIMITED_BLOCK_HEADS: {
141
+ [k: string]: boolean;
142
+ };
143
+ export const DELIMITED_BLOCK_TAILS: {
144
+ [k: string]: string;
145
+ };
146
+ export namespace CAPTION_ATTRIBUTE_NAMES {
147
+ let example: string;
148
+ let figure: string;
149
+ let listing: string;
150
+ let table: string;
151
+ }
152
+ export const LAYOUT_BREAK_CHARS: {
153
+ "'": string;
154
+ '<': string;
155
+ };
156
+ export const MARKDOWN_THEMATIC_BREAK_CHARS: {
157
+ '-': string;
158
+ '*': string;
159
+ _: string;
160
+ };
161
+ export const HYBRID_LAYOUT_BREAK_CHARS: {
162
+ '-': string;
163
+ '*': string;
164
+ _: string;
165
+ "'": string;
166
+ '<': string;
167
+ };
168
+ export const NESTABLE_LIST_CONTEXTS: string[];
169
+ export const ORDERED_LIST_STYLES: string[];
170
+ export namespace ORDERED_LIST_KEYWORDS {
171
+ let loweralpha: string;
172
+ let lowerroman: string;
173
+ let upperalpha: string;
174
+ let upperroman: string;
175
+ }
176
+ export const ATTR_REF_HEAD: "{";
177
+ export const LIST_CONTINUATION: "+";
178
+ export const HARD_LINE_BREAK: " +";
179
+ export const LINE_CONTINUATION: " \\";
180
+ export const LINE_CONTINUATION_LEGACY: " +";
181
+ export namespace BLOCK_MATH_DELIMITERS {
182
+ let asciimath: string[];
183
+ let latexmath: string[];
184
+ }
185
+ export namespace INLINE_MATH_DELIMITERS {
186
+ let asciimath_1: string[];
187
+ export { asciimath_1 as asciimath };
188
+ let latexmath_1: string[];
189
+ export { latexmath_1 as latexmath };
190
+ }
191
+ export namespace STEM_TYPE_ALIASES {
192
+ let latexmath_2: string;
193
+ export { latexmath_2 as latexmath };
194
+ export let latex: string;
195
+ export let tex: string;
196
+ }
197
+ export const FONT_AWESOME_VERSION: "4.7.0";
198
+ export const HIGHLIGHT_JS_VERSION: "9.18.3";
199
+ export const MATHJAX_VERSION: "2.7.9";
200
+ export const DEFAULT_ATTRIBUTES: {
201
+ 'appendix-caption': string;
202
+ 'appendix-refsig': string;
203
+ 'caution-caption': string;
204
+ 'chapter-refsig': string;
205
+ 'example-caption': string;
206
+ 'figure-caption': string;
207
+ 'important-caption': string;
208
+ 'last-update-label': string;
209
+ 'note-caption': string;
210
+ 'part-refsig': string;
211
+ prewrap: string;
212
+ sectids: string;
213
+ 'section-refsig': string;
214
+ 'table-caption': string;
215
+ 'tip-caption': string;
216
+ 'toc-placement': string;
217
+ 'toc-title': string;
218
+ 'untitled-label': string;
219
+ 'version-label': string;
220
+ 'warning-caption': string;
221
+ };
222
+ export const FLEXIBLE_ATTRIBUTES: string[];
223
+ export const INTRINSIC_ATTRIBUTES: {
224
+ startsb: string;
225
+ endsb: string;
226
+ vbar: string;
227
+ caret: string;
228
+ asterisk: string;
229
+ tilde: string;
230
+ plus: string;
231
+ backslash: string;
232
+ backtick: string;
233
+ blank: string;
234
+ empty: string;
235
+ sp: string;
236
+ 'two-colons': string;
237
+ 'two-semicolons': string;
238
+ nbsp: string;
239
+ deg: string;
240
+ zwsp: string;
241
+ quot: string;
242
+ apos: string;
243
+ lsquo: string;
244
+ rsquo: string;
245
+ ldquo: string;
246
+ rdquo: string;
247
+ wj: string;
248
+ brvbar: string;
249
+ pp: string;
250
+ cpp: string;
251
+ cxx: string;
252
+ amp: string;
253
+ lt: string;
254
+ gt: string;
255
+ };
256
+ export namespace QUOTE_SUBS {
257
+ export { _normalQuoteSubs as false };
258
+ export { _compatQuoteSubs as true };
259
+ }
260
+ export const REPLACEMENTS: (string | RegExp)[][];
261
+ export const BASIC_SUBS: readonly string[];
262
+ export const NORMAL_SUBS: readonly string[];
263
+ export let ROOT_DIR: string;
264
+ export let LIB_DIR: string;
265
+ export let DATA_DIR: string;
266
+ export let USER_HOME: string;
267
+ declare const _normalQuoteSubs: (string | RegExp)[][];
268
+ declare const _compatQuoteSubs: (string | RegExp)[][];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Parse the AsciiDoc source input into a Document and convert it to the specified backend format.
3
+ *
4
+ * Accepts input as a Node.js Readable stream (or any object with a read() method), a String,
5
+ * or a String Array. If the input is a file-like object with a `.path` property, it is treated
6
+ * as a file: the output is written to a file adjacent to the input by default.
7
+ *
8
+ * If `to_file` is true or omitted and the input is a file-like object, the output is written
9
+ * next to the input file. If `to_file` is a String path, the output is written there.
10
+ * If `to_file` is false, the converted String is returned.
11
+ * If `to_file` is `'/dev/null'`, the document is loaded but neither converted nor written.
12
+ *
13
+ * @param {string|string[]|object} input - the AsciiDoc source (String, Array, Readable, or
14
+ * file-like object with a `.path` property)
15
+ * @param {object} [options={}] - a plain Object of options (mirrors Ruby API):
16
+ * - `to_file` {string|boolean|object} - String path, Boolean, stream object, or `'/dev/null'`
17
+ * - `to_dir` {string} - output directory
18
+ * - `mkdirs` {boolean} - create missing directories if true
19
+ * - `standalone` {boolean} - include header/footer
20
+ * - `header_footer` {boolean} - deprecated alias for `standalone`
21
+ * - `base_dir` {string} - base directory
22
+ * @returns {Promise<import('./document.js').Document|string>} the Document if output was written to a file, otherwise the converted String
23
+ */
24
+ export function convert(input: string | string[] | object, options?: object): Promise<import("./document.js").Document | string>;
25
+ /**
26
+ * Parse the contents of the AsciiDoc source file into a Document and convert it
27
+ * to the specified backend format.
28
+ *
29
+ * @param {string} filename - the path to the AsciiDoc source file
30
+ * @param {object} [options={}] - a plain Object of options (see {@link convert})
31
+ * @returns {Promise<import('./document.js').Document|string>} the Document if output was written to a file, otherwise the converted String
32
+ */
33
+ export function convertFile(filename: string, options?: object): Promise<import("./document.js").Document | string>;
34
+ export { convert as render, convertFile as renderFile };
@@ -0,0 +1,20 @@
1
+ export class CompositeConverter {
2
+ constructor(backend: any, ...args: any[]);
3
+ backend: any;
4
+ converters: any[];
5
+ _converterCache: Map<any, any>;
6
+ /**
7
+ * Delegates to the first converter that handles the given transform.
8
+ * @param {object} node - the AbstractNode to convert
9
+ * @param {string|null} [transform=null] - the optional transform (default: node.nodeName)
10
+ * @param {object|null} [opts=null] - optional hints passed to the delegate's convert method
11
+ * @returns {Promise<string>} the result from the delegate's convert method
12
+ */
13
+ convert(node: object, transform?: string | null, opts?: object | null): Promise<string>;
14
+ /**
15
+ * Retrieve the converter for the specified transform (cached).
16
+ * @param {string} transform
17
+ * @returns {object} the matching converter
18
+ */
19
+ converterFor(transform: string): object;
20
+ }
@@ -0,0 +1,41 @@
1
+ export class DocBook5Converter extends ConverterBase {
2
+ convert_document(node: any): Promise<string>;
3
+ convert_embedded(node: any): Promise<string>;
4
+ convert_section(node: any): Promise<string>;
5
+ convert_admonition(node: any): Promise<string>;
6
+ convert_audio(_node: any): Promise<string>;
7
+ convert_colist(node: any): Promise<string>;
8
+ convert_dlist(node: any): Promise<string>;
9
+ convert_example(node: any): Promise<string>;
10
+ convert_floating_title(node: any): Promise<string>;
11
+ convert_image(node: any): Promise<string>;
12
+ convert_listing(node: any): Promise<string>;
13
+ convert_literal(node: any): Promise<string>;
14
+ convert_pass(node: any): Promise<any>;
15
+ convert_stem(node: any): Promise<string>;
16
+ convert_olist(node: any): Promise<string>;
17
+ convert_open(node: any): Promise<any>;
18
+ convert_page_break(_node: any): Promise<string>;
19
+ convert_paragraph(node: any): Promise<string>;
20
+ convert_preamble(node: any): Promise<any>;
21
+ convert_quote(node: any): Promise<string>;
22
+ convert_thematic_break(_node: any): Promise<string>;
23
+ convert_sidebar(node: any): Promise<string>;
24
+ convert_table(node: any): Promise<string>;
25
+ convert_toc(_node: any): Promise<string>;
26
+ convert_ulist(node: any): Promise<string>;
27
+ convert_verse(node: any): Promise<string>;
28
+ convert_video(_node: any): Promise<string>;
29
+ convert_inline_anchor(node: any): Promise<string>;
30
+ convert_inline_break(node: any): Promise<string>;
31
+ convert_inline_button(node: any): Promise<string>;
32
+ convert_inline_callout(node: any): Promise<string>;
33
+ convert_inline_footnote(node: any): Promise<string>;
34
+ convert_inline_image(node: any): Promise<string>;
35
+ convert_inline_indexterm(node: any): Promise<string>;
36
+ convert_inline_kbd(node: any): Promise<string>;
37
+ convert_inline_menu(node: any): Promise<string>;
38
+ convert_inline_quoted(node: any): Promise<string>;
39
+ }
40
+ export default DocBook5Converter;
41
+ import { ConverterBase } from '../converter.js';
@@ -0,0 +1,51 @@
1
+ export default class Html5Converter extends ConverterBase {
2
+ /**
3
+ * Create a new Html5Converter instance.
4
+ * @param {string} [backend='html5']
5
+ * @param {Object} [opts={}]
6
+ * @returns {Html5Converter}
7
+ */
8
+ static create(backend?: string, opts?: any): Html5Converter;
9
+ _xmlMode: boolean;
10
+ _voidSlash: string;
11
+ convert_document(node: any): Promise<string>;
12
+ convert_embedded(node: any): Promise<string>;
13
+ convert_outline(node: any, opts?: {}): Promise<string>;
14
+ convert_section(node: any): Promise<string>;
15
+ convert_admonition(node: any): Promise<string>;
16
+ convert_audio(node: any): Promise<string>;
17
+ convert_colist(node: any): Promise<string>;
18
+ convert_dlist(node: any): Promise<string>;
19
+ convert_example(node: any): Promise<string>;
20
+ convert_floating_title(node: any): Promise<string>;
21
+ convert_image(node: any): Promise<string>;
22
+ convert_listing(node: any): Promise<string>;
23
+ convert_literal(node: any): Promise<string>;
24
+ convert_stem(node: any): Promise<string>;
25
+ convert_olist(node: any): Promise<string>;
26
+ convert_open(node: any): Promise<string>;
27
+ convert_page_break(_node: any): Promise<string>;
28
+ convert_paragraph(node: any): Promise<string>;
29
+ convert_pass(node: any): Promise<string>;
30
+ convert_preamble(node: any): Promise<string>;
31
+ convert_quote(node: any): Promise<string>;
32
+ convert_thematic_break(node: any): Promise<string>;
33
+ convert_sidebar(node: any): Promise<string>;
34
+ convert_table(node: any): Promise<string>;
35
+ convert_toc(node: any): Promise<string>;
36
+ convert_ulist(node: any): Promise<string>;
37
+ convert_verse(node: any): Promise<string>;
38
+ convert_video(node: any): Promise<string>;
39
+ convert_inline_anchor(node: any): Promise<string>;
40
+ convert_inline_break(node: any): Promise<string>;
41
+ convert_inline_button(node: any): Promise<string>;
42
+ convert_inline_callout(node: any): Promise<string>;
43
+ convert_inline_footnote(node: any): Promise<string>;
44
+ convert_inline_image(node: any): Promise<string>;
45
+ convert_inline_indexterm(node: any): Promise<any>;
46
+ convert_inline_kbd(node: any): Promise<string>;
47
+ convert_inline_menu(node: any): Promise<string>;
48
+ convert_inline_quoted(node: any): Promise<string>;
49
+ readSvgContents(node: any, target: any): Promise<any>;
50
+ }
51
+ import { ConverterBase } from '../converter.js';
@@ -0,0 +1,59 @@
1
+ export default class ManPageConverter extends ConverterBase {
2
+ static writeAlternatePages(mannames: any, manvolnum: any, target: any): Promise<void>;
3
+ convert_document(node: any): Promise<string>;
4
+ convert_embedded(node: any): Promise<string>;
5
+ convert_section(node: any): Promise<string>;
6
+ convert_admonition(node: any): Promise<string>;
7
+ convert_colist(node: any): Promise<string>;
8
+ convert_dlist(node: any): Promise<string>;
9
+ convert_example(node: any): Promise<string>;
10
+ convert_floating_title(node: any): Promise<string>;
11
+ convert_image(node: any): Promise<string>;
12
+ convert_listing(node: any): Promise<string>;
13
+ convert_literal(node: any): Promise<string>;
14
+ convert_sidebar(node: any): Promise<string>;
15
+ convert_olist(node: any): Promise<string>;
16
+ convert_open(node: any): Promise<any>;
17
+ convert_page_break(_node: any): Promise<string>;
18
+ convert_paragraph(node: any): Promise<string>;
19
+ convert_pass(node: any): Promise<string>;
20
+ convert_preamble(node: any): Promise<string>;
21
+ convert_quote(node: any): Promise<string>;
22
+ convert_stem(node: any): Promise<string>;
23
+ convert_table(node: any): Promise<string>;
24
+ convert_thematic_break(_node: any): Promise<string>;
25
+ convert_toc(_node: any): Promise<void>;
26
+ convert_ulist(node: any): Promise<string>;
27
+ convert_verse(node: any): Promise<string>;
28
+ convert_video(node: any): Promise<string>;
29
+ convert_inline_anchor(node: any): Promise<any>;
30
+ convert_inline_break(node: any): Promise<string>;
31
+ convert_inline_button(node: any): Promise<string>;
32
+ convert_inline_callout(node: any): Promise<string>;
33
+ convert_inline_footnote(node: any): Promise<string>;
34
+ convert_inline_image(node: any): Promise<string>;
35
+ convert_inline_indexterm(node: any): Promise<any>;
36
+ convert_inline_kbd(node: any): Promise<string>;
37
+ convert_inline_menu(node: any): Promise<string>;
38
+ convert_inline_quoted(node: any): Promise<any>;
39
+ /**
40
+ * Converts HTML entity references back to their original form, escapes
41
+ * special man characters and strips trailing whitespace.
42
+ *
43
+ * It's crucial that text only ever pass through manify once.
44
+ *
45
+ * @param {string} str - the string to convert
46
+ * @param {Object} [opts={}] - options to control processing
47
+ * @param {'preserve'|'normalize'|'collapse'} [opts.whitespace='collapse'] - how to handle whitespace:
48
+ * `'preserve'` preserves spaces (only expanding tabs);
49
+ * `'normalize'` removes spaces around newlines;
50
+ * `'collapse'` collapses adjacent whitespace to a single space
51
+ * @param {boolean} [opts.append_newline=false] - append a newline to the result
52
+ * @returns {string} the manified string
53
+ */
54
+ manify(str: string, opts?: {
55
+ whitespace?: "preserve" | "normalize" | "collapse";
56
+ append_newline?: boolean;
57
+ }): string;
58
+ }
59
+ import { ConverterBase } from '../converter.js';
@@ -0,0 +1,83 @@
1
+ export class TemplateConverter extends ConverterBase {
2
+ static _caches: {
3
+ scans: {};
4
+ templates: {};
5
+ };
6
+ static TemplateEngine: {
7
+ registry: {};
8
+ register(names: any, adapter: any): void;
9
+ };
10
+ static clearCaches(): void;
11
+ /** Alias for clearCaches() — matches the Ruby/core API name. */
12
+ static clearCache(): void;
13
+ /** Return the class-level cache object. */
14
+ static getCache(): {
15
+ scans: {};
16
+ templates: {};
17
+ };
18
+ /**
19
+ * Async factory — create and fully initialize a TemplateConverter.
20
+ * @param {string} backend
21
+ * @param {string|string[]} templateDirs
22
+ * @param {Object} [opts={}]
23
+ * @returns {Promise<TemplateConverter>}
24
+ */
25
+ static create(backend: string, templateDirs: string | string[], opts?: any): Promise<TemplateConverter>;
26
+ /**
27
+ * Construct a new TemplateConverter (synchronous setup only).
28
+ * Prefer TemplateConverter.create() which also runs the async _scan() step.
29
+ * @param {string} backend - the backend name (e.g. 'html5')
30
+ * @param {string|string[]} templateDirs - paths to scan for templates
31
+ * @param {Object} [opts={}]
32
+ * @param {string} [opts.template_engine] - engine name restriction (e.g. 'nunjucks')
33
+ * @param {Object} [opts.template_engine_options] - per-engine option objects
34
+ * @param {boolean|Object} [opts.template_cache] - true → class-level cache, Object → supplied cache
35
+ */
36
+ constructor(backend: string, templateDirs: string | string[], opts?: {
37
+ template_engine?: string;
38
+ template_engine_options?: any;
39
+ template_cache?: boolean | any;
40
+ });
41
+ _templates: {};
42
+ templateDirs: string[];
43
+ engine: string;
44
+ engineOptions: any;
45
+ caches: any;
46
+ /**
47
+ * Convert an AbstractNode to the backend format using the named template.
48
+ *
49
+ * Note: convert() is async because getContent() / applySubs() in the core package
50
+ * is async throughout. We pre-resolve content here and expose it synchronously to
51
+ * template engines (which are all synchronous) via a Proxy wrapper.
52
+ * @param {object} node - the AbstractNode to convert
53
+ * @param {string|null} [templateName=null] - the template name to use (default: node.nodeName)
54
+ * @param {object|null} [opts=null] - optional plain object passed as locals to the template
55
+ * @returns {Promise<string>}
56
+ */
57
+ convert(node: object, templateName?: string | null, opts?: object | null): Promise<string>;
58
+ /**
59
+ * Retrieve a shallow copy of the templates map.
60
+ * @returns {Object} plain object keyed by template name
61
+ */
62
+ get templates(): any;
63
+ /**
64
+ * Method alias for the templates getter — matches the core/Ruby API.
65
+ * @returns {Object} plain object keyed by template name
66
+ */
67
+ getTemplates(): any;
68
+ /**
69
+ * Register a template with this converter (and optionally the template cache).
70
+ * @param {string} name - the template name
71
+ * @param {{ render: Function, file: string }} template - the template object
72
+ * @returns {{ render: Function, file: string }} the template object
73
+ */
74
+ register(name: string, template: {
75
+ render: Function;
76
+ file: string;
77
+ }): {
78
+ render: Function;
79
+ file: string;
80
+ };
81
+ }
82
+ export default TemplateConverter;
83
+ import { ConverterBase } from '../converter.js';