emdp 1.0.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 +124 -0
- package/dist/cjs/cli.js +36 -0
- package/dist/cjs/gfm.js +26 -0
- package/dist/cjs/index.js +26 -0
- package/dist/cjs/parser/block-parser.js +644 -0
- package/dist/cjs/parser/blocks/blockquote.js +28 -0
- package/dist/cjs/parser/blocks/code-block-fenced.js +58 -0
- package/dist/cjs/parser/blocks/code-block-indented.js +47 -0
- package/dist/cjs/parser/blocks/heading-atx.js +29 -0
- package/dist/cjs/parser/blocks/heading-setext.js +24 -0
- package/dist/cjs/parser/blocks/html-block.js +83 -0
- package/dist/cjs/parser/blocks/link-reference.js +109 -0
- package/dist/cjs/parser/blocks/list.js +155 -0
- package/dist/cjs/parser/blocks/paragraph.js +20 -0
- package/dist/cjs/parser/blocks/table.js +163 -0
- package/dist/cjs/parser/blocks/task-list.js +66 -0
- package/dist/cjs/parser/blocks/thematic-break.js +17 -0
- package/dist/cjs/parser/entities.js +2133 -0
- package/dist/cjs/parser/gfm/block-parser.js +773 -0
- package/dist/cjs/parser/gfm/index.js +125 -0
- package/dist/cjs/parser/gfm/inline-parser.js +813 -0
- package/dist/cjs/parser/gfm/renderer.js +513 -0
- package/dist/cjs/parser/index.js +104 -0
- package/dist/cjs/parser/inline-parser.js +564 -0
- package/dist/cjs/parser/inlines/autolink-extended.js +364 -0
- package/dist/cjs/parser/inlines/autolink.js +44 -0
- package/dist/cjs/parser/inlines/code-span.js +48 -0
- package/dist/cjs/parser/inlines/emphasis.js +64 -0
- package/dist/cjs/parser/inlines/entity.js +25 -0
- package/dist/cjs/parser/inlines/escape.js +25 -0
- package/dist/cjs/parser/inlines/footnote.js +41 -0
- package/dist/cjs/parser/inlines/hard-break.js +45 -0
- package/dist/cjs/parser/inlines/image.js +9 -0
- package/dist/cjs/parser/inlines/link.js +166 -0
- package/dist/cjs/parser/inlines/soft-break.js +18 -0
- package/dist/cjs/parser/inlines/strikethrough.js +48 -0
- package/dist/cjs/parser/inlines/text.js +20 -0
- package/dist/cjs/parser/renderer.js +345 -0
- package/dist/cjs/parser/types.js +5 -0
- package/dist/cjs/parser/utils.js +277 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +36 -0
- package/dist/esm/cli.js +34 -0
- package/dist/esm/gfm.js +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/parser/block-parser.js +640 -0
- package/dist/esm/parser/blocks/blockquote.js +22 -0
- package/dist/esm/parser/blocks/code-block-fenced.js +52 -0
- package/dist/esm/parser/blocks/code-block-indented.js +42 -0
- package/dist/esm/parser/blocks/heading-atx.js +24 -0
- package/dist/esm/parser/blocks/heading-setext.js +19 -0
- package/dist/esm/parser/blocks/html-block.js +77 -0
- package/dist/esm/parser/blocks/link-reference.js +105 -0
- package/dist/esm/parser/blocks/list.js +145 -0
- package/dist/esm/parser/blocks/paragraph.js +15 -0
- package/dist/esm/parser/blocks/table.js +152 -0
- package/dist/esm/parser/blocks/task-list.js +61 -0
- package/dist/esm/parser/blocks/thematic-break.js +13 -0
- package/dist/esm/parser/entities.js +2130 -0
- package/dist/esm/parser/gfm/block-parser.js +769 -0
- package/dist/esm/parser/gfm/index.js +115 -0
- package/dist/esm/parser/gfm/inline-parser.js +809 -0
- package/dist/esm/parser/gfm/renderer.js +509 -0
- package/dist/esm/parser/index.js +80 -0
- package/dist/esm/parser/inline-parser.js +560 -0
- package/dist/esm/parser/inlines/autolink-extended.js +357 -0
- package/dist/esm/parser/inlines/autolink.js +40 -0
- package/dist/esm/parser/inlines/code-span.js +44 -0
- package/dist/esm/parser/inlines/emphasis.js +59 -0
- package/dist/esm/parser/inlines/entity.js +21 -0
- package/dist/esm/parser/inlines/escape.js +21 -0
- package/dist/esm/parser/inlines/footnote.js +38 -0
- package/dist/esm/parser/inlines/hard-break.js +41 -0
- package/dist/esm/parser/inlines/image.js +4 -0
- package/dist/esm/parser/inlines/link.js +156 -0
- package/dist/esm/parser/inlines/soft-break.js +14 -0
- package/dist/esm/parser/inlines/strikethrough.js +42 -0
- package/dist/esm/parser/inlines/text.js +16 -0
- package/dist/esm/parser/renderer.js +341 -0
- package/dist/esm/parser/types.js +4 -0
- package/dist/esm/parser/utils.js +254 -0
- package/dist/gfm.d.ts +6 -0
- package/dist/gfm.js +26 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +26 -0
- package/dist/parser/block-parser.d.ts +25 -0
- package/dist/parser/block-parser.js +644 -0
- package/dist/parser/blocks/blockquote.d.ts +8 -0
- package/dist/parser/blocks/blockquote.js +28 -0
- package/dist/parser/blocks/code-block-fenced.d.ts +14 -0
- package/dist/parser/blocks/code-block-fenced.js +58 -0
- package/dist/parser/blocks/code-block-indented.d.ts +7 -0
- package/dist/parser/blocks/code-block-indented.js +47 -0
- package/dist/parser/blocks/heading-atx.d.ts +10 -0
- package/dist/parser/blocks/heading-atx.js +29 -0
- package/dist/parser/blocks/heading-setext.d.ts +8 -0
- package/dist/parser/blocks/heading-setext.js +24 -0
- package/dist/parser/blocks/html-block.d.ts +9 -0
- package/dist/parser/blocks/html-block.js +83 -0
- package/dist/parser/blocks/link-reference.d.ts +11 -0
- package/dist/parser/blocks/link-reference.js +109 -0
- package/dist/parser/blocks/list.d.ts +25 -0
- package/dist/parser/blocks/list.js +155 -0
- package/dist/parser/blocks/paragraph.d.ts +7 -0
- package/dist/parser/blocks/paragraph.js +20 -0
- package/dist/parser/blocks/table.d.ts +13 -0
- package/dist/parser/blocks/table.js +163 -0
- package/dist/parser/blocks/task-list.d.ts +10 -0
- package/dist/parser/blocks/task-list.js +66 -0
- package/dist/parser/blocks/thematic-break.d.ts +6 -0
- package/dist/parser/blocks/thematic-break.js +17 -0
- package/dist/parser/entities.d.ts +4 -0
- package/dist/parser/entities.js +2133 -0
- package/dist/parser/gfm/block-parser.d.ts +32 -0
- package/dist/parser/gfm/block-parser.js +773 -0
- package/dist/parser/gfm/index.d.ts +31 -0
- package/dist/parser/gfm/index.js +125 -0
- package/dist/parser/gfm/inline-parser.d.ts +25 -0
- package/dist/parser/gfm/inline-parser.js +813 -0
- package/dist/parser/gfm/renderer.d.ts +43 -0
- package/dist/parser/gfm/renderer.js +513 -0
- package/dist/parser/index.d.ts +33 -0
- package/dist/parser/index.js +104 -0
- package/dist/parser/inline-parser.d.ts +16 -0
- package/dist/parser/inline-parser.js +564 -0
- package/dist/parser/inlines/autolink-extended.d.ts +24 -0
- package/dist/parser/inlines/autolink-extended.js +364 -0
- package/dist/parser/inlines/autolink.d.ts +9 -0
- package/dist/parser/inlines/autolink.js +44 -0
- package/dist/parser/inlines/code-span.d.ts +9 -0
- package/dist/parser/inlines/code-span.js +48 -0
- package/dist/parser/inlines/emphasis.d.ts +14 -0
- package/dist/parser/inlines/emphasis.js +64 -0
- package/dist/parser/inlines/entity.d.ts +8 -0
- package/dist/parser/inlines/entity.js +25 -0
- package/dist/parser/inlines/escape.d.ts +8 -0
- package/dist/parser/inlines/escape.js +25 -0
- package/dist/parser/inlines/footnote.d.ts +9 -0
- package/dist/parser/inlines/footnote.js +41 -0
- package/dist/parser/inlines/hard-break.d.ts +9 -0
- package/dist/parser/inlines/hard-break.js +45 -0
- package/dist/parser/inlines/image.d.ts +4 -0
- package/dist/parser/inlines/image.js +9 -0
- package/dist/parser/inlines/link.d.ts +33 -0
- package/dist/parser/inlines/link.js +166 -0
- package/dist/parser/inlines/soft-break.d.ts +9 -0
- package/dist/parser/inlines/soft-break.js +18 -0
- package/dist/parser/inlines/strikethrough.d.ts +16 -0
- package/dist/parser/inlines/strikethrough.js +48 -0
- package/dist/parser/inlines/text.d.ts +6 -0
- package/dist/parser/inlines/text.js +20 -0
- package/dist/parser/renderer.d.ts +33 -0
- package/dist/parser/renderer.js +345 -0
- package/dist/parser/types.d.ts +152 -0
- package/dist/parser/types.js +5 -0
- package/dist/parser/utils.d.ts +32 -0
- package/dist/parser/utils.js +277 -0
- package/dist/types/cli.d.ts +6 -0
- package/dist/types/gfm.d.ts +6 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/parser/block-parser.d.ts +25 -0
- package/dist/types/parser/blocks/blockquote.d.ts +8 -0
- package/dist/types/parser/blocks/code-block-fenced.d.ts +14 -0
- package/dist/types/parser/blocks/code-block-indented.d.ts +7 -0
- package/dist/types/parser/blocks/heading-atx.d.ts +10 -0
- package/dist/types/parser/blocks/heading-setext.d.ts +8 -0
- package/dist/types/parser/blocks/html-block.d.ts +9 -0
- package/dist/types/parser/blocks/link-reference.d.ts +11 -0
- package/dist/types/parser/blocks/list.d.ts +25 -0
- package/dist/types/parser/blocks/paragraph.d.ts +7 -0
- package/dist/types/parser/blocks/table.d.ts +13 -0
- package/dist/types/parser/blocks/task-list.d.ts +10 -0
- package/dist/types/parser/blocks/thematic-break.d.ts +6 -0
- package/dist/types/parser/entities.d.ts +4 -0
- package/dist/types/parser/gfm/block-parser.d.ts +32 -0
- package/dist/types/parser/gfm/index.d.ts +31 -0
- package/dist/types/parser/gfm/inline-parser.d.ts +25 -0
- package/dist/types/parser/gfm/renderer.d.ts +43 -0
- package/dist/types/parser/index.d.ts +33 -0
- package/dist/types/parser/inline-parser.d.ts +16 -0
- package/dist/types/parser/inlines/autolink-extended.d.ts +24 -0
- package/dist/types/parser/inlines/autolink.d.ts +9 -0
- package/dist/types/parser/inlines/code-span.d.ts +9 -0
- package/dist/types/parser/inlines/emphasis.d.ts +14 -0
- package/dist/types/parser/inlines/entity.d.ts +8 -0
- package/dist/types/parser/inlines/escape.d.ts +8 -0
- package/dist/types/parser/inlines/footnote.d.ts +9 -0
- package/dist/types/parser/inlines/hard-break.d.ts +9 -0
- package/dist/types/parser/inlines/image.d.ts +4 -0
- package/dist/types/parser/inlines/link.d.ts +33 -0
- package/dist/types/parser/inlines/soft-break.d.ts +9 -0
- package/dist/types/parser/inlines/strikethrough.d.ts +16 -0
- package/dist/types/parser/inlines/text.d.ts +6 -0
- package/dist/types/parser/renderer.d.ts +33 -0
- package/dist/types/parser/types.d.ts +152 -0
- package/dist/types/parser/utils.d.ts +32 -0
- package/package.json +54 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for fenced code blocks with optional info strings.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseFenceOpen = parseFenceOpen;
|
|
7
|
+
exports.isFenceClose = isFenceClose;
|
|
8
|
+
exports.isFencedCodeStart = isFencedCodeStart;
|
|
9
|
+
exports.createFencedCodeBlock = createFencedCodeBlock;
|
|
10
|
+
const BACKTICK_FENCE_OPEN_REGEX = /^( {0,3})(`{3,})([^`]*)$/;
|
|
11
|
+
const TILDE_FENCE_OPEN_REGEX = /^( {0,3})(~{3,})(.*)$/;
|
|
12
|
+
function parseFenceOpen(line) {
|
|
13
|
+
let match = line.match(BACKTICK_FENCE_OPEN_REGEX);
|
|
14
|
+
if (!match) {
|
|
15
|
+
match = line.match(TILDE_FENCE_OPEN_REGEX);
|
|
16
|
+
}
|
|
17
|
+
if (!match)
|
|
18
|
+
return null;
|
|
19
|
+
const indent = match[1].length;
|
|
20
|
+
const fence = match[2];
|
|
21
|
+
const char = fence[0];
|
|
22
|
+
const length = fence.length;
|
|
23
|
+
const info = match[3].trim();
|
|
24
|
+
return { indent, char, length, info };
|
|
25
|
+
}
|
|
26
|
+
function isFenceClose(line, fence) {
|
|
27
|
+
const trimmed = line.replace(/^( {0,3})/, '');
|
|
28
|
+
const closeRegex = new RegExp(`^${fence.char}{${fence.length},}[ \\t]*$`);
|
|
29
|
+
return closeRegex.test(trimmed);
|
|
30
|
+
}
|
|
31
|
+
function isFencedCodeStart(line) {
|
|
32
|
+
return BACKTICK_FENCE_OPEN_REGEX.test(line) || TILDE_FENCE_OPEN_REGEX.test(line);
|
|
33
|
+
}
|
|
34
|
+
function createFencedCodeBlock(info, lines, indent) {
|
|
35
|
+
const content = lines
|
|
36
|
+
.map(line => {
|
|
37
|
+
let removed = 0;
|
|
38
|
+
let i = 0;
|
|
39
|
+
while (i < line.length && removed < indent) {
|
|
40
|
+
if (line[i] === ' ') {
|
|
41
|
+
removed++;
|
|
42
|
+
i++;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return line.slice(i);
|
|
49
|
+
})
|
|
50
|
+
.join('\n');
|
|
51
|
+
const hasContent = lines.length > 0 && (lines.length > 1 || lines[0] !== '');
|
|
52
|
+
return {
|
|
53
|
+
type: 'code_block',
|
|
54
|
+
info,
|
|
55
|
+
literal: hasContent ? content + '\n' : '',
|
|
56
|
+
fenced: true,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for indented code blocks.
|
|
3
|
+
*/
|
|
4
|
+
import type { CodeBlockNode } from '../types.js';
|
|
5
|
+
export declare function isIndentedCodeLine(line: string): boolean;
|
|
6
|
+
export declare function removeIndentation(line: string, amount?: number): string;
|
|
7
|
+
export declare function createIndentedCodeBlock(lines: string[]): CodeBlockNode;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for indented code blocks.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isIndentedCodeLine = isIndentedCodeLine;
|
|
7
|
+
exports.removeIndentation = removeIndentation;
|
|
8
|
+
exports.createIndentedCodeBlock = createIndentedCodeBlock;
|
|
9
|
+
const utils_js_1 = require("../utils.js");
|
|
10
|
+
function isIndentedCodeLine(line) {
|
|
11
|
+
if (line.trim() === '')
|
|
12
|
+
return false;
|
|
13
|
+
return (0, utils_js_1.countLeadingSpaces)(line) >= 4;
|
|
14
|
+
}
|
|
15
|
+
function removeIndentation(line, amount = 4) {
|
|
16
|
+
let removed = 0;
|
|
17
|
+
let i = 0;
|
|
18
|
+
while (i < line.length && removed < amount) {
|
|
19
|
+
if (line[i] === ' ') {
|
|
20
|
+
removed++;
|
|
21
|
+
i++;
|
|
22
|
+
}
|
|
23
|
+
else if (line[i] === '\t') {
|
|
24
|
+
const tabWidth = 4 - (removed % 4);
|
|
25
|
+
if (removed + tabWidth <= amount) {
|
|
26
|
+
removed += tabWidth;
|
|
27
|
+
i++;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return line.slice(i);
|
|
38
|
+
}
|
|
39
|
+
function createIndentedCodeBlock(lines) {
|
|
40
|
+
const content = lines.join('\n');
|
|
41
|
+
return {
|
|
42
|
+
type: 'code_block',
|
|
43
|
+
info: '',
|
|
44
|
+
literal: content + '\n',
|
|
45
|
+
fenced: false,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for ATX headings using leading # markers.
|
|
3
|
+
*/
|
|
4
|
+
import type { HeadingNode } from '../types.js';
|
|
5
|
+
export declare function parseAtxHeading(line: string): {
|
|
6
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
7
|
+
content: string;
|
|
8
|
+
} | null;
|
|
9
|
+
export declare function isAtxHeading(line: string): boolean;
|
|
10
|
+
export declare function createHeadingNode(level: 1 | 2 | 3 | 4 | 5 | 6): HeadingNode;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for ATX headings using leading # markers.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseAtxHeading = parseAtxHeading;
|
|
7
|
+
exports.isAtxHeading = isAtxHeading;
|
|
8
|
+
exports.createHeadingNode = createHeadingNode;
|
|
9
|
+
const ATX_HEADING_REGEX = /^( {0,3})(#{1,6})([ \t].*|[ \t]*)$/;
|
|
10
|
+
function parseAtxHeading(line) {
|
|
11
|
+
const match = line.match(ATX_HEADING_REGEX);
|
|
12
|
+
if (!match)
|
|
13
|
+
return null;
|
|
14
|
+
const level = match[2].length;
|
|
15
|
+
let content = match[3];
|
|
16
|
+
content = content.replace(/[ \t]+#+[ \t]*$/, '');
|
|
17
|
+
content = content.trim();
|
|
18
|
+
return { level, content };
|
|
19
|
+
}
|
|
20
|
+
function isAtxHeading(line) {
|
|
21
|
+
return ATX_HEADING_REGEX.test(line);
|
|
22
|
+
}
|
|
23
|
+
function createHeadingNode(level) {
|
|
24
|
+
return {
|
|
25
|
+
type: 'heading',
|
|
26
|
+
level,
|
|
27
|
+
children: [],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for setext headings underlined with = or -.
|
|
3
|
+
*/
|
|
4
|
+
export declare function parseSetextHeading(line: string): {
|
|
5
|
+
level: 1 | 2;
|
|
6
|
+
} | null;
|
|
7
|
+
export declare function isSetextHeadingUnderline(line: string): boolean;
|
|
8
|
+
export declare function getSetextLevel(line: string): 1 | 2 | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for setext headings underlined with = or -.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseSetextHeading = parseSetextHeading;
|
|
7
|
+
exports.isSetextHeadingUnderline = isSetextHeadingUnderline;
|
|
8
|
+
exports.getSetextLevel = getSetextLevel;
|
|
9
|
+
const SETEXT_HEADING_REGEX = /^( {0,3})(=+|-+)[ \t]*$/;
|
|
10
|
+
function parseSetextHeading(line) {
|
|
11
|
+
const match = line.match(SETEXT_HEADING_REGEX);
|
|
12
|
+
if (!match)
|
|
13
|
+
return null;
|
|
14
|
+
const char = match[2][0];
|
|
15
|
+
const level = char === '=' ? 1 : 2;
|
|
16
|
+
return { level: level };
|
|
17
|
+
}
|
|
18
|
+
function isSetextHeadingUnderline(line) {
|
|
19
|
+
return SETEXT_HEADING_REGEX.test(line);
|
|
20
|
+
}
|
|
21
|
+
function getSetextLevel(line) {
|
|
22
|
+
const result = parseSetextHeading(line);
|
|
23
|
+
return result?.level ?? null;
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for raw HTML blocks defined by the CommonMark spec.
|
|
3
|
+
*/
|
|
4
|
+
import type { HtmlBlockNode } from '../types.js';
|
|
5
|
+
export type HtmlBlockType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | null;
|
|
6
|
+
export declare function getHtmlBlockType(line: string, canInterruptParagraph: boolean): HtmlBlockType;
|
|
7
|
+
export declare function isHtmlBlockClose(line: string, type: HtmlBlockType): boolean;
|
|
8
|
+
export declare function isHtmlBlockStart(line: string, canInterruptParagraph?: boolean): boolean;
|
|
9
|
+
export declare function createHtmlBlockNode(content: string): HtmlBlockNode;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for raw HTML blocks defined by the CommonMark spec.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getHtmlBlockType = getHtmlBlockType;
|
|
7
|
+
exports.isHtmlBlockClose = isHtmlBlockClose;
|
|
8
|
+
exports.isHtmlBlockStart = isHtmlBlockStart;
|
|
9
|
+
exports.createHtmlBlockNode = createHtmlBlockNode;
|
|
10
|
+
const TYPE_6_TAGS = new Set([
|
|
11
|
+
'address', 'article', 'aside', 'base', 'basefont', 'blockquote', 'body',
|
|
12
|
+
'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dialog', 'dir',
|
|
13
|
+
'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form',
|
|
14
|
+
'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header',
|
|
15
|
+
'hr', 'html', 'iframe', 'legend', 'li', 'link', 'main', 'menu', 'menuitem',
|
|
16
|
+
'nav', 'noframes', 'ol', 'optgroup', 'option', 'p', 'param', 'search',
|
|
17
|
+
'section', 'summary', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead',
|
|
18
|
+
'title', 'tr', 'track', 'ul'
|
|
19
|
+
]);
|
|
20
|
+
const TYPE_1_OPEN_REGEX = /^<(?:pre|script|style|textarea)(?:\s|>|$)/i;
|
|
21
|
+
const TYPE_1_CLOSE_REGEX = /<\/(?:pre|script|style|textarea)>/i;
|
|
22
|
+
const TYPE_2_OPEN_REGEX = /^<!--/;
|
|
23
|
+
const TYPE_2_CLOSE_REGEX = /-->/;
|
|
24
|
+
const TYPE_3_OPEN_REGEX = /^<\?/;
|
|
25
|
+
const TYPE_3_CLOSE_REGEX = /\?>/;
|
|
26
|
+
const TYPE_4_OPEN_REGEX = /^<![a-zA-Z]/;
|
|
27
|
+
const TYPE_4_CLOSE_REGEX = />/;
|
|
28
|
+
const TYPE_5_OPEN_REGEX = /^<!\[CDATA\[/i;
|
|
29
|
+
const TYPE_5_CLOSE_REGEX = /\]\]>/;
|
|
30
|
+
const TYPE_6_OPEN_REGEX = /^<\/?([a-zA-Z][a-zA-Z0-9-]*)(?:\s|\/?>|$)/i;
|
|
31
|
+
const TYPE_7_OPEN_TAG_REGEX = /^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s+[a-zA-Z_:][a-zA-Z0-9_.:-]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>\s*$/i;
|
|
32
|
+
const TYPE_7_CLOSE_TAG_REGEX = /^<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>\s*$/i;
|
|
33
|
+
function getHtmlBlockType(line, canInterruptParagraph) {
|
|
34
|
+
const trimmed = line.replace(/^ {0,3}/, '');
|
|
35
|
+
if (TYPE_1_OPEN_REGEX.test(trimmed))
|
|
36
|
+
return 1;
|
|
37
|
+
if (TYPE_2_OPEN_REGEX.test(trimmed))
|
|
38
|
+
return 2;
|
|
39
|
+
if (TYPE_3_OPEN_REGEX.test(trimmed))
|
|
40
|
+
return 3;
|
|
41
|
+
if (TYPE_4_OPEN_REGEX.test(trimmed))
|
|
42
|
+
return 4;
|
|
43
|
+
if (TYPE_5_OPEN_REGEX.test(trimmed))
|
|
44
|
+
return 5;
|
|
45
|
+
const type6Match = trimmed.match(TYPE_6_OPEN_REGEX);
|
|
46
|
+
if (type6Match && TYPE_6_TAGS.has(type6Match[1].toLowerCase())) {
|
|
47
|
+
return 6;
|
|
48
|
+
}
|
|
49
|
+
if (canInterruptParagraph) {
|
|
50
|
+
if (TYPE_7_OPEN_TAG_REGEX.test(trimmed) || TYPE_7_CLOSE_TAG_REGEX.test(trimmed)) {
|
|
51
|
+
return 7;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function isHtmlBlockClose(line, type) {
|
|
57
|
+
switch (type) {
|
|
58
|
+
case 1:
|
|
59
|
+
return TYPE_1_CLOSE_REGEX.test(line);
|
|
60
|
+
case 2:
|
|
61
|
+
return TYPE_2_CLOSE_REGEX.test(line);
|
|
62
|
+
case 3:
|
|
63
|
+
return TYPE_3_CLOSE_REGEX.test(line);
|
|
64
|
+
case 4:
|
|
65
|
+
return TYPE_4_CLOSE_REGEX.test(line);
|
|
66
|
+
case 5:
|
|
67
|
+
return TYPE_5_CLOSE_REGEX.test(line);
|
|
68
|
+
case 6:
|
|
69
|
+
case 7:
|
|
70
|
+
return line.trim() === '';
|
|
71
|
+
default:
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function isHtmlBlockStart(line, canInterruptParagraph = true) {
|
|
76
|
+
return getHtmlBlockType(line, canInterruptParagraph) !== null;
|
|
77
|
+
}
|
|
78
|
+
function createHtmlBlockNode(content) {
|
|
79
|
+
return {
|
|
80
|
+
type: 'html_block',
|
|
81
|
+
literal: content,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for link reference definitions used by reference-style links.
|
|
3
|
+
*/
|
|
4
|
+
import type { LinkReferenceDefinition } from '../types.js';
|
|
5
|
+
export interface LinkRefResult {
|
|
6
|
+
label: string;
|
|
7
|
+
definition: LinkReferenceDefinition;
|
|
8
|
+
consumed: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseLinkReferenceDefinition(text: string): LinkRefResult | null;
|
|
11
|
+
export declare function isLinkReferenceStart(line: string): boolean;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for link reference definitions used by reference-style links.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseLinkReferenceDefinition = parseLinkReferenceDefinition;
|
|
7
|
+
exports.isLinkReferenceStart = isLinkReferenceStart;
|
|
8
|
+
const utils_js_1 = require("../utils.js");
|
|
9
|
+
const LINK_LABEL_REGEX = /^\[((?:[^\[\]\\]|\\.){0,999})\]/;
|
|
10
|
+
const LINK_DESTINATION_ANGLE_REGEX = /^<([^<>\n\\]|\\.)*>/;
|
|
11
|
+
const LINK_DESTINATION_BARE_REGEX = /^[^\s<\[\]]*(?:\([^\s<\[\]]*\)[^\s<\[\]]*)*[^\s<\[\]]*/;
|
|
12
|
+
const LINK_TITLE_DOUBLE_REGEX = /^"((?:[^"\\]|\\[\s\S])*)"/;
|
|
13
|
+
const LINK_TITLE_SINGLE_REGEX = /^'((?:[^'\\]|\\[\s\S])*)'/;
|
|
14
|
+
const LINK_TITLE_PAREN_REGEX = /^\(((?:[^()\\]|\\[\s\S])*)\)/;
|
|
15
|
+
function parseLinkReferenceDefinition(text) {
|
|
16
|
+
let pos = 0;
|
|
17
|
+
const indentMatch = text.match(/^( {0,3})/);
|
|
18
|
+
if (indentMatch)
|
|
19
|
+
pos += indentMatch[1].length;
|
|
20
|
+
const labelMatch = text.slice(pos).match(LINK_LABEL_REGEX);
|
|
21
|
+
if (!labelMatch)
|
|
22
|
+
return null;
|
|
23
|
+
const rawLabel = labelMatch[1];
|
|
24
|
+
if (rawLabel.trim() === '')
|
|
25
|
+
return null;
|
|
26
|
+
pos += labelMatch[0].length;
|
|
27
|
+
if (text[pos] !== ':')
|
|
28
|
+
return null;
|
|
29
|
+
pos++;
|
|
30
|
+
const beforeDest = text.slice(pos).match(/^[ \t]*\n?[ \t]*/);
|
|
31
|
+
if (beforeDest)
|
|
32
|
+
pos += beforeDest[0].length;
|
|
33
|
+
let destination;
|
|
34
|
+
const angleMatch = text.slice(pos).match(LINK_DESTINATION_ANGLE_REGEX);
|
|
35
|
+
if (angleMatch) {
|
|
36
|
+
destination = angleMatch[0].slice(1, -1);
|
|
37
|
+
pos += angleMatch[0].length;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const bareMatch = text.slice(pos).match(LINK_DESTINATION_BARE_REGEX);
|
|
41
|
+
if (!bareMatch || bareMatch[0] === '')
|
|
42
|
+
return null;
|
|
43
|
+
destination = bareMatch[0];
|
|
44
|
+
pos += bareMatch[0].length;
|
|
45
|
+
}
|
|
46
|
+
let title = '';
|
|
47
|
+
let titleFound = false;
|
|
48
|
+
const tryMatchTitle = (titlePos) => {
|
|
49
|
+
const remaining = text.slice(titlePos);
|
|
50
|
+
const doubleMatch = remaining.match(LINK_TITLE_DOUBLE_REGEX);
|
|
51
|
+
const singleMatch = remaining.match(LINK_TITLE_SINGLE_REGEX);
|
|
52
|
+
const parenMatch = remaining.match(LINK_TITLE_PAREN_REGEX);
|
|
53
|
+
const titleMatch = doubleMatch || singleMatch || parenMatch;
|
|
54
|
+
if (titleMatch) {
|
|
55
|
+
const afterTitlePos = titlePos + titleMatch[0].length;
|
|
56
|
+
const afterTitle = text.slice(afterTitlePos).match(/^[ \t]*(?:\n|$)/);
|
|
57
|
+
if (afterTitle) {
|
|
58
|
+
return { title: titleMatch[1], endPos: afterTitlePos + afterTitle[0].length };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
63
|
+
const spaceBeforeTitle = text.slice(pos).match(/^[ \t]+/);
|
|
64
|
+
if (spaceBeforeTitle) {
|
|
65
|
+
const result = tryMatchTitle(pos + spaceBeforeTitle[0].length);
|
|
66
|
+
if (result) {
|
|
67
|
+
title = result.title;
|
|
68
|
+
pos = result.endPos;
|
|
69
|
+
titleFound = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!titleFound) {
|
|
73
|
+
const newlineBeforeTitle = text.slice(pos).match(/^[ \t]*\n[ \t]*/);
|
|
74
|
+
if (newlineBeforeTitle) {
|
|
75
|
+
const result = tryMatchTitle(pos + newlineBeforeTitle[0].length);
|
|
76
|
+
if (result) {
|
|
77
|
+
title = result.title;
|
|
78
|
+
pos = result.endPos;
|
|
79
|
+
titleFound = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!titleFound) {
|
|
84
|
+
const endAfterDest = text.slice(pos).match(/^[ \t]*(?:\n|$)/);
|
|
85
|
+
if (endAfterDest) {
|
|
86
|
+
pos += endAfterDest[0].length;
|
|
87
|
+
return {
|
|
88
|
+
label: (0, utils_js_1.normalizeLabel)((0, utils_js_1.unescapeString)(rawLabel)),
|
|
89
|
+
definition: {
|
|
90
|
+
destination: (0, utils_js_1.decodeHtmlEntities)((0, utils_js_1.unescapeString)(destination)),
|
|
91
|
+
title: '',
|
|
92
|
+
},
|
|
93
|
+
consumed: pos,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
label: (0, utils_js_1.normalizeLabel)((0, utils_js_1.unescapeString)(rawLabel)),
|
|
100
|
+
definition: {
|
|
101
|
+
destination: (0, utils_js_1.decodeHtmlEntities)((0, utils_js_1.unescapeString)(destination)),
|
|
102
|
+
title: (0, utils_js_1.decodeHtmlEntities)((0, utils_js_1.unescapeString)(title)),
|
|
103
|
+
},
|
|
104
|
+
consumed: pos,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function isLinkReferenceStart(line) {
|
|
108
|
+
return /^ {0,3}\[/.test(line);
|
|
109
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for ordered and unordered lists with nesting and tight/loose detection.
|
|
3
|
+
*/
|
|
4
|
+
import type { ListNode, ListItemNode } from '../types.js';
|
|
5
|
+
export interface ListMarker {
|
|
6
|
+
type: 'bullet' | 'ordered';
|
|
7
|
+
indent: number;
|
|
8
|
+
indentChars: number;
|
|
9
|
+
marker: string;
|
|
10
|
+
bulletChar?: '-' | '+' | '*';
|
|
11
|
+
start?: number;
|
|
12
|
+
delimiter?: '.' | ')';
|
|
13
|
+
padding: number;
|
|
14
|
+
paddingChars: number;
|
|
15
|
+
contentIndent: number;
|
|
16
|
+
contentCharIndex: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function parseListMarker(line: string): ListMarker | null;
|
|
19
|
+
export declare function isListItemStart(line: string): boolean;
|
|
20
|
+
export declare function isBulletListStart(line: string): boolean;
|
|
21
|
+
export declare function isOrderedListStart(line: string): boolean;
|
|
22
|
+
export declare function canStartList(line: string, interruptingParagraph: boolean): boolean;
|
|
23
|
+
export declare function createListNode(marker: ListMarker): ListNode;
|
|
24
|
+
export declare function createListItemNode(): ListItemNode;
|
|
25
|
+
export declare function listsMatch(a: ListMarker, b: ListMarker): boolean;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for ordered and unordered lists with nesting and tight/loose detection.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseListMarker = parseListMarker;
|
|
7
|
+
exports.isListItemStart = isListItemStart;
|
|
8
|
+
exports.isBulletListStart = isBulletListStart;
|
|
9
|
+
exports.isOrderedListStart = isOrderedListStart;
|
|
10
|
+
exports.canStartList = canStartList;
|
|
11
|
+
exports.createListNode = createListNode;
|
|
12
|
+
exports.createListItemNode = createListItemNode;
|
|
13
|
+
exports.listsMatch = listsMatch;
|
|
14
|
+
const BULLET_LIST_REGEX = /^( {0,3})([-+*])( +|\t|$)/;
|
|
15
|
+
const ORDERED_LIST_REGEX = /^( {0,3})(\d{1,9})([.)])( +|\t|$)/;
|
|
16
|
+
function parseListMarker(line) {
|
|
17
|
+
const bulletMatch = line.match(BULLET_LIST_REGEX);
|
|
18
|
+
if (bulletMatch) {
|
|
19
|
+
const indentChars = bulletMatch[1].length;
|
|
20
|
+
const indent = indentChars;
|
|
21
|
+
const marker = bulletMatch[2];
|
|
22
|
+
const spacesAfter = bulletMatch[3];
|
|
23
|
+
let paddingChars = spacesAfter.length;
|
|
24
|
+
const columnAfterMarker = indent + 1;
|
|
25
|
+
let padding;
|
|
26
|
+
if (spacesAfter === '\t') {
|
|
27
|
+
padding = 4 - (columnAfterMarker % 4);
|
|
28
|
+
}
|
|
29
|
+
else if (spacesAfter === '') {
|
|
30
|
+
padding = 1;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
padding = spacesAfter.length;
|
|
34
|
+
}
|
|
35
|
+
let paddingToConsume = padding;
|
|
36
|
+
if (spacesAfter === '\t') {
|
|
37
|
+
paddingToConsume = 1;
|
|
38
|
+
paddingChars = 1;
|
|
39
|
+
}
|
|
40
|
+
else if (padding >= 5) {
|
|
41
|
+
paddingToConsume = 1;
|
|
42
|
+
paddingChars = 1;
|
|
43
|
+
}
|
|
44
|
+
const contentIndent = indent + 1 + paddingToConsume;
|
|
45
|
+
const contentCharIndex = indentChars + 1 + paddingChars;
|
|
46
|
+
return {
|
|
47
|
+
type: 'bullet',
|
|
48
|
+
indent,
|
|
49
|
+
indentChars,
|
|
50
|
+
marker,
|
|
51
|
+
bulletChar: marker,
|
|
52
|
+
padding: Math.min(paddingToConsume, 4),
|
|
53
|
+
paddingChars,
|
|
54
|
+
contentIndent,
|
|
55
|
+
contentCharIndex,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const orderedMatch = line.match(ORDERED_LIST_REGEX);
|
|
59
|
+
if (orderedMatch) {
|
|
60
|
+
const indentChars = orderedMatch[1].length;
|
|
61
|
+
const indent = indentChars;
|
|
62
|
+
const start = parseInt(orderedMatch[2], 10);
|
|
63
|
+
const delimiter = orderedMatch[3];
|
|
64
|
+
const marker = orderedMatch[2] + delimiter;
|
|
65
|
+
const spacesAfter = orderedMatch[4];
|
|
66
|
+
let paddingChars = spacesAfter.length;
|
|
67
|
+
const columnAfterMarker = indent + marker.length;
|
|
68
|
+
let padding;
|
|
69
|
+
if (spacesAfter === '\t') {
|
|
70
|
+
padding = 4 - (columnAfterMarker % 4);
|
|
71
|
+
}
|
|
72
|
+
else if (spacesAfter === '') {
|
|
73
|
+
padding = 1;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
padding = spacesAfter.length;
|
|
77
|
+
}
|
|
78
|
+
let paddingToConsume = padding;
|
|
79
|
+
if (spacesAfter === '\t') {
|
|
80
|
+
paddingToConsume = 1;
|
|
81
|
+
paddingChars = 1;
|
|
82
|
+
}
|
|
83
|
+
else if (padding >= 5) {
|
|
84
|
+
paddingToConsume = 1;
|
|
85
|
+
paddingChars = 1;
|
|
86
|
+
}
|
|
87
|
+
const contentIndent = indent + marker.length + paddingToConsume;
|
|
88
|
+
const contentCharIndex = indentChars + marker.length + paddingChars;
|
|
89
|
+
return {
|
|
90
|
+
type: 'ordered',
|
|
91
|
+
indent,
|
|
92
|
+
indentChars,
|
|
93
|
+
marker,
|
|
94
|
+
start,
|
|
95
|
+
delimiter,
|
|
96
|
+
padding: Math.min(paddingToConsume, 4),
|
|
97
|
+
paddingChars,
|
|
98
|
+
contentIndent,
|
|
99
|
+
contentCharIndex,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
function isListItemStart(line) {
|
|
105
|
+
return BULLET_LIST_REGEX.test(line) || ORDERED_LIST_REGEX.test(line);
|
|
106
|
+
}
|
|
107
|
+
function isBulletListStart(line) {
|
|
108
|
+
return BULLET_LIST_REGEX.test(line);
|
|
109
|
+
}
|
|
110
|
+
function isOrderedListStart(line) {
|
|
111
|
+
return ORDERED_LIST_REGEX.test(line);
|
|
112
|
+
}
|
|
113
|
+
function canStartList(line, interruptingParagraph) {
|
|
114
|
+
if (!interruptingParagraph)
|
|
115
|
+
return isListItemStart(line);
|
|
116
|
+
const marker = parseListMarker(line);
|
|
117
|
+
if (!marker)
|
|
118
|
+
return false;
|
|
119
|
+
if (marker.type === 'ordered' && marker.start !== 1) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
const content = line.slice(marker.indent + marker.marker.length + marker.padding);
|
|
123
|
+
if (content.trim() === '') {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
function createListNode(marker) {
|
|
129
|
+
return {
|
|
130
|
+
type: 'list',
|
|
131
|
+
listType: marker.type,
|
|
132
|
+
start: marker.start ?? 1,
|
|
133
|
+
tight: true,
|
|
134
|
+
delimiter: marker.delimiter ?? null,
|
|
135
|
+
bulletChar: marker.bulletChar ?? null,
|
|
136
|
+
children: [],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function createListItemNode() {
|
|
140
|
+
return {
|
|
141
|
+
type: 'list_item',
|
|
142
|
+
children: [],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function listsMatch(a, b) {
|
|
146
|
+
if (a.type !== b.type)
|
|
147
|
+
return false;
|
|
148
|
+
if (a.type === 'bullet' && b.type === 'bullet') {
|
|
149
|
+
return a.bulletChar === b.bulletChar;
|
|
150
|
+
}
|
|
151
|
+
if (a.type === 'ordered' && b.type === 'ordered') {
|
|
152
|
+
return a.delimiter === b.delimiter;
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for paragraph blocks as the default block type.
|
|
3
|
+
*/
|
|
4
|
+
import type { ParagraphNode } from '../types.js';
|
|
5
|
+
export declare function createParagraphNode(): ParagraphNode;
|
|
6
|
+
export declare function isParagraphContinuation(line: string): boolean;
|
|
7
|
+
export declare function trimParagraphLine(line: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parser for paragraph blocks as the default block type.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createParagraphNode = createParagraphNode;
|
|
7
|
+
exports.isParagraphContinuation = isParagraphContinuation;
|
|
8
|
+
exports.trimParagraphLine = trimParagraphLine;
|
|
9
|
+
function createParagraphNode() {
|
|
10
|
+
return {
|
|
11
|
+
type: 'paragraph',
|
|
12
|
+
children: [],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function isParagraphContinuation(line) {
|
|
16
|
+
return line.trim() !== '';
|
|
17
|
+
}
|
|
18
|
+
function trimParagraphLine(line) {
|
|
19
|
+
return line.replace(/^ {0,3}/, '').replace(/[ \t]+$/, '');
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for GFM tables built from pipe-delimited rows.
|
|
3
|
+
*/
|
|
4
|
+
import type { TableNode, TableRowNode, TableCellNode, TableAlignment, InlineNode } from '../types.js';
|
|
5
|
+
export declare function parseDelimiterRow(line: string): TableAlignment[] | null;
|
|
6
|
+
export declare function splitTableRow(line: string): string[];
|
|
7
|
+
export declare function isTableRow(line: string): boolean;
|
|
8
|
+
export declare function couldBeTableHeader(line: string): boolean;
|
|
9
|
+
export declare function isTableStart(headerLine: string, delimiterLine: string): TableAlignment[] | null;
|
|
10
|
+
export declare function createTableCellNode(align: TableAlignment, isHeader: boolean, children?: InlineNode[]): TableCellNode;
|
|
11
|
+
export declare function createTableRowNode(isHeader: boolean, cells?: TableCellNode[]): TableRowNode;
|
|
12
|
+
export declare function createTableNode(alignments: TableAlignment[]): TableNode;
|
|
13
|
+
export declare function parseTableRowCells(line: string, alignments: TableAlignment[], isHeader: boolean): TableCellNode[];
|