@fuzdev/mdz 0.1.0
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/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/Mdz.svelte +39 -0
- package/dist/Mdz.svelte.d.ts +17 -0
- package/dist/Mdz.svelte.d.ts.map +1 -0
- package/dist/MdzNodeView.svelte +140 -0
- package/dist/MdzNodeView.svelte.d.ts +9 -0
- package/dist/MdzNodeView.svelte.d.ts.map +1 -0
- package/dist/MdzPrecompiled.svelte +33 -0
- package/dist/MdzPrecompiled.svelte.d.ts +17 -0
- package/dist/MdzPrecompiled.svelte.d.ts.map +1 -0
- package/dist/MdzRoot.svelte +40 -0
- package/dist/MdzRoot.svelte.d.ts +14 -0
- package/dist/MdzRoot.svelte.d.ts.map +1 -0
- package/dist/MdzStream.svelte +37 -0
- package/dist/MdzStream.svelte.d.ts +18 -0
- package/dist/MdzStream.svelte.d.ts.map +1 -0
- package/dist/MdzStreamNodeView.svelte +150 -0
- package/dist/MdzStreamNodeView.svelte.d.ts +9 -0
- package/dist/MdzStreamNodeView.svelte.d.ts.map +1 -0
- package/dist/context_helpers.d.ts +23 -0
- package/dist/context_helpers.d.ts.map +1 -0
- package/dist/context_helpers.js +19 -0
- package/dist/mdz.d.ts +152 -0
- package/dist/mdz.d.ts.map +1 -0
- package/dist/mdz.js +61 -0
- package/dist/mdz_contexts.d.ts +106 -0
- package/dist/mdz_contexts.d.ts.map +1 -0
- package/dist/mdz_contexts.js +42 -0
- package/dist/mdz_helpers.d.ts +321 -0
- package/dist/mdz_helpers.d.ts.map +1 -0
- package/dist/mdz_helpers.js +668 -0
- package/dist/mdz_lexer.d.ts +123 -0
- package/dist/mdz_lexer.d.ts.map +1 -0
- package/dist/mdz_lexer.js +1405 -0
- package/dist/mdz_opcodes.d.ts +193 -0
- package/dist/mdz_opcodes.d.ts.map +1 -0
- package/dist/mdz_opcodes.js +14 -0
- package/dist/mdz_opcodes_to_nodes.d.ts +26 -0
- package/dist/mdz_opcodes_to_nodes.d.ts.map +1 -0
- package/dist/mdz_opcodes_to_nodes.js +410 -0
- package/dist/mdz_stream_parser.d.ts +109 -0
- package/dist/mdz_stream_parser.d.ts.map +1 -0
- package/dist/mdz_stream_parser.js +699 -0
- package/dist/mdz_stream_parser_block.d.ts +99 -0
- package/dist/mdz_stream_parser_block.d.ts.map +1 -0
- package/dist/mdz_stream_parser_block.js +437 -0
- package/dist/mdz_stream_parser_inline.d.ts +98 -0
- package/dist/mdz_stream_parser_inline.d.ts.map +1 -0
- package/dist/mdz_stream_parser_inline.js +481 -0
- package/dist/mdz_stream_parser_link.d.ts +29 -0
- package/dist/mdz_stream_parser_link.d.ts.map +1 -0
- package/dist/mdz_stream_parser_link.js +227 -0
- package/dist/mdz_stream_parser_list.d.ts +106 -0
- package/dist/mdz_stream_parser_list.d.ts.map +1 -0
- package/dist/mdz_stream_parser_list.js +438 -0
- package/dist/mdz_stream_parser_state.d.ts +476 -0
- package/dist/mdz_stream_parser_state.d.ts.map +1 -0
- package/dist/mdz_stream_parser_state.js +651 -0
- package/dist/mdz_stream_parser_text.d.ts +25 -0
- package/dist/mdz_stream_parser_text.d.ts.map +1 -0
- package/dist/mdz_stream_parser_text.js +67 -0
- package/dist/mdz_stream_parser_url.d.ts +76 -0
- package/dist/mdz_stream_parser_url.d.ts.map +1 -0
- package/dist/mdz_stream_parser_url.js +328 -0
- package/dist/mdz_stream_state.svelte.d.ts +53 -0
- package/dist/mdz_stream_state.svelte.d.ts.map +1 -0
- package/dist/mdz_stream_state.svelte.js +360 -0
- package/dist/mdz_to_svelte.d.ts +71 -0
- package/dist/mdz_to_svelte.d.ts.map +1 -0
- package/dist/mdz_to_svelte.js +127 -0
- package/dist/mdz_token_parser.d.ts +20 -0
- package/dist/mdz_token_parser.d.ts.map +1 -0
- package/dist/mdz_token_parser.js +449 -0
- package/dist/svelte_preprocess_mdz.d.ts +80 -0
- package/dist/svelte_preprocess_mdz.d.ts.map +1 -0
- package/dist/svelte_preprocess_mdz.js +543 -0
- package/dist/tsdoc_mdz.d.ts +45 -0
- package/dist/tsdoc_mdz.d.ts.map +1 -0
- package/dist/tsdoc_mdz.js +88 -0
- package/package.json +131 -0
- package/src/lib/context_helpers.ts +52 -0
- package/src/lib/mdz.ts +190 -0
- package/src/lib/mdz_contexts.ts +99 -0
- package/src/lib/mdz_helpers.ts +727 -0
- package/src/lib/mdz_lexer.ts +1761 -0
- package/src/lib/mdz_opcodes.ts +227 -0
- package/src/lib/mdz_opcodes_to_nodes.ts +470 -0
- package/src/lib/mdz_stream_parser.ts +766 -0
- package/src/lib/mdz_stream_parser_block.ts +490 -0
- package/src/lib/mdz_stream_parser_inline.ts +527 -0
- package/src/lib/mdz_stream_parser_link.ts +283 -0
- package/src/lib/mdz_stream_parser_list.ts +525 -0
- package/src/lib/mdz_stream_parser_state.ts +957 -0
- package/src/lib/mdz_stream_parser_text.ts +95 -0
- package/src/lib/mdz_stream_parser_url.ts +386 -0
- package/src/lib/mdz_stream_state.svelte.ts +383 -0
- package/src/lib/mdz_to_svelte.ts +213 -0
- package/src/lib/mdz_token_parser.ts +544 -0
- package/src/lib/svelte_preprocess_mdz.ts +777 -0
- package/src/lib/tsdoc_mdz.ts +97 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants and pure helper functions for mdz parsers.
|
|
3
|
+
*
|
|
4
|
+
* Used by both the synchronous parser (`mdz_lexer.ts` + `mdz_token_parser.ts`)
|
|
5
|
+
* and the streaming parser (`mdz_stream_parser.ts`).
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { MdzNode, MdzNodeComponent, MdzNodeElement } from './mdz.js';
|
|
10
|
+
/** @nodocs */
|
|
11
|
+
export declare const BACKTICK = 96;
|
|
12
|
+
/** @nodocs */
|
|
13
|
+
export declare const ASTERISK = 42;
|
|
14
|
+
/** @nodocs */
|
|
15
|
+
export declare const UNDERSCORE = 95;
|
|
16
|
+
/** @nodocs */
|
|
17
|
+
export declare const TILDE = 126;
|
|
18
|
+
/** @nodocs */
|
|
19
|
+
export declare const NEWLINE = 10;
|
|
20
|
+
/** @nodocs */
|
|
21
|
+
export declare const HYPHEN = 45;
|
|
22
|
+
/** @nodocs */
|
|
23
|
+
export declare const HASH = 35;
|
|
24
|
+
/** @nodocs */
|
|
25
|
+
export declare const SPACE = 32;
|
|
26
|
+
/** @nodocs */
|
|
27
|
+
export declare const TAB = 9;
|
|
28
|
+
/** @nodocs */
|
|
29
|
+
export declare const CARRIAGE_RETURN = 13;
|
|
30
|
+
/** @nodocs */
|
|
31
|
+
export declare const LEFT_ANGLE = 60;
|
|
32
|
+
/** @nodocs */
|
|
33
|
+
export declare const RIGHT_ANGLE = 62;
|
|
34
|
+
/** @nodocs */
|
|
35
|
+
export declare const SLASH = 47;
|
|
36
|
+
/** @nodocs */
|
|
37
|
+
export declare const LEFT_BRACKET = 91;
|
|
38
|
+
/** @nodocs */
|
|
39
|
+
export declare const RIGHT_BRACKET = 93;
|
|
40
|
+
/** @nodocs */
|
|
41
|
+
export declare const LEFT_PAREN = 40;
|
|
42
|
+
/** @nodocs */
|
|
43
|
+
export declare const RIGHT_PAREN = 41;
|
|
44
|
+
/** @nodocs */
|
|
45
|
+
export declare const COLON = 58;
|
|
46
|
+
/** @nodocs */
|
|
47
|
+
export declare const PERIOD = 46;
|
|
48
|
+
/** @nodocs */
|
|
49
|
+
export declare const COMMA = 44;
|
|
50
|
+
/** @nodocs */
|
|
51
|
+
export declare const SEMICOLON = 59;
|
|
52
|
+
/** @nodocs */
|
|
53
|
+
export declare const EXCLAMATION = 33;
|
|
54
|
+
/** @nodocs */
|
|
55
|
+
export declare const QUESTION = 63;
|
|
56
|
+
/** @nodocs */
|
|
57
|
+
export declare const DOLLAR = 36;
|
|
58
|
+
/** @nodocs */
|
|
59
|
+
export declare const PERCENT = 37;
|
|
60
|
+
/** @nodocs */
|
|
61
|
+
export declare const AMPERSAND = 38;
|
|
62
|
+
/** @nodocs */
|
|
63
|
+
export declare const APOSTROPHE = 39;
|
|
64
|
+
/** @nodocs */
|
|
65
|
+
export declare const PLUS = 43;
|
|
66
|
+
/** @nodocs */
|
|
67
|
+
export declare const EQUALS = 61;
|
|
68
|
+
/** @nodocs */
|
|
69
|
+
export declare const AT = 64;
|
|
70
|
+
/** @nodocs */
|
|
71
|
+
export declare const A_UPPER = 65;
|
|
72
|
+
/** @nodocs */
|
|
73
|
+
export declare const Z_UPPER = 90;
|
|
74
|
+
/** @nodocs */
|
|
75
|
+
export declare const A_LOWER = 97;
|
|
76
|
+
/** @nodocs */
|
|
77
|
+
export declare const Z_LOWER = 122;
|
|
78
|
+
/** @nodocs */
|
|
79
|
+
export declare const ZERO = 48;
|
|
80
|
+
/** @nodocs */
|
|
81
|
+
export declare const ONE = 49;
|
|
82
|
+
/** @nodocs */
|
|
83
|
+
export declare const NINE = 57;
|
|
84
|
+
/** @nodocs */
|
|
85
|
+
export declare const HR_HYPHEN_COUNT = 3;
|
|
86
|
+
/** @nodocs */
|
|
87
|
+
export declare const MIN_CODEBLOCK_BACKTICKS = 3;
|
|
88
|
+
/** @nodocs */
|
|
89
|
+
export declare const MAX_LIST_NUMBER_DIGITS = 9;
|
|
90
|
+
/** @nodocs */
|
|
91
|
+
export declare const MAX_HEADING_LEVEL = 6;
|
|
92
|
+
/** @nodocs */
|
|
93
|
+
export declare const HTTPS_PREFIX_LENGTH = 8;
|
|
94
|
+
/** @nodocs */
|
|
95
|
+
export declare const HTTP_PREFIX_LENGTH = 7;
|
|
96
|
+
/** @nodocs */
|
|
97
|
+
export declare const H_LOWER = 104;
|
|
98
|
+
/** @nodocs */
|
|
99
|
+
export declare const H_UPPER = 72;
|
|
100
|
+
/**
|
|
101
|
+
* Whether a char code is whitespace within a line — space, tab, or `\r` —
|
|
102
|
+
* everything but the newline itself. A line consisting only of these counts
|
|
103
|
+
* as blank (paragraph breaks), and trailing runs of them are tolerated but
|
|
104
|
+
* never significant (HR and fence lines). `\r` is included so CRLF input
|
|
105
|
+
* gets blank-line and end-of-line behavior for free; mdz does no other CRLF
|
|
106
|
+
* handling.
|
|
107
|
+
*
|
|
108
|
+
* @nodocs
|
|
109
|
+
*/
|
|
110
|
+
export declare const is_line_whitespace: (char_code: number) => boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Whether `text` contains any non-whitespace character — the
|
|
113
|
+
* whitespace-only-paragraph drop shared by both parsers. Hot path in the
|
|
114
|
+
* streaming parser (called from `emit` on every text emission); the char
|
|
115
|
+
* loop avoids the regex allocation `/\S/.test()` incurs per call.
|
|
116
|
+
*
|
|
117
|
+
* Deliberately ASCII-only (space, tab, LF, CR, FF, VT), matching the
|
|
118
|
+
* grammar's blank-line definition: a line of Unicode-only whitespace
|
|
119
|
+
* (U+00A0 NBSP, U+3000, etc.) is content, not blank — CommonMark agrees.
|
|
120
|
+
* `/\S/` and `String.prototype.trim()` would recognize Unicode whitespace
|
|
121
|
+
* and silently drop such paragraphs.
|
|
122
|
+
*
|
|
123
|
+
* @nodocs
|
|
124
|
+
*/
|
|
125
|
+
export declare const has_non_whitespace: (text: string) => boolean;
|
|
126
|
+
/**
|
|
127
|
+
* A matched blockquote prefix: a run of `>` markers — tight (`>>`) or
|
|
128
|
+
* separated by single spaces (`> >`), interchangeably — terminated by exactly
|
|
129
|
+
* one space or the end of the line. Depth is the count of `>`.
|
|
130
|
+
*
|
|
131
|
+
* @nodocs
|
|
132
|
+
*/
|
|
133
|
+
export interface MdzBlockquotePrefix {
|
|
134
|
+
/** Count of `>` markers. */
|
|
135
|
+
depth: number;
|
|
136
|
+
/**
|
|
137
|
+
* Index just past the prefix: after the terminating space, or at the
|
|
138
|
+
* line-end whitespace/newline for a bare (empty) prefix line.
|
|
139
|
+
*/
|
|
140
|
+
content_start: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Match a blockquote prefix at `i` (the position of a `>`). Shared by both
|
|
144
|
+
* parsers — the sync lexer calls with `forced` true (its text is complete);
|
|
145
|
+
* the streaming parser gets `'pending'` when the buffer ends before the
|
|
146
|
+
* prefix can resolve.
|
|
147
|
+
*
|
|
148
|
+
* Returns null when the line has no valid prefix: a `>` followed directly by
|
|
149
|
+
* content (`>a`), a tab instead of the marker space (`>\ta`), or a tight run
|
|
150
|
+
* with trailing content (`>>x`). The backtrack pin: a `>` not followed by
|
|
151
|
+
* space, end-of-line, or a continuing run is content, and the separator space
|
|
152
|
+
* before it re-serves as the terminator — `> >x` is a depth-1 prefix with
|
|
153
|
+
* content `>x`. A `>` followed by only whitespace to the line end is a valid
|
|
154
|
+
* bare prefix (trailing whitespace tolerated, never significant).
|
|
155
|
+
*
|
|
156
|
+
* @nodocs
|
|
157
|
+
*/
|
|
158
|
+
export declare const mdz_match_blockquote_prefix: (text: string, i: number, forced: boolean) => MdzBlockquotePrefix | "pending" | null;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the line at a quote prefix's `content_start` has non-whitespace
|
|
161
|
+
* content before its end — the no-empty-start probe for quote opens
|
|
162
|
+
* (contentless prefix lines never start a quote). `'pending'` when the buffer
|
|
163
|
+
* ends inside the trailing whitespace run while streaming.
|
|
164
|
+
*
|
|
165
|
+
* @nodocs
|
|
166
|
+
*/
|
|
167
|
+
export declare const mdz_blockquote_line_has_content: (text: string, content_start: number, forced: boolean) => boolean | "pending";
|
|
168
|
+
/**
|
|
169
|
+
* The one-level strip width for a quote line: the first `>` plus its single
|
|
170
|
+
* following space when present. Stripping one level leaves any deeper prefix
|
|
171
|
+
* in the content for the nested document to parse — `>> a` strips to `> a`.
|
|
172
|
+
*
|
|
173
|
+
* @nodocs
|
|
174
|
+
*/
|
|
175
|
+
export declare const mdz_blockquote_strip_width: (text: string, i: number) => number;
|
|
176
|
+
/**
|
|
177
|
+
* Map a position in a blockquote's stripped inner document back to its
|
|
178
|
+
* source offset. Each segment covers one quote line's content plus its
|
|
179
|
+
* terminating newline — contiguous in both coordinate spaces, so the map is
|
|
180
|
+
* affine per segment. A binary search for the rightmost segment at or before
|
|
181
|
+
* `p` always lands correctly, including the end-exclusive position past the
|
|
182
|
+
* final line.
|
|
183
|
+
*
|
|
184
|
+
* @nodocs
|
|
185
|
+
*/
|
|
186
|
+
export declare const mdz_remap_segments: (segments: Array<{
|
|
187
|
+
inner_start: number;
|
|
188
|
+
source_start: number;
|
|
189
|
+
}>, p: number) => number;
|
|
190
|
+
/**
|
|
191
|
+
* Lowercase an ASCII letter code; passes other chars through.
|
|
192
|
+
* Mirrors the `[A-Z] → [a-z]` shift without touching non-ASCII.
|
|
193
|
+
*
|
|
194
|
+
* @nodocs
|
|
195
|
+
*/
|
|
196
|
+
export declare const ascii_to_lower: (char_code: number) => number;
|
|
197
|
+
/**
|
|
198
|
+
* Case-insensitive URL scheme prefix check. Returns the prefix length
|
|
199
|
+
* (8 for `https://`, 7 for `http://`) or 0 if neither matches at `pos`.
|
|
200
|
+
*
|
|
201
|
+
* URI schemes are case-insensitive per RFC 3986 §3.1, and mobile keyboards
|
|
202
|
+
* routinely auto-capitalize the first letter of a sentence, producing
|
|
203
|
+
* `Https://` etc. The original case is preserved in the emitted reference —
|
|
204
|
+
* browsers normalize schemes themselves.
|
|
205
|
+
*
|
|
206
|
+
* @nodocs
|
|
207
|
+
*/
|
|
208
|
+
export declare const match_url_prefix_case_insensitive: (s: string, pos: number) => 0 | 7 | 8;
|
|
209
|
+
/**
|
|
210
|
+
* Check if character code is a letter (A-Z, a-z).
|
|
211
|
+
*
|
|
212
|
+
* @nodocs
|
|
213
|
+
*/
|
|
214
|
+
export declare const is_letter: (char_code: number) => boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Check if character code is valid for tag name (letter, number, hyphen, underscore).
|
|
217
|
+
*
|
|
218
|
+
* @nodocs
|
|
219
|
+
*/
|
|
220
|
+
export declare const is_tag_name_char: (char_code: number) => boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Check if character is part of a word for word boundary detection.
|
|
223
|
+
* Used to prevent intraword emphasis with the `_` delimiter.
|
|
224
|
+
*
|
|
225
|
+
* Only alphanumeric characters (A-Z, a-z, 0-9) are word characters.
|
|
226
|
+
* Formatting delimiters (`*`, `_`, `~`) fall outside all three ranges,
|
|
227
|
+
* so they're naturally excluded without explicit checks.
|
|
228
|
+
*
|
|
229
|
+
* This prevents false positives with snake_case identifiers while allowing
|
|
230
|
+
* adjacent formatting like `**bold**_italic_`.
|
|
231
|
+
*
|
|
232
|
+
* @nodocs
|
|
233
|
+
*/
|
|
234
|
+
export declare const is_word_char: (char_code: number) => boolean;
|
|
235
|
+
/** @nodocs */
|
|
236
|
+
export declare const is_valid_path_char: (char_code: number) => boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Trim trailing punctuation from URL/path per RFC 3986 and GFM rules.
|
|
239
|
+
* - Trims simple trailing: .,;:!?]
|
|
240
|
+
* - Balanced logic for () only (valid in path components)
|
|
241
|
+
*
|
|
242
|
+
* Note on `]`: the mdz parsers (`mdz.ts`, `mdz_stream_parser_url.ts`,
|
|
243
|
+
* `mdz_lexer.ts`) scan URL/path chars through `is_valid_path_char`, which
|
|
244
|
+
* already rejects `]` — so it can never reach this function via parser flow.
|
|
245
|
+
* The `]` branch here is for external callers using this helper directly on
|
|
246
|
+
* arbitrary URL-ish input as part of the published `@fuzdev/mdz` surface.
|
|
247
|
+
*
|
|
248
|
+
* Optimized to avoid O(n²) string slicing - tracks end index and slices once at the end.
|
|
249
|
+
*/
|
|
250
|
+
export declare const mdz_trim_url_punctuation: (url: string) => string;
|
|
251
|
+
/**
|
|
252
|
+
* Check if position in text is the start of an absolute path (starts with `/`).
|
|
253
|
+
* Must be preceded by whitespace or be at the start of the string.
|
|
254
|
+
* Rejects `//` (comments/protocol-relative) and slash followed by whitespace.
|
|
255
|
+
*
|
|
256
|
+
* @nodocs
|
|
257
|
+
*/
|
|
258
|
+
export declare const is_at_absolute_path: (text: string, index: number) => boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Check if position in text is the start of a relative path (`./` or `../`).
|
|
261
|
+
* Must be preceded by whitespace or be at the start of the string.
|
|
262
|
+
* Rejects prefix followed by whitespace, slash, or end of string.
|
|
263
|
+
*
|
|
264
|
+
* @nodocs
|
|
265
|
+
*/
|
|
266
|
+
export declare const is_at_relative_path: (text: string, index: number) => boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Extracts plain text content from an array of mdz nodes, recursing into children.
|
|
269
|
+
*/
|
|
270
|
+
export declare const mdz_text_content: (nodes: Array<MdzNode>) => string;
|
|
271
|
+
/**
|
|
272
|
+
* Generates a lowercase slug id for a heading from its child nodes.
|
|
273
|
+
* Follows standard markdown conventions (GitHub, etc.) where heading IDs are lowercased.
|
|
274
|
+
*/
|
|
275
|
+
export declare const mdz_heading_id: (nodes: Array<MdzNode>) => string;
|
|
276
|
+
/**
|
|
277
|
+
* Generates a lowercase slug id for a heading from plain text content.
|
|
278
|
+
* Used by the streaming parser which tracks text content directly
|
|
279
|
+
* rather than building `MdzNode[]` trees.
|
|
280
|
+
*/
|
|
281
|
+
export declare const mdz_heading_id_from_text: (text: string) => string;
|
|
282
|
+
export declare const mdz_is_url: (s: string) => boolean;
|
|
283
|
+
export declare const mdz_is_safe_reference: (reference: string) => boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Check if an element name is an HTML void element (`br`, `img`, `hr`, ...).
|
|
286
|
+
* Void elements render self-closing; any parsed children are dropped.
|
|
287
|
+
*/
|
|
288
|
+
export declare const mdz_is_void_element: (name: string) => boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Resolves a relative path (`./` or `../`) against a base path.
|
|
291
|
+
* The base is treated as a directory regardless of trailing slash
|
|
292
|
+
* (`'/docs/usage'` and `'/docs/usage/'` behave identically).
|
|
293
|
+
* Handles embedded `.` and `..` segments within the reference
|
|
294
|
+
* (e.g., `'./a/../b'` → navigates up then down).
|
|
295
|
+
* Clamps at root — excess `..` segments stop at `/` rather than escaping.
|
|
296
|
+
*
|
|
297
|
+
* @param reference - a relative path starting with `./` or `../`
|
|
298
|
+
* @param base - An absolute base path (e.g., `'/docs/usage/'`). Empty string is treated as root.
|
|
299
|
+
* @returns an absolute resolved path (e.g., `'/docs/usage/grammar'`)
|
|
300
|
+
*/
|
|
301
|
+
export declare const mdz_resolve_relative_path: (reference: string, base: string) => string;
|
|
302
|
+
/**
|
|
303
|
+
* Push a node into a children array, coalescing with the previous Text node.
|
|
304
|
+
* Mutates `prev.content` and `prev.end` when both are Text, avoiding array growth
|
|
305
|
+
* and an extra allocation. Callers must own `dest` and not retain references to
|
|
306
|
+
* the prior last element across the call.
|
|
307
|
+
*/
|
|
308
|
+
export declare const mdz_push_merging_text: (dest: Array<MdzNode>, node: MdzNode) => void;
|
|
309
|
+
/**
|
|
310
|
+
* Return a new array with adjacent Text nodes merged into single nodes.
|
|
311
|
+
* Fast path: returns the original array when no merging is needed.
|
|
312
|
+
*/
|
|
313
|
+
export declare const mdz_merge_adjacent_text: (nodes: Array<MdzNode>) => Array<MdzNode>;
|
|
314
|
+
/**
|
|
315
|
+
* Extracts a single tag (component or element) if it's the only non-whitespace content.
|
|
316
|
+
*
|
|
317
|
+
* @returns the tag node if paragraph wrapping should be skipped (MDX convention),
|
|
318
|
+
* or `null` if the content should be wrapped in a paragraph
|
|
319
|
+
*/
|
|
320
|
+
export declare const mdz_extract_single_tag: (nodes: Array<MdzNode>) => MdzNodeComponent | MdzNodeElement | null;
|
|
321
|
+
//# sourceMappingURL=mdz_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdz_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAe,gBAAgB,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAGrF,cAAc;AACd,eAAO,MAAM,QAAQ,KAAK,CAAC;AAC3B,cAAc;AACd,eAAO,MAAM,QAAQ,KAAK,CAAC;AAC3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