@fuzdev/mdz 0.1.0 → 0.3.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/README.md +4 -0
- package/dist/Mdz.svelte +15 -7
- package/dist/Mdz.svelte.d.ts +9 -2
- package/dist/Mdz.svelte.d.ts.map +1 -1
- package/dist/MdzNodeView.svelte +130 -95
- package/dist/MdzNodeView.svelte.d.ts +6 -2
- package/dist/MdzNodeView.svelte.d.ts.map +1 -1
- package/dist/MdzStream.svelte +3 -3
- package/dist/MdzStream.svelte.d.ts.map +1 -1
- package/dist/MdzStreamNodeView.svelte +129 -95
- package/dist/MdzStreamNodeView.svelte.d.ts +6 -2
- package/dist/MdzStreamNodeView.svelte.d.ts.map +1 -1
- package/dist/context_helpers.d.ts +1 -1
- package/dist/mdz.d.ts +59 -2
- package/dist/mdz.d.ts.map +1 -1
- package/dist/mdz.js +37 -1
- package/dist/mdz_debug_work.d.ts +38 -0
- package/dist/mdz_debug_work.d.ts.map +1 -0
- package/dist/mdz_debug_work.js +37 -0
- package/dist/mdz_helpers.d.ts +96 -1
- package/dist/mdz_helpers.d.ts.map +1 -1
- package/dist/mdz_helpers.js +192 -0
- package/dist/mdz_lexer.d.ts +47 -1
- package/dist/mdz_lexer.d.ts.map +1 -1
- package/dist/mdz_lexer.js +364 -15
- package/dist/mdz_opcodes.d.ts +6 -1
- package/dist/mdz_opcodes.d.ts.map +1 -1
- package/dist/mdz_opcodes_to_nodes.d.ts.map +1 -1
- package/dist/mdz_opcodes_to_nodes.js +26 -0
- package/dist/mdz_stream_parser.d.ts.map +1 -1
- package/dist/mdz_stream_parser.js +20 -1
- package/dist/mdz_stream_parser_inline.d.ts.map +1 -1
- package/dist/mdz_stream_parser_inline.js +19 -17
- package/dist/mdz_stream_parser_link.d.ts.map +1 -1
- package/dist/mdz_stream_parser_link.js +88 -56
- package/dist/mdz_stream_parser_list.d.ts.map +1 -1
- package/dist/mdz_stream_parser_list.js +32 -3
- package/dist/mdz_stream_parser_state.d.ts +41 -0
- package/dist/mdz_stream_parser_state.d.ts.map +1 -1
- package/dist/mdz_stream_parser_state.js +53 -3
- package/dist/mdz_stream_parser_table.d.ts +73 -0
- package/dist/mdz_stream_parser_table.d.ts.map +1 -0
- package/dist/mdz_stream_parser_table.js +362 -0
- package/dist/mdz_stream_parser_text.d.ts.map +1 -1
- package/dist/mdz_stream_parser_text.js +35 -24
- package/dist/mdz_stream_state.svelte.d.ts +5 -0
- package/dist/mdz_stream_state.svelte.d.ts.map +1 -1
- package/dist/mdz_stream_state.svelte.js +8 -0
- package/dist/mdz_to_svelte.d.ts.map +1 -1
- package/dist/mdz_to_svelte.js +51 -20
- package/dist/mdz_token_parser.d.ts +16 -0
- package/dist/mdz_token_parser.d.ts.map +1 -1
- package/dist/mdz_token_parser.js +112 -14
- package/dist/svelte_preprocess_mdz.js +33 -39
- package/package.json +11 -8
- package/src/lib/context_helpers.ts +1 -1
- package/src/lib/mdz.ts +79 -3
- package/src/lib/mdz_contexts.ts +1 -1
- package/src/lib/mdz_debug_work.ts +38 -0
- package/src/lib/mdz_helpers.ts +222 -1
- package/src/lib/mdz_lexer.ts +420 -21
- package/src/lib/mdz_opcodes.ts +10 -1
- package/src/lib/mdz_opcodes_to_nodes.ts +37 -3
- package/src/lib/mdz_stream_parser.ts +26 -9
- package/src/lib/mdz_stream_parser_block.ts +2 -2
- package/src/lib/mdz_stream_parser_inline.ts +25 -21
- package/src/lib/mdz_stream_parser_link.ts +92 -59
- package/src/lib/mdz_stream_parser_list.ts +34 -6
- package/src/lib/mdz_stream_parser_state.ts +87 -5
- package/src/lib/mdz_stream_parser_table.ts +420 -0
- package/src/lib/mdz_stream_parser_text.ts +40 -39
- package/src/lib/mdz_stream_parser_url.ts +2 -2
- package/src/lib/mdz_stream_state.svelte.ts +8 -1
- package/src/lib/mdz_to_svelte.ts +49 -23
- package/src/lib/mdz_token_parser.ts +135 -21
- package/src/lib/svelte_preprocess_mdz.ts +37 -38
- package/src/lib/tsdoc_mdz.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_opcodes.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_opcodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAC7B,WAAW,GACX,MAAM,GACN,QAAQ,GACR,eAAe,GACf,MAAM,GACN,SAAS,GACT,MAAM,GACN,UAAU,GACV,YAAY,GACZ,SAAS,GACT,WAAW,GACX,WAAW,GACX,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"mdz_opcodes.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_opcodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAC7B,WAAW,GACX,MAAM,GACN,QAAQ,GACR,eAAe,GACf,MAAM,GACN,SAAS,GACT,MAAM,GACN,UAAU,GACV,YAAY,GACZ,SAAS,GACT,WAAW,GACX,WAAW,GACX,MAAM,GACN,OAAO,GACP,UAAU,GACV,WAAW,CAAC;AAEf,mDAAmD;AACnD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC;AAEnC,4FAA4F;AAC5F,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,SAAS,CAAC;IACd,SAAS,EAAE,oBAAoB,CAAC;IAChC,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,KAAK,CAAC,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M,SAAS,GAClB,aAAa,GACb,cAAc,GACd,aAAa,GACb,mBAAmB,GACnB,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_opcodes_to_nodes.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_opcodes_to_nodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EACX,OAAO,
|
|
1
|
+
{"version":3,"file":"mdz_opcodes_to_nodes.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_opcodes_to_nodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EACX,OAAO,EASP,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAC,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAyB3D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,KAAK,CAAC,SAAS,CAAC,KAAG,KAAK,CAAC,OAAO,CAgM7E,CAAC"}
|
|
@@ -43,6 +43,8 @@ export const mdz_opcodes_to_nodes = (opcodes) => {
|
|
|
43
43
|
ordered: op.ordered,
|
|
44
44
|
start_number: op.start_number,
|
|
45
45
|
number: op.number,
|
|
46
|
+
align: op.align,
|
|
47
|
+
header: op.header,
|
|
46
48
|
});
|
|
47
49
|
break;
|
|
48
50
|
}
|
|
@@ -359,6 +361,30 @@ const build_node = (frame, frame_children) => {
|
|
|
359
361
|
const end = frame_children.length > 0 ? frame_children[frame_children.length - 1].end : frame.end;
|
|
360
362
|
return { type: 'Blockquote', children: frame_children, start: frame.start, end };
|
|
361
363
|
}
|
|
364
|
+
case 'Table': {
|
|
365
|
+
// rows are the only children — `end` derives from the last, matching
|
|
366
|
+
// the sync token parser
|
|
367
|
+
const children = frame_children;
|
|
368
|
+
const end = children.length > 0 ? children[children.length - 1].end : frame.end;
|
|
369
|
+
return { type: 'Table', align: frame.align ?? [], children, start: frame.start, end };
|
|
370
|
+
}
|
|
371
|
+
case 'TableRow': {
|
|
372
|
+
const children = frame_children;
|
|
373
|
+
return {
|
|
374
|
+
type: 'TableRow',
|
|
375
|
+
header: frame.header ?? false,
|
|
376
|
+
children,
|
|
377
|
+
start: frame.start,
|
|
378
|
+
end: frame.end,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
case 'TableCell':
|
|
382
|
+
return {
|
|
383
|
+
type: 'TableCell',
|
|
384
|
+
children: mdz_merge_adjacent_text(frame_children),
|
|
385
|
+
start: frame.start,
|
|
386
|
+
end: frame.end,
|
|
387
|
+
};
|
|
362
388
|
case 'Code': {
|
|
363
389
|
// optimistic inline code container — concatenate children text into leaf MdzNodeCode
|
|
364
390
|
let content = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_stream_parser.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"mdz_stream_parser.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAiFhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qBAAa,eAAe;;IAG3B;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,IAAI,IAAI;IAId;;;OAGG;IACH,YAAY,IAAI,KAAK,CAAC,SAAS,CAAC;CAKhC"}
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
*
|
|
35
35
|
* @module
|
|
36
36
|
*/
|
|
37
|
-
import { BACKTICK, ASTERISK, UNDERSCORE, TILDE, NEWLINE, HYPHEN, HASH, LEFT_ANGLE, RIGHT_ANGLE, SLASH, LEFT_BRACKET, RIGHT_BRACKET, H_LOWER, H_UPPER, PERIOD, SPACE, ZERO, NINE, is_word_char, is_line_whitespace, mdz_match_blockquote_prefix, mdz_blockquote_line_has_content, mdz_blockquote_strip_width, mdz_remap_segments, } from './mdz_helpers.js';
|
|
37
|
+
import { BACKTICK, ASTERISK, UNDERSCORE, TILDE, NEWLINE, HYPHEN, HASH, PIPE, LEFT_ANGLE, RIGHT_ANGLE, SLASH, LEFT_BRACKET, RIGHT_BRACKET, H_LOWER, H_UPPER, PERIOD, SPACE, ZERO, NINE, is_word_char, is_line_whitespace, mdz_match_blockquote_prefix, mdz_blockquote_line_has_content, mdz_blockquote_strip_width, mdz_remap_segments, } from './mdz_helpers.js';
|
|
38
38
|
import { accumulate_text, alloc_id, close_all_list_levels, close_codeblock_at_eof, close_heading, close_paragraph, create_state, emit, find_open, flush_text, handle_paragraph_break, offset, pop_stack_entry, push_stack_entry, revert_failed_close, } from './mdz_stream_parser_state.js';
|
|
39
39
|
import { process_codeblock, process_codeblock_forced, process_codeblock_in_item, try_codeblock_open, try_heading, try_hr, } from './mdz_stream_parser_block.js';
|
|
40
40
|
import { process_list_line, try_list_start } from './mdz_stream_parser_list.js';
|
|
41
|
+
import { close_table, process_table_line, try_table_start } from './mdz_stream_parser_table.js';
|
|
41
42
|
import { check_close_word_boundary, close_delimiter, process_code_content, try_code, try_double_delimiter, try_italic, } from './mdz_stream_parser_inline.js';
|
|
42
43
|
import { try_close_tag, try_complete_link, try_link_open, try_tag_open, } from './mdz_stream_parser_link.js';
|
|
43
44
|
import { complete_pending_url, process_url_content, start_speculative_url, try_auto_path_absolute, try_auto_path_relative, try_auto_url_forced, } from './mdz_stream_parser_url.js';
|
|
@@ -146,6 +147,11 @@ const finish_state = (state) => {
|
|
|
146
147
|
if (state.buffer.length > 0) {
|
|
147
148
|
process_loop(state, true);
|
|
148
149
|
}
|
|
150
|
+
// close an open top-level table — forced processing ends it at the last
|
|
151
|
+
// row, but an already-drained buffer (everything consumed) needs this net
|
|
152
|
+
if (state.table) {
|
|
153
|
+
close_table(state);
|
|
154
|
+
}
|
|
149
155
|
// close an open blockquote — finishes its nested inner document (an
|
|
150
156
|
// unclosed fence inside ends at the quote's EOF, which is this) and
|
|
151
157
|
// cascades recursively through deeper quotes
|
|
@@ -477,6 +483,12 @@ const process_loop = (state, forced) => {
|
|
|
477
483
|
process_url_content(state, forced);
|
|
478
484
|
continue;
|
|
479
485
|
}
|
|
486
|
+
// open table — each line is a body row or ends the table
|
|
487
|
+
if (state.table) {
|
|
488
|
+
if (!process_table_line(state, forced))
|
|
489
|
+
return; // need more input
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
480
492
|
const char_code = state.buffer.charCodeAt(state.pos);
|
|
481
493
|
// newline handling
|
|
482
494
|
if (char_code === NEWLINE) {
|
|
@@ -567,6 +579,13 @@ const process_loop = (state, forced) => {
|
|
|
567
579
|
if (!forced && r === 'need_more')
|
|
568
580
|
return;
|
|
569
581
|
}
|
|
582
|
+
else if (char_code === PIPE) {
|
|
583
|
+
const r = try_table_start(state, forced);
|
|
584
|
+
if (r === 'consumed')
|
|
585
|
+
continue;
|
|
586
|
+
if (!forced && r === 'need_more')
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
570
589
|
}
|
|
571
590
|
// inline processing
|
|
572
591
|
if (!process_inline(state, forced))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_stream_parser_inline.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser_inline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,OAAO,EACN,KAAK,oBAAoB,EAYzB,MAAM,8BAA8B,CAAC;AA6GtC;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAo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,KAAG,OAuBhF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,GAChC,OAAO,oBAAoB,EAC3B,gBAAc,KACZ,WAAW,GAAG,UAAU,GAAG,SAmB7B,CAAC;AAIF,cAAc;AACd,eAAO,MAAM,QAAQ,GAAI,OAAO,oBAAoB,EAAE,gBAAc,KAAG,OAwFtE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,oBAAoB,EAAE,MAAM,MAAM,KAAG,MAyB7E,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,GAAI,OAAO,oBAAoB,KAAG,OAO5E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,oBAAoB,KAAG,IA2ClE,CAAC"}
|
|
@@ -297,15 +297,20 @@ export const scan_closer_boundary = (state, forced = false) => {
|
|
|
297
297
|
/** @nodocs */
|
|
298
298
|
export const try_code = (state, forced = false) => {
|
|
299
299
|
const start = state.pos;
|
|
300
|
-
|
|
300
|
+
const search_start = start + 1; // past opening backtick
|
|
301
301
|
// compute search boundary: don't scan past open formatting delimiters
|
|
302
|
-
const search_limit = code_search_limit(state,
|
|
303
|
-
//
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
302
|
+
const search_limit = code_search_limit(state, search_start);
|
|
303
|
+
// find the first closing backtick or newline (memoized — a candidate that
|
|
304
|
+
// holds under open formatting re-enters here on every feed, and a raw scan
|
|
305
|
+
// would re-cover the same growing region each time, going quadratic on a
|
|
306
|
+
// single long line)
|
|
307
|
+
const close_pos = buffer_index_of(state, '`', search_start);
|
|
308
|
+
const newline_pos = buffer_index_of(state, '\n', search_start);
|
|
309
|
+
const terminator = close_pos !== -1 && (newline_pos === -1 || close_pos < newline_pos) ? close_pos : newline_pos;
|
|
310
|
+
if (terminator !== -1 && terminator < search_limit) {
|
|
311
|
+
if (terminator === close_pos) {
|
|
307
312
|
// found close
|
|
308
|
-
const content = state.buffer.slice(
|
|
313
|
+
const content = state.buffer.slice(search_start, terminator);
|
|
309
314
|
if (content.length === 0) {
|
|
310
315
|
// empty code — treat as text
|
|
311
316
|
consume_delimiter_as_text(state, '``');
|
|
@@ -320,20 +325,17 @@ export const try_code = (state, forced = false) => {
|
|
|
320
325
|
content,
|
|
321
326
|
text_type: 'Code',
|
|
322
327
|
start: offset(state, start),
|
|
323
|
-
end: offset(state,
|
|
328
|
+
end: offset(state, terminator + 1),
|
|
324
329
|
});
|
|
325
330
|
state.active_text_id = null;
|
|
326
|
-
state.pos =
|
|
327
|
-
state.column +=
|
|
331
|
+
state.pos = terminator + 1;
|
|
332
|
+
state.column += terminator + 1 - start;
|
|
328
333
|
state.prev_char = BACKTICK;
|
|
329
334
|
return true;
|
|
330
335
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
return true;
|
|
335
|
-
}
|
|
336
|
-
i++;
|
|
336
|
+
// newline before any close — inline code can't span lines
|
|
337
|
+
consume_delimiter_as_text(state, '`');
|
|
338
|
+
return true;
|
|
337
339
|
}
|
|
338
340
|
// hit search limit (open formatting delimiter boundary) — treat backtick as
|
|
339
341
|
// text. This is the documented backtick-adjacent divergence point: when the
|
|
@@ -341,7 +343,7 @@ export const try_code = (state, forced = false) => {
|
|
|
341
343
|
// processed), the one-shot parse rejects that italic and scans unbounded —
|
|
342
344
|
// see the `MdzStreamParser` TSDoc and the parity suite's expected-divergence
|
|
343
345
|
// battery
|
|
344
|
-
if (
|
|
346
|
+
if (search_limit < state.buffer.length) {
|
|
345
347
|
consume_delimiter_as_text(state, '`');
|
|
346
348
|
return true;
|
|
347
349
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_stream_parser_link.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser_link.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"mdz_stream_parser_link.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser_link.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,SAAS,EAYd,MAAM,8BAA8B,CAAC;AAMtC,cAAc;AACd,eAAO,MAAM,aAAa,GAAI,OAAO,oBAAoB,KAAG,OAoB3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC9B,OAAO,oBAAoB,EAC3B,gBAAgB,MAAM,EACtB,aAAa,MAAM,KACjB,IAUF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,oBAAoB,EAAE,gBAAgB,MAAM,KAAG,OA4EvF,CAAC;AAIF,cAAc;AACd,eAAO,MAAM,YAAY,GAAI,OAAO,oBAAoB,KAAG,SAqF1D,CAAC;AAEF,cAAc;AACd,eAAO,MAAM,aAAa,GAAI,OAAO,oBAAoB,KAAG,SAiD3D,CAAC"}
|
|
@@ -4,11 +4,20 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import { A_UPPER, LEFT_BRACKET, LEFT_PAREN,
|
|
8
|
-
import { accumulate_text, alloc_id, emit, ensure_paragraph, flush_text, is_run_boundary, offset, pop_stack_entry, push_stack_entry, revert_above, } from './mdz_stream_parser_state.js';
|
|
7
|
+
import { A_UPPER, LEFT_BRACKET, LEFT_PAREN, MAX_INLINE_NESTING_DEPTH, RIGHT_ANGLE, RIGHT_BRACKET, RIGHT_PAREN, SLASH, SPACE, Z_UPPER, is_letter, is_tag_name_char, is_valid_path_char, mdz_is_safe_reference, mdz_is_url, } from './mdz_helpers.js';
|
|
8
|
+
import { accumulate_text, alloc_id, buffer_index_of, emit, ensure_paragraph, flush_text, is_run_boundary, offset, pop_stack_entry, push_stack_entry, revert_above, } from './mdz_stream_parser_state.js';
|
|
9
|
+
import { consume_delimiter_as_text } from './mdz_stream_parser_text.js';
|
|
10
|
+
import { mdz_debug_work } from './mdz_debug_work.js';
|
|
9
11
|
// -- Links --
|
|
10
12
|
/** @nodocs */
|
|
11
13
|
export const try_link_open = (state) => {
|
|
14
|
+
// nesting-depth cap: too deep to open — render `[` literal, matching the
|
|
15
|
+
// sync lexer's `#tokenize_markdown_link` cap (keeps the two parsers agreeing
|
|
16
|
+
// on where deep `[` stops nesting)
|
|
17
|
+
if (state.open_link_tag_depth >= MAX_INLINE_NESTING_DEPTH) {
|
|
18
|
+
consume_delimiter_as_text(state, '[');
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
12
21
|
flush_text(state);
|
|
13
22
|
ensure_paragraph(state);
|
|
14
23
|
const id = alloc_id(state);
|
|
@@ -55,63 +64,67 @@ export const try_complete_link = (state, link_stack_idx) => {
|
|
|
55
64
|
abort_link_to_text(state, link_stack_idx, bracket_pos);
|
|
56
65
|
return true;
|
|
57
66
|
}
|
|
58
|
-
// found ]( —
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
end: offset(state, i + 1),
|
|
95
|
-
reference,
|
|
96
|
-
link_type,
|
|
97
|
-
});
|
|
98
|
-
state.active_text_id = null;
|
|
99
|
-
state.pos = i + 1;
|
|
100
|
-
state.column += i + 1 - bracket_pos;
|
|
101
|
-
state.prev_char = RIGHT_PAREN;
|
|
67
|
+
// found ]( — find the reference's terminator: `)` completes, a space or
|
|
68
|
+
// newline aborts. Memoized searches (see `buffer_index_of`) — a link whose
|
|
69
|
+
// URL arrives incrementally re-enters here on every feed with `pos` still
|
|
70
|
+
// at the `]`, and a raw scan would re-cover the growing reference each
|
|
71
|
+
// time, going quadratic on long streamed URLs.
|
|
72
|
+
const ref_start = bracket_pos + 2;
|
|
73
|
+
const close_pos = buffer_index_of(state, ')', ref_start);
|
|
74
|
+
const space_pos = buffer_index_of(state, ' ', ref_start);
|
|
75
|
+
const newline_pos = buffer_index_of(state, '\n', ref_start);
|
|
76
|
+
let invalid_pos = space_pos;
|
|
77
|
+
if (newline_pos !== -1 && (invalid_pos === -1 || newline_pos < invalid_pos)) {
|
|
78
|
+
invalid_pos = newline_pos;
|
|
79
|
+
}
|
|
80
|
+
if (close_pos === -1) {
|
|
81
|
+
// didn't find ) — need more input or invalid
|
|
82
|
+
if (invalid_pos === -1)
|
|
83
|
+
return false; // need more input
|
|
84
|
+
// found invalid char before any ) — revert
|
|
85
|
+
abort_link_to_text(state, link_stack_idx, bracket_pos);
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
if (invalid_pos !== -1 && invalid_pos < close_pos) {
|
|
89
|
+
// invalid character in URL (simplified check)
|
|
90
|
+
abort_link_to_text(state, link_stack_idx, bracket_pos);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
const i = close_pos;
|
|
94
|
+
const reference = state.buffer.slice(ref_start, i);
|
|
95
|
+
// validate reference: non-empty and only valid path chars
|
|
96
|
+
if (!reference.trim()) {
|
|
97
|
+
abort_link_to_text(state, link_stack_idx, bracket_pos);
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
for (let j = 0; j < reference.length; j++) {
|
|
101
|
+
if (!is_valid_path_char(reference.charCodeAt(j))) {
|
|
102
|
+
abort_link_to_text(state, link_stack_idx, bracket_pos);
|
|
102
103
|
return true;
|
|
103
104
|
}
|
|
104
|
-
if (c === NEWLINE || c === SPACE) {
|
|
105
|
-
// invalid character in URL (simplified check)
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
i++;
|
|
109
105
|
}
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
// Reject unsafe protocols (javascript:, data:, etc.) at parse time.
|
|
107
|
+
// `is_valid_path_char` permits `:` so we have to filter explicitly.
|
|
108
|
+
if (!mdz_is_safe_reference(reference)) {
|
|
109
|
+
abort_link_to_text(state, link_stack_idx, bracket_pos);
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
// success — close the link with reference
|
|
113
|
+
flush_text(state);
|
|
114
|
+
revert_above(state, link_stack_idx);
|
|
115
|
+
const entry = pop_stack_entry(state);
|
|
116
|
+
const link_type = mdz_is_url(reference) ? 'external' : 'internal';
|
|
117
|
+
emit(state, {
|
|
118
|
+
type: 'close',
|
|
119
|
+
id: entry.id,
|
|
120
|
+
end: offset(state, i + 1),
|
|
121
|
+
reference,
|
|
122
|
+
link_type,
|
|
123
|
+
});
|
|
124
|
+
state.active_text_id = null;
|
|
125
|
+
state.pos = i + 1;
|
|
126
|
+
state.column += i + 1 - bracket_pos;
|
|
127
|
+
state.prev_char = RIGHT_PAREN;
|
|
115
128
|
return true;
|
|
116
129
|
};
|
|
117
130
|
// -- Tags --
|
|
@@ -129,7 +142,18 @@ export const try_tag_open = (state) => {
|
|
|
129
142
|
if (!is_letter(state.buffer.charCodeAt(i))) {
|
|
130
143
|
return 'not_match';
|
|
131
144
|
}
|
|
145
|
+
// nesting-depth cap: `<letter…` is a tag open, but we're too deep to nest —
|
|
146
|
+
// render `<` literal, matching the sync lexer's `#tokenize_tag` cap. Checked
|
|
147
|
+
// after the closer/hold cases above (a `</…>` closer still closes; a `<` at
|
|
148
|
+
// the buffer end still holds), so only genuine opens are suppressed.
|
|
149
|
+
if (state.open_link_tag_depth >= MAX_INLINE_NESTING_DEPTH) {
|
|
150
|
+
consume_delimiter_as_text(state, '<');
|
|
151
|
+
return 'consumed';
|
|
152
|
+
}
|
|
132
153
|
// collect tag name
|
|
154
|
+
// TODO the name/whitespace scans rescan from `start` on every held retry
|
|
155
|
+
// of an unclosed tag's open tail — needs a hold watermark; a length cap would
|
|
156
|
+
// diverge from the sync parser on pathological multi-KB "tag names"
|
|
133
157
|
const name_start = i;
|
|
134
158
|
while (i < state.buffer.length && is_tag_name_char(state.buffer.charCodeAt(i))) {
|
|
135
159
|
i++;
|
|
@@ -201,9 +225,17 @@ export const try_close_tag = (state) => {
|
|
|
201
225
|
return 'not_match';
|
|
202
226
|
const name = state.buffer.slice(name_start, i);
|
|
203
227
|
i++; // past >
|
|
228
|
+
// O(1) bail when no tag of this name is open — without it, every `</name>`
|
|
229
|
+
// candidate walks the whole inline stack, which grows one frame per leaked
|
|
230
|
+
// unclosed `<Tag>` and goes quadratic on tag-dense input (the same shape
|
|
231
|
+
// `open_counts` guards for the delimiter inlines)
|
|
232
|
+
if (!state.open_tag_counts?.get(name))
|
|
233
|
+
return 'not_match';
|
|
204
234
|
// find matching open tag on stack
|
|
205
235
|
let found_idx = -1;
|
|
206
236
|
for (let j = state.stack.length - 1; j >= 0; j--) {
|
|
237
|
+
if (mdz_debug_work.enabled)
|
|
238
|
+
mdz_debug_work.total++; // frames walked (mismatched-tags guard)
|
|
207
239
|
const entry = state.stack[j];
|
|
208
240
|
if ((entry.node_type === 'Element' || entry.node_type === 'Component') &&
|
|
209
241
|
entry.tag_name === name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_stream_parser_list.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser_list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"mdz_stream_parser_list.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser_list.ts"],"names":[],"m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ITS, MIN_CODEBLOCK_BACKTICKS, NEWLINE, NINE, PERIOD, RIGHT_ANGLE, SPACE, ZERO, is_line_whitespace, mdz_match_blockquote_prefix, mdz_blockquote_line_has_content, } from './mdz_helpers.js';
|
|
15
|
+
import { BACKTICK, HYPHEN, MAX_LIST_NUMBER_DIGITS, MIN_CODEBLOCK_BACKTICKS, NEWLINE, NINE, PERIOD, PIPE, RIGHT_ANGLE, SPACE, ZERO, is_line_whitespace, mdz_match_blockquote_prefix, mdz_blockquote_line_has_content, } from './mdz_helpers.js';
|
|
16
|
+
import { match_table_in_item_head, open_table_in_item } from './mdz_stream_parser_table.js';
|
|
16
17
|
import { accumulate_text, alloc_id, close_all_list_levels, close_list_item, close_list_level, close_list_run, close_paragraph, emit, extend_accumulated_end, flush_text, offset, push_stack_entry, } from './mdz_stream_parser_state.js';
|
|
17
18
|
/**
|
|
18
19
|
* Whether only line whitespace remains between `from` and the line's end —
|
|
@@ -333,8 +334,16 @@ export const process_list_line = (state, forced) => {
|
|
|
333
334
|
}
|
|
334
335
|
if (marker !== null && marker.empty) {
|
|
335
336
|
// empty item: only at an indent exactly matching an open level of the
|
|
336
|
-
// same marker type — anything else degrades below
|
|
337
|
-
|
|
337
|
+
// same marker type — anything else degrades below (manual loop like
|
|
338
|
+
// `list_continuation_target` — no per-line closure allocation)
|
|
339
|
+
let level_idx = -1;
|
|
340
|
+
for (let li = 0; li < state.list_levels.length; li++) {
|
|
341
|
+
const l = state.list_levels[li];
|
|
342
|
+
if (l.indent === indent && l.ordered === marker.ordered) {
|
|
343
|
+
level_idx = li;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
338
347
|
if (level_idx !== -1) {
|
|
339
348
|
close_list_run(state);
|
|
340
349
|
while (state.list_levels.length - 1 > level_idx) {
|
|
@@ -410,6 +419,26 @@ export const process_list_line = (state, forced) => {
|
|
|
410
419
|
}
|
|
411
420
|
}
|
|
412
421
|
}
|
|
422
|
+
// a deeper pipe-row line whose next line is a delimiter becomes a table
|
|
423
|
+
// child of the item it would otherwise continue (the fence/quote precedent,
|
|
424
|
+
// a two-line lookahead held until the delimiter line arrives)
|
|
425
|
+
if (indent > 0 && buffer.charCodeAt(j) === PIPE) {
|
|
426
|
+
const target_idx = list_continuation_target(state, indent);
|
|
427
|
+
if (target_idx !== -1) {
|
|
428
|
+
const marker_indent = state.list_levels[target_idx].indent;
|
|
429
|
+
const head = match_table_in_item_head(state, j, marker_indent, forced);
|
|
430
|
+
if (head === 'pending')
|
|
431
|
+
return false;
|
|
432
|
+
if (head !== null) {
|
|
433
|
+
close_list_run(state);
|
|
434
|
+
while (state.list_levels.length - 1 > target_idx) {
|
|
435
|
+
close_list_level(state);
|
|
436
|
+
}
|
|
437
|
+
open_table_in_item(state, j, marker_indent, head);
|
|
438
|
+
return true;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
413
442
|
if (run_current && indent > deepest.indent) {
|
|
414
443
|
// continuation line: soft break, structural indent stripped
|
|
415
444
|
return continue_run(state, nl_pos, j);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
import type { MdzNodeTypeContainer, MdzNodeId, MdzOpcode } from './mdz_opcodes.js';
|
|
11
|
+
import type { MdzTableCellParser } from './mdz.js';
|
|
11
12
|
/**
|
|
12
13
|
* Tri-state result for `try_*` parser handlers.
|
|
13
14
|
* - `'consumed'`: input matched and the parser advanced
|
|
@@ -199,6 +200,20 @@ export interface MdzStreamParserState {
|
|
|
199
200
|
* quote (prefix stripping + nested-parser feeding) — see `MdzBlockquoteState`.
|
|
200
201
|
*/
|
|
201
202
|
blockquote: MdzBlockquoteState | null;
|
|
203
|
+
/**
|
|
204
|
+
* The open table, or null. While set, each line is consumed as a body row
|
|
205
|
+
* (or ends the table) by `process_table_line`. Holds the `Table` frame's id
|
|
206
|
+
* so the table can be closed when a non-row line or EOF ends it. `item_indent`
|
|
207
|
+
* is `null` for a top-level table (column-0 rows) or the enclosing list item's
|
|
208
|
+
* marker indent for a table nested as a block child (rows skip the indent and
|
|
209
|
+
* a dedent to that indent ends the table, returning control to the list).
|
|
210
|
+
* `cell_parser` is the table's shared cell parser, rebound per row.
|
|
211
|
+
*/
|
|
212
|
+
table: {
|
|
213
|
+
id: MdzNodeId;
|
|
214
|
+
item_indent: number | null;
|
|
215
|
+
cell_parser: MdzTableCellParser;
|
|
216
|
+
} | null;
|
|
202
217
|
/**
|
|
203
218
|
* Whether the innermost open ListItem's first inline run is current.
|
|
204
219
|
* Content then flows directly into the ListItem frame — the sync AST
|
|
@@ -226,6 +241,32 @@ export interface MdzStreamParserState {
|
|
|
226
241
|
search_memo: Map<string, BufferSearchMemo> | null;
|
|
227
242
|
/** Open-container counts for `find_open`'s O(1) "nothing open" early exit. */
|
|
228
243
|
open_counts: OpenInlineCounts;
|
|
244
|
+
/**
|
|
245
|
+
* Count of open `Link`/`Element`/`Component` frames in the current run — the
|
|
246
|
+
* streaming analogue of the sync lexer's `#inline_depth`. Kept as an O(1)
|
|
247
|
+
* counter (not a stack walk, which would reintroduce the deep-stack
|
|
248
|
+
* quadratic `open_counts` exists to avoid) so `try_link_open`/`try_tag_open`
|
|
249
|
+
* can cap nesting at `MAX_INLINE_NESTING_DEPTH` — rendering a deeper `[`/`<`
|
|
250
|
+
* literal, matching the sync cap on pure/symmetric nesting. It counts
|
|
251
|
+
* **optimistic** opens, though, so it diverges from the sync `#inline_depth`
|
|
252
|
+
* (which the sync tag path only bumps after a closer precheck) on an
|
|
253
|
+
* asymmetric cap-saturating prefix — 100+ *unclosed* `<a>` before a valid
|
|
254
|
+
* `[x](/u)` saturates this counter and suppresses the trailing link that sync
|
|
255
|
+
* still forms. Adversarial-only, documented not fixed (streaming can't
|
|
256
|
+
* precheck closers): see the flip-at-cap case in `mdz_nesting_cap.test.ts`.
|
|
257
|
+
* Run-scoped for free like `open_counts`: a
|
|
258
|
+
* run close reverts every inline frame above it, decrementing back to zero.
|
|
259
|
+
*/
|
|
260
|
+
open_link_tag_depth: number;
|
|
261
|
+
/**
|
|
262
|
+
* Per-name counts of open Element/Component frames, the tag analogue of
|
|
263
|
+
* `open_counts`: `try_close_tag` bails in O(1) when the closing name isn't
|
|
264
|
+
* open, instead of walking a stack that grows one frame per leaked unclosed
|
|
265
|
+
* `<Tag>`. Lazily created on the first tag open — tag-free inputs never
|
|
266
|
+
* allocate the map. Run-scoped like `open_counts`: run closes revert every
|
|
267
|
+
* inline frame above them, decrementing the counts back to zero.
|
|
268
|
+
*/
|
|
269
|
+
open_tag_counts: Map<string, number> | null;
|
|
229
270
|
/** Whether we're inside a heading (newline ends it). */
|
|
230
271
|
in_heading: boolean;
|
|
231
272
|
/** Whether we're inside an optimistic inline Code container. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdz_stream_parser_state.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser_state.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"mdz_stream_parser_state.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/mdz_stream_parser_state.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAC;AACjF,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAIjD;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;AAE/D,cAAc;AACd,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,SAAS,CAAC;IACd,SAAS,EAAE,oBAAoB,CAAC;IAChC;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,QAAQ,EAAE,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