@ai-matrx/content-ir 0.19.7 → 0.19.9
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +84 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +82 -6
- package/dist/index.js.map +1 -1
- package/dist/source.cjs +84 -5
- package/dist/source.cjs.map +1 -1
- package/dist/source.d.cts +24 -7
- package/dist/source.d.ts +24 -7
- package/dist/source.js +82 -6
- package/dist/source.js.map +1 -1
- package/package.json +1 -1
package/dist/source.d.cts
CHANGED
|
@@ -632,9 +632,12 @@ declare function pairDisplayMath(text: string): Map<number, number>;
|
|
|
632
632
|
* - A cell's `\|` shows as `|` — inside code spans too (spec example 200).
|
|
633
633
|
* - A table starts at a header holding an unescaped pipe whose NEXT line is a
|
|
634
634
|
* delimiter row (`--- | :-:`, edge pipes optional); a header without a leading
|
|
635
|
-
* pipe must match the delimiter row's width. It runs to a blank line
|
|
636
|
-
* line that starts another block (`- x`, `> y`, `# z`, `1.`, a fence, a rule
|
|
637
|
-
*
|
|
635
|
+
* pipe must match the delimiter row's width. It runs to a blank line, a
|
|
636
|
+
* line that starts another block (`- x`, `> y`, `# z`, `1.`, a fence, a rule,
|
|
637
|
+
* an HTML block — CommonMark 4.6's seven start conditions), or a line indented
|
|
638
|
+
* four or more columns past the table's container (indented code); every other
|
|
639
|
+
* line is a row, with or without a pipe (spec example 202), a lone `|` included
|
|
640
|
+
* (an empty row).
|
|
638
641
|
*
|
|
639
642
|
* Pure TS, no dependencies.
|
|
640
643
|
*/
|
|
@@ -644,6 +647,18 @@ declare function splitRowSegments(line: string): string[];
|
|
|
644
647
|
declare function rowCells(line: string): string[];
|
|
645
648
|
/** GFM's table-level unescape: a cell's `\|` is a pipe, in code spans too. */
|
|
646
649
|
declare function unescapeCellPipes(cell: string): string;
|
|
650
|
+
/** The trimmed line starts an HTML block (any of CommonMark 4.6's seven conditions). */
|
|
651
|
+
declare function startsHtmlBlock(trimmed: string): boolean;
|
|
652
|
+
/** The column a line's content starts at: spaces count 1, a tab runs to the next multiple of 4. */
|
|
653
|
+
declare function lineIndent(line: string): number;
|
|
654
|
+
/**
|
|
655
|
+
* The content column of the container a table at `start` sits in: the list item
|
|
656
|
+
* whose content the header line belongs to (the nearest list-marker line above,
|
|
657
|
+
* past blank and continuation lines, whose content column is at or left of the
|
|
658
|
+
* header's), or 0 at top level. Indentation past it by 4+ columns is indented
|
|
659
|
+
* code, which ends the table.
|
|
660
|
+
*/
|
|
661
|
+
declare function tableContainerIndent(lines: readonly string[], start: number): number;
|
|
647
662
|
/** A GFM delimiter row: every cell `---`, `:--`, `--:` or `:-:`, with at least one pipe. */
|
|
648
663
|
declare function isGfmDelimiterRow(line: string): boolean;
|
|
649
664
|
/** A pipe-led row: `|` first, and another `|` after it. */
|
|
@@ -652,11 +667,13 @@ declare function isPipeLedRow(line: string): boolean;
|
|
|
652
667
|
declare function startsPipelessTable(header: string, delimiter: string | undefined): boolean;
|
|
653
668
|
/**
|
|
654
669
|
* A line that continues an open table — GFM's rule (spec example 202): the table
|
|
655
|
-
* runs to the first blank line
|
|
670
|
+
* runs to the first blank line, the first line that starts another block (an
|
|
671
|
+
* HTML block included), or the first line indented 4+ columns past the table's
|
|
672
|
+
* container (`containerIndent`, from `tableContainerIndent`; indented code). Any
|
|
656
673
|
* other line is a row, even one without a pipe (`bar` → a one-cell row) and a
|
|
657
|
-
* lone `|` (an empty row). verify-RC-B4 R7-2.
|
|
674
|
+
* lone `|` (an empty row). verify-RC-B4 R7-2 / round 9.
|
|
658
675
|
*/
|
|
659
|
-
declare function continuesTable(line: string): boolean;
|
|
676
|
+
declare function continuesTable(line: string, containerIndent?: number): boolean;
|
|
660
677
|
/** Line `index` opens a table: a pipe-led row, or a pipe-less GFM header over its delimiter row. */
|
|
661
678
|
declare function opensTable(lines: readonly string[], index: number): boolean;
|
|
662
679
|
/** A WHOLE table header at `index`: a table opens here AND its next line is a GFM delimiter row. */
|
|
@@ -666,4 +683,4 @@ declare function findTableStart(lines: readonly string[], from?: number): number
|
|
|
666
683
|
/** Index just past the table whose header is at `start` (header, delimiter, then continuation rows). */
|
|
667
684
|
declare function findTableEnd(lines: readonly string[], start: number): number;
|
|
668
685
|
|
|
669
|
-
export { AFTER_WINDOW, BacktickRuns, type BlockIslandType, CALLOUT_NAMES, type CodePointIndex, type CodeRange, type DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, type FenceEnd, type FenceLineKind, type FenceLines, type FenceOpener, FenceReader, type InlineIslandType, type InnerFenceLine, type IslandMeta, type IslandType, type MapOptions, type MappedPosition, type MappedRange, NESTING_FENCE_LANGUAGES, type ReadXmlTag, type SourceBlock, type SourceBlockKind, type SourceChange, type SourceEdit, type SourceIsland, type SourceSpan, SourceSpliceError, type SourceSpliceErrorCode, type SpliceIntegrity, type SpliceOptions, type SpliceResult, type TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsPipelessTable, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes };
|
|
686
|
+
export { AFTER_WINDOW, BacktickRuns, type BlockIslandType, CALLOUT_NAMES, type CodePointIndex, type CodeRange, type DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, type FenceEnd, type FenceLineKind, type FenceLines, type FenceOpener, FenceReader, type InlineIslandType, type InnerFenceLine, type IslandMeta, type IslandType, type MapOptions, type MappedPosition, type MappedRange, NESTING_FENCE_LANGUAGES, type ReadXmlTag, type SourceBlock, type SourceBlockKind, type SourceChange, type SourceEdit, type SourceIsland, type SourceSpan, SourceSpliceError, type SourceSpliceErrorCode, type SpliceIntegrity, type SpliceOptions, type SpliceResult, type TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes };
|
package/dist/source.d.ts
CHANGED
|
@@ -632,9 +632,12 @@ declare function pairDisplayMath(text: string): Map<number, number>;
|
|
|
632
632
|
* - A cell's `\|` shows as `|` — inside code spans too (spec example 200).
|
|
633
633
|
* - A table starts at a header holding an unescaped pipe whose NEXT line is a
|
|
634
634
|
* delimiter row (`--- | :-:`, edge pipes optional); a header without a leading
|
|
635
|
-
* pipe must match the delimiter row's width. It runs to a blank line
|
|
636
|
-
* line that starts another block (`- x`, `> y`, `# z`, `1.`, a fence, a rule
|
|
637
|
-
*
|
|
635
|
+
* pipe must match the delimiter row's width. It runs to a blank line, a
|
|
636
|
+
* line that starts another block (`- x`, `> y`, `# z`, `1.`, a fence, a rule,
|
|
637
|
+
* an HTML block — CommonMark 4.6's seven start conditions), or a line indented
|
|
638
|
+
* four or more columns past the table's container (indented code); every other
|
|
639
|
+
* line is a row, with or without a pipe (spec example 202), a lone `|` included
|
|
640
|
+
* (an empty row).
|
|
638
641
|
*
|
|
639
642
|
* Pure TS, no dependencies.
|
|
640
643
|
*/
|
|
@@ -644,6 +647,18 @@ declare function splitRowSegments(line: string): string[];
|
|
|
644
647
|
declare function rowCells(line: string): string[];
|
|
645
648
|
/** GFM's table-level unescape: a cell's `\|` is a pipe, in code spans too. */
|
|
646
649
|
declare function unescapeCellPipes(cell: string): string;
|
|
650
|
+
/** The trimmed line starts an HTML block (any of CommonMark 4.6's seven conditions). */
|
|
651
|
+
declare function startsHtmlBlock(trimmed: string): boolean;
|
|
652
|
+
/** The column a line's content starts at: spaces count 1, a tab runs to the next multiple of 4. */
|
|
653
|
+
declare function lineIndent(line: string): number;
|
|
654
|
+
/**
|
|
655
|
+
* The content column of the container a table at `start` sits in: the list item
|
|
656
|
+
* whose content the header line belongs to (the nearest list-marker line above,
|
|
657
|
+
* past blank and continuation lines, whose content column is at or left of the
|
|
658
|
+
* header's), or 0 at top level. Indentation past it by 4+ columns is indented
|
|
659
|
+
* code, which ends the table.
|
|
660
|
+
*/
|
|
661
|
+
declare function tableContainerIndent(lines: readonly string[], start: number): number;
|
|
647
662
|
/** A GFM delimiter row: every cell `---`, `:--`, `--:` or `:-:`, with at least one pipe. */
|
|
648
663
|
declare function isGfmDelimiterRow(line: string): boolean;
|
|
649
664
|
/** A pipe-led row: `|` first, and another `|` after it. */
|
|
@@ -652,11 +667,13 @@ declare function isPipeLedRow(line: string): boolean;
|
|
|
652
667
|
declare function startsPipelessTable(header: string, delimiter: string | undefined): boolean;
|
|
653
668
|
/**
|
|
654
669
|
* A line that continues an open table — GFM's rule (spec example 202): the table
|
|
655
|
-
* runs to the first blank line
|
|
670
|
+
* runs to the first blank line, the first line that starts another block (an
|
|
671
|
+
* HTML block included), or the first line indented 4+ columns past the table's
|
|
672
|
+
* container (`containerIndent`, from `tableContainerIndent`; indented code). Any
|
|
656
673
|
* other line is a row, even one without a pipe (`bar` → a one-cell row) and a
|
|
657
|
-
* lone `|` (an empty row). verify-RC-B4 R7-2.
|
|
674
|
+
* lone `|` (an empty row). verify-RC-B4 R7-2 / round 9.
|
|
658
675
|
*/
|
|
659
|
-
declare function continuesTable(line: string): boolean;
|
|
676
|
+
declare function continuesTable(line: string, containerIndent?: number): boolean;
|
|
660
677
|
/** Line `index` opens a table: a pipe-led row, or a pipe-less GFM header over its delimiter row. */
|
|
661
678
|
declare function opensTable(lines: readonly string[], index: number): boolean;
|
|
662
679
|
/** A WHOLE table header at `index`: a table opens here AND its next line is a GFM delimiter row. */
|
|
@@ -666,4 +683,4 @@ declare function findTableStart(lines: readonly string[], from?: number): number
|
|
|
666
683
|
/** Index just past the table whose header is at `start` (header, delimiter, then continuation rows). */
|
|
667
684
|
declare function findTableEnd(lines: readonly string[], start: number): number;
|
|
668
685
|
|
|
669
|
-
export { AFTER_WINDOW, BacktickRuns, type BlockIslandType, CALLOUT_NAMES, type CodePointIndex, type CodeRange, type DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, type FenceEnd, type FenceLineKind, type FenceLines, type FenceOpener, FenceReader, type InlineIslandType, type InnerFenceLine, type IslandMeta, type IslandType, type MapOptions, type MappedPosition, type MappedRange, NESTING_FENCE_LANGUAGES, type ReadXmlTag, type SourceBlock, type SourceBlockKind, type SourceChange, type SourceEdit, type SourceIsland, type SourceSpan, SourceSpliceError, type SourceSpliceErrorCode, type SpliceIntegrity, type SpliceOptions, type SpliceResult, type TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsPipelessTable, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes };
|
|
686
|
+
export { AFTER_WINDOW, BacktickRuns, type BlockIslandType, CALLOUT_NAMES, type CodePointIndex, type CodeRange, type DisturbedIsland, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, type FenceEnd, type FenceLineKind, type FenceLines, type FenceOpener, FenceReader, type InlineIslandType, type InnerFenceLine, type IslandMeta, type IslandType, type MapOptions, type MappedPosition, type MappedRange, NESTING_FENCE_LANGUAGES, type ReadXmlTag, type SourceBlock, type SourceBlockKind, type SourceChange, type SourceEdit, type SourceIsland, type SourceSpan, SourceSpliceError, type SourceSpliceErrorCode, type SpliceIntegrity, type SpliceOptions, type SpliceResult, type TokenizeOptions, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes };
|
package/dist/source.js
CHANGED
|
@@ -2625,14 +2625,61 @@ function rowCells(line) {
|
|
|
2625
2625
|
const cells = splitRowSegments(line).map((cell) => cell.trim());
|
|
2626
2626
|
if (cells.length > 1 && cells[0] === "") cells.shift();
|
|
2627
2627
|
if (cells.length > 1 && cells[cells.length - 1] === "") cells.pop();
|
|
2628
|
-
else if (cells.length === 1 && cells[0] === "") cells.pop();
|
|
2628
|
+
else if (cells.length === 1 && cells[0] === "" && !line.includes("|")) cells.pop();
|
|
2629
2629
|
return cells;
|
|
2630
2630
|
}
|
|
2631
2631
|
function unescapeCellPipes(cell) {
|
|
2632
2632
|
return cell.replace(/\\\|/g, "|");
|
|
2633
2633
|
}
|
|
2634
2634
|
var BLOCK_START = /^(?:[-+*](?:\s|$)|\d{1,9}[.)](?:\s|$)|>|#{1,6}(?:\s|$)|(?:-\s*){3,}$|(?:\*\s*){3,}$|(?:_\s*){3,}$)/;
|
|
2635
|
-
var startsBlock = (trimmed) => BLOCK_START.test(trimmed) || opensStrictFence(trimmed);
|
|
2635
|
+
var startsBlock = (trimmed) => BLOCK_START.test(trimmed) || opensStrictFence(trimmed) || startsHtmlBlock(trimmed);
|
|
2636
|
+
var HTML_RAW = /^<(?:script|pre|style|textarea)(?:[\s>]|$)/i;
|
|
2637
|
+
var HTML_COMMENT_ETC = /^(?:<!--|<\?|<![A-Za-z]|<!\[CDATA\[)/;
|
|
2638
|
+
var HTML_BLOCK_NAMES = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
2639
|
+
var HTML_BLOCK_TAG = new RegExp(`^</?(?:${HTML_BLOCK_NAMES})(?:[\\s>]|/>|$)`, "i");
|
|
2640
|
+
var ATTRIBUTE = `\\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:\\s*=\\s*(?:[^\\s"'=<>\`]+|'[^']*'|"[^"]*"))?`;
|
|
2641
|
+
var HTML_COMPLETE_TAG = new RegExp(`^(?:<[A-Za-z][A-Za-z0-9-]*(?:${ATTRIBUTE})*\\s*/?>|</[A-Za-z][A-Za-z0-9-]*\\s*>)\\s*$`);
|
|
2642
|
+
function startsHtmlBlock(trimmed) {
|
|
2643
|
+
if (!trimmed.startsWith("<")) return false;
|
|
2644
|
+
return HTML_RAW.test(trimmed) || HTML_COMMENT_ETC.test(trimmed) || HTML_BLOCK_TAG.test(trimmed) || HTML_COMPLETE_TAG.test(trimmed);
|
|
2645
|
+
}
|
|
2646
|
+
function lineIndent(line) {
|
|
2647
|
+
let column = 0;
|
|
2648
|
+
for (const ch of line) {
|
|
2649
|
+
if (ch === " ") column += 1;
|
|
2650
|
+
else if (ch === " ") column += 4 - column % 4;
|
|
2651
|
+
else break;
|
|
2652
|
+
}
|
|
2653
|
+
return column;
|
|
2654
|
+
}
|
|
2655
|
+
var LIST_MARKER = /^([ \t]*)([-+*]|\d{1,9}[.)])([ \t]+|$)/;
|
|
2656
|
+
function markerContentColumn(marker) {
|
|
2657
|
+
const markerEnd = lineIndent(marker[1] ?? "") + (marker[2] ?? "").length;
|
|
2658
|
+
const gap = marker[3] ? lineIndent(" ".repeat(markerEnd) + marker[3]) - markerEnd : 1;
|
|
2659
|
+
return markerEnd + (gap >= 1 && gap <= 4 ? gap : 1);
|
|
2660
|
+
}
|
|
2661
|
+
function tableContainerIndent(lines, start) {
|
|
2662
|
+
return tableContainerIndentOf(lines, start, false);
|
|
2663
|
+
}
|
|
2664
|
+
function tableContainerIndentOf(lines, start, ownItem) {
|
|
2665
|
+
const own = ownItem ? LIST_MARKER.exec(lines[start] ?? "") : null;
|
|
2666
|
+
if (own) return markerContentColumn(own);
|
|
2667
|
+
const header = lineIndent(lines[start] ?? "");
|
|
2668
|
+
if (header === 0) return 0;
|
|
2669
|
+
for (let k = start - 1; k >= 0; k -= 1) {
|
|
2670
|
+
const line = lines[k] ?? "";
|
|
2671
|
+
if (!line.trim()) continue;
|
|
2672
|
+
const indent = lineIndent(line);
|
|
2673
|
+
const marker = LIST_MARKER.exec(line);
|
|
2674
|
+
if (marker && indent < header) {
|
|
2675
|
+
const content = markerContentColumn(marker);
|
|
2676
|
+
if (content <= header) return content;
|
|
2677
|
+
continue;
|
|
2678
|
+
}
|
|
2679
|
+
if (indent === 0) return 0;
|
|
2680
|
+
}
|
|
2681
|
+
return 0;
|
|
2682
|
+
}
|
|
2636
2683
|
var DELIMITER_CELL = /^:?-+:?$/;
|
|
2637
2684
|
function isGfmDelimiterRow(line) {
|
|
2638
2685
|
const trimmed = line.trim();
|
|
@@ -2651,14 +2698,42 @@ function startsPipelessTable(header, delimiter) {
|
|
|
2651
2698
|
if (delimiter === void 0 || !isGfmDelimiterRow(delimiter)) return false;
|
|
2652
2699
|
return rowCells(head).length === rowCells(delimiter.trim()).length;
|
|
2653
2700
|
}
|
|
2654
|
-
function continuesTable(line) {
|
|
2701
|
+
function continuesTable(line, containerIndent = 0) {
|
|
2655
2702
|
const trimmed = line.trim();
|
|
2656
2703
|
if (!trimmed) return false;
|
|
2704
|
+
if (lineIndent(line) - containerIndent >= 4) return false;
|
|
2657
2705
|
return trimmed.startsWith("|") || !startsBlock(trimmed);
|
|
2658
2706
|
}
|
|
2659
2707
|
function opensTable(lines, index) {
|
|
2660
2708
|
const line = lines[index] ?? "";
|
|
2661
|
-
|
|
2709
|
+
if (!isPipeLedRow(line) && !startsPipelessTable(line, lines[index + 1])) return false;
|
|
2710
|
+
return !isLazyContinuation(lines, index);
|
|
2711
|
+
}
|
|
2712
|
+
var QUOTE_LINE = /^ {0,3}>/;
|
|
2713
|
+
var THEMATIC_BREAK = /^(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/;
|
|
2714
|
+
var breaksParagraph = (trimmed) => /^#{1,6}(?:\s|$)/.test(trimmed) || THEMATIC_BREAK.test(trimmed) || opensStrictFence(trimmed) || startsHtmlBlock(trimmed);
|
|
2715
|
+
function isLazyContinuation(lines, index) {
|
|
2716
|
+
const header = lines[index] ?? "";
|
|
2717
|
+
let first = -1;
|
|
2718
|
+
for (let k = index - 1; k >= 0; k -= 1) {
|
|
2719
|
+
const line = lines[k] ?? "";
|
|
2720
|
+
const trimmed = line.trim();
|
|
2721
|
+
if (!trimmed) break;
|
|
2722
|
+
if (breaksParagraph(trimmed)) break;
|
|
2723
|
+
const marker = LIST_MARKER.exec(line);
|
|
2724
|
+
if (marker) {
|
|
2725
|
+
const rest = line.slice(marker[0].length).trim();
|
|
2726
|
+
if (!rest || breaksParagraph(rest)) break;
|
|
2727
|
+
first = k;
|
|
2728
|
+
break;
|
|
2729
|
+
}
|
|
2730
|
+
first = k;
|
|
2731
|
+
if (QUOTE_LINE.test(line)) break;
|
|
2732
|
+
}
|
|
2733
|
+
if (first < 0) return false;
|
|
2734
|
+
const start = lines[first] ?? "";
|
|
2735
|
+
if (QUOTE_LINE.test(start)) return !QUOTE_LINE.test(header);
|
|
2736
|
+
return lineIndent(header) < tableContainerIndentOf(lines, first, true);
|
|
2662
2737
|
}
|
|
2663
2738
|
function tableStartsAt(lines, index) {
|
|
2664
2739
|
return opensTable(lines, index) && isGfmDelimiterRow(lines[index + 1] ?? "");
|
|
@@ -2668,11 +2743,12 @@ function findTableStart(lines, from = 0) {
|
|
|
2668
2743
|
return -1;
|
|
2669
2744
|
}
|
|
2670
2745
|
function findTableEnd(lines, start) {
|
|
2746
|
+
const container = tableContainerIndent(lines, start);
|
|
2671
2747
|
let end = Math.min(lines.length, start + 2);
|
|
2672
|
-
while (end < lines.length && continuesTable(lines[end] ?? "")) end += 1;
|
|
2748
|
+
while (end < lines.length && continuesTable(lines[end] ?? "", container)) end += 1;
|
|
2673
2749
|
return end;
|
|
2674
2750
|
}
|
|
2675
2751
|
|
|
2676
|
-
export { AFTER_WINDOW, BacktickRuns, CALLOUT_NAMES, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceReader, NESTING_FENCE_LANGUAGES, SourceSpliceError, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsPipelessTable, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes };
|
|
2752
|
+
export { AFTER_WINDOW, BacktickRuns, CALLOUT_NAMES, FENCE_OPENER_WHITESPACE, FENCE_WHITESPACE, FenceReader, NESTING_FENCE_LANGUAGES, SourceSpliceError, XmlContainerTracker, blockAt, blockEdit, blockRangeEdit, buildCodePointIndex, classifyInnerFenceLine, closeFence, codeSpanText, continuesTable, fenceLineKinds, fenceNestsInnerFences, fenceOpenerOf, fenceParts, findCodeRanges, findInlineCodeSpans, findTableEnd, findTableStart, isEscapedBracketMath, isGfmDelimiterRow, isMathPlaceholder, isPipeLedRow, isSingleDollarMath, islandEdit, joinSource, lineIndent, listIslands, looksLikeDisplayMath, looksLikeOpenInlineMath, mapCodeRanges, mapInlineCodeSpans, mapPosition, mapRange, opensTable, pairDisplayMath, parseFenceOpener, pendingDisplayMathOpener, readXmlTag, rowCells, singleDollarAfter, singleDollarMathEnd, spliceSave, splitRowSegments, splitsSurrogatePair, startsHtmlBlock, startsPipelessTable, tableContainerIndent, tableStartsAt, toCodePointOffset, toUtf16Offset, tokenizeSource, trimFenceLine, unescapeCellPipes };
|
|
2677
2753
|
//# sourceMappingURL=source.js.map
|
|
2678
2754
|
//# sourceMappingURL=source.js.map
|