@tanstack/markdown 0.0.1
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 +36 -0
- package/dist/extensions/callouts.d.ts +4 -0
- package/dist/extensions/callouts.d.ts.map +1 -0
- package/dist/extensions/callouts.js +39 -0
- package/dist/extensions/comment-components.d.ts +14 -0
- package/dist/extensions/comment-components.d.ts.map +1 -0
- package/dist/extensions/comment-components.js +68 -0
- package/dist/extensions/docs.d.ts +8 -0
- package/dist/extensions/docs.d.ts.map +1 -0
- package/dist/extensions/docs.js +25 -0
- package/dist/extensions/framework.d.ts +3 -0
- package/dist/extensions/framework.d.ts.map +1 -0
- package/dist/extensions/framework.js +40 -0
- package/dist/extensions/headings.d.ts +7 -0
- package/dist/extensions/headings.d.ts.map +1 -0
- package/dist/extensions/headings.js +51 -0
- package/dist/extensions/shared.d.ts +12 -0
- package/dist/extensions/shared.d.ts.map +1 -0
- package/dist/extensions/shared.js +92 -0
- package/dist/extensions/tabs.d.ts +7 -0
- package/dist/extensions/tabs.d.ts.map +1 -0
- package/dist/extensions/tabs.js +145 -0
- package/dist/html.d.ts +6 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +157 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/inline.d.ts +3 -0
- package/dist/inline.d.ts.map +1 -0
- package/dist/inline.js +227 -0
- package/dist/parser.d.ts +3 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +349 -0
- package/dist/react.d.ts +15 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +129 -0
- package/dist/types.d.ts +172 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +70 -0
- package/package.json +94 -0
package/dist/parser.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { parseInline } from './inline.js';
|
|
2
|
+
import { createSlugger, isBlank, normalizeInput, plainText, stripIndent } from './utils.js';
|
|
3
|
+
export function parseMarkdown(markdown, options = {}) {
|
|
4
|
+
const normalized = normalizeInput(markdown);
|
|
5
|
+
const frontmatterEnabled = options.frontmatter !== false;
|
|
6
|
+
let lines = normalized.split('\n');
|
|
7
|
+
let frontmatter;
|
|
8
|
+
if (frontmatterEnabled && lines[0] === '---') {
|
|
9
|
+
const end = lines.findIndex((line, index) => index > 0 && line === '---');
|
|
10
|
+
if (end > 0) {
|
|
11
|
+
frontmatter = lines.slice(1, end).join('\n');
|
|
12
|
+
lines = lines.slice(end + 1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const parser = new BlockParser(lines, options, createSlugger());
|
|
16
|
+
const children = parser.parse();
|
|
17
|
+
let document = frontmatter === undefined ? { type: 'root', children } : { type: 'root', frontmatter, children };
|
|
18
|
+
for (const extension of options.extensions ?? []) {
|
|
19
|
+
document = extension.transformDocument?.(document, { options }) ?? document;
|
|
20
|
+
}
|
|
21
|
+
return document;
|
|
22
|
+
}
|
|
23
|
+
class BlockParser {
|
|
24
|
+
lines;
|
|
25
|
+
options;
|
|
26
|
+
slugger;
|
|
27
|
+
index = 0;
|
|
28
|
+
constructor(lines, options, slugger) {
|
|
29
|
+
this.lines = lines;
|
|
30
|
+
this.options = options;
|
|
31
|
+
this.slugger = slugger;
|
|
32
|
+
}
|
|
33
|
+
parse() {
|
|
34
|
+
const nodes = [];
|
|
35
|
+
while (this.index < this.lines.length) {
|
|
36
|
+
if (isBlank(this.current())) {
|
|
37
|
+
this.index++;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const extensionNode = this.parseExtensionBlock();
|
|
41
|
+
if (extensionNode) {
|
|
42
|
+
nodes.push(extensionNode);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const node = this.parseFence() ??
|
|
46
|
+
this.parseHeading() ??
|
|
47
|
+
this.parseThematicBreak() ??
|
|
48
|
+
this.parseBlockquote() ??
|
|
49
|
+
this.parseList() ??
|
|
50
|
+
this.parseTable() ??
|
|
51
|
+
this.parseHtmlBlock() ??
|
|
52
|
+
this.parseParagraph();
|
|
53
|
+
nodes.push(node);
|
|
54
|
+
}
|
|
55
|
+
return nodes;
|
|
56
|
+
}
|
|
57
|
+
parseExtensionBlock() {
|
|
58
|
+
for (const extension of this.options.extensions ?? []) {
|
|
59
|
+
let consumed = 0;
|
|
60
|
+
const node = extension.parseBlock?.({
|
|
61
|
+
lines: this.lines,
|
|
62
|
+
index: this.index,
|
|
63
|
+
options: this.options,
|
|
64
|
+
parseInline: value => parseInline(value, this.options),
|
|
65
|
+
parseBlocks: value => new BlockParser(normalizeInput(value).split('\n'), this.options, this.slugger).parse(),
|
|
66
|
+
consume: lines => {
|
|
67
|
+
consumed = lines;
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (node) {
|
|
71
|
+
this.index += Math.max(consumed, 1);
|
|
72
|
+
return node;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
parseFence() {
|
|
78
|
+
const match = this.current().match(/^ {0,3}(`{3,}|~{3,})(.*)$/);
|
|
79
|
+
if (!match)
|
|
80
|
+
return undefined;
|
|
81
|
+
const fence = match[1];
|
|
82
|
+
const marker = fence[0];
|
|
83
|
+
const fenceSize = fence.length;
|
|
84
|
+
const info = match[2].trim();
|
|
85
|
+
const code = [];
|
|
86
|
+
this.index++;
|
|
87
|
+
while (this.index < this.lines.length) {
|
|
88
|
+
const line = this.current();
|
|
89
|
+
const close = line.match(/^ {0,3}(`{3,}|~{3,})\s*$/);
|
|
90
|
+
if (close && close[1][0] === marker && close[1].length >= fenceSize) {
|
|
91
|
+
this.index++;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
code.push(line);
|
|
95
|
+
this.index++;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
type: 'code',
|
|
99
|
+
value: code.join('\n'),
|
|
100
|
+
...parseCodeInfo(info),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
parseHeading() {
|
|
104
|
+
const match = this.current().match(/^ {0,3}(#{1,6})(?:\s+|$)(.*?)\s*#*\s*$/);
|
|
105
|
+
if (!match)
|
|
106
|
+
return undefined;
|
|
107
|
+
const depth = match[1].length;
|
|
108
|
+
const children = parseInline(match[2].trim(), this.options);
|
|
109
|
+
const id = this.createHeadingId(children);
|
|
110
|
+
this.index++;
|
|
111
|
+
return id ? { type: 'heading', depth, id, children } : { type: 'heading', depth, children };
|
|
112
|
+
}
|
|
113
|
+
parseThematicBreak() {
|
|
114
|
+
if (!/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(this.current()))
|
|
115
|
+
return undefined;
|
|
116
|
+
this.index++;
|
|
117
|
+
return { type: 'thematicBreak' };
|
|
118
|
+
}
|
|
119
|
+
parseBlockquote() {
|
|
120
|
+
if (!/^ {0,3}>\s?/.test(this.current()))
|
|
121
|
+
return undefined;
|
|
122
|
+
const quoted = [];
|
|
123
|
+
while (this.index < this.lines.length) {
|
|
124
|
+
const line = this.current();
|
|
125
|
+
if (isBlank(line)) {
|
|
126
|
+
quoted.push('');
|
|
127
|
+
this.index++;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const match = line.match(/^ {0,3}>\s?(.*)$/);
|
|
131
|
+
if (!match)
|
|
132
|
+
break;
|
|
133
|
+
quoted.push(match[1]);
|
|
134
|
+
this.index++;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
type: 'blockquote',
|
|
138
|
+
children: new BlockParser(quoted, this.options, this.slugger).parse(),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
parseList() {
|
|
142
|
+
const first = listMarker(this.current());
|
|
143
|
+
if (!first)
|
|
144
|
+
return undefined;
|
|
145
|
+
const items = [];
|
|
146
|
+
const ordered = first.ordered;
|
|
147
|
+
const baseIndent = first.indent;
|
|
148
|
+
const start = ordered ? first.number : undefined;
|
|
149
|
+
while (this.index < this.lines.length) {
|
|
150
|
+
const marker = listMarker(this.current());
|
|
151
|
+
if (!marker || marker.ordered !== ordered || marker.indent !== baseIndent)
|
|
152
|
+
break;
|
|
153
|
+
let firstLine = marker.content;
|
|
154
|
+
const task = firstLine.match(/^\[([ xX])\]\s+(.*)$/);
|
|
155
|
+
const checked = task ? task[1].toLowerCase() === 'x' : undefined;
|
|
156
|
+
if (task)
|
|
157
|
+
firstLine = task[2];
|
|
158
|
+
const itemLines = [firstLine];
|
|
159
|
+
this.index++;
|
|
160
|
+
while (this.index < this.lines.length) {
|
|
161
|
+
const line = this.current();
|
|
162
|
+
const nextMarker = listMarker(line);
|
|
163
|
+
if (nextMarker && nextMarker.indent === baseIndent && nextMarker.ordered === ordered)
|
|
164
|
+
break;
|
|
165
|
+
if (isBlank(line)) {
|
|
166
|
+
itemLines.push('');
|
|
167
|
+
this.index++;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (leadingSpaces(line) > baseIndent) {
|
|
171
|
+
itemLines.push(stripIndent(line, baseIndent + 2));
|
|
172
|
+
this.index++;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (isBlockStart(line, this.next()))
|
|
176
|
+
break;
|
|
177
|
+
itemLines.push(line.trimStart());
|
|
178
|
+
this.index++;
|
|
179
|
+
}
|
|
180
|
+
const children = new BlockParser(itemLines, this.options, this.slugger).parse();
|
|
181
|
+
items.push(checked === undefined ? { type: 'listItem', children } : { type: 'listItem', checked, children });
|
|
182
|
+
}
|
|
183
|
+
return ordered && start !== undefined ? { type: 'list', ordered, start, items } : { type: 'list', ordered, items };
|
|
184
|
+
}
|
|
185
|
+
parseTable() {
|
|
186
|
+
const header = this.current();
|
|
187
|
+
const delimiter = this.next();
|
|
188
|
+
if (!delimiter || !looksLikeTableHeader(header, delimiter))
|
|
189
|
+
return undefined;
|
|
190
|
+
const headerCells = splitTableRow(header);
|
|
191
|
+
const align = splitTableRow(delimiter).map(parseAlign);
|
|
192
|
+
const rows = [];
|
|
193
|
+
this.index += 2;
|
|
194
|
+
while (this.index < this.lines.length) {
|
|
195
|
+
const line = this.current();
|
|
196
|
+
if (isBlank(line) || !line.includes('|'))
|
|
197
|
+
break;
|
|
198
|
+
rows.push(splitTableRow(line).map(value => cell(value, this.options)));
|
|
199
|
+
this.index++;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
type: 'table',
|
|
203
|
+
align,
|
|
204
|
+
header: headerCells.map(value => cell(value, this.options)),
|
|
205
|
+
rows,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
parseHtmlBlock() {
|
|
209
|
+
if (!this.options.allowHtml || !/^ {0,3}<([A-Za-z][\w:-]*|!--|\/[A-Za-z])/.test(this.current()))
|
|
210
|
+
return undefined;
|
|
211
|
+
const html = [];
|
|
212
|
+
while (this.index < this.lines.length && !isBlank(this.current())) {
|
|
213
|
+
html.push(this.current());
|
|
214
|
+
this.index++;
|
|
215
|
+
}
|
|
216
|
+
return { type: 'html', value: html.join('\n') };
|
|
217
|
+
}
|
|
218
|
+
parseParagraph() {
|
|
219
|
+
const lines = [];
|
|
220
|
+
while (this.index < this.lines.length) {
|
|
221
|
+
const line = this.current();
|
|
222
|
+
if (isBlank(line))
|
|
223
|
+
break;
|
|
224
|
+
if (lines.length > 0 && isBlockStart(line, this.next()))
|
|
225
|
+
break;
|
|
226
|
+
lines.push(line.trim());
|
|
227
|
+
this.index++;
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
type: 'paragraph',
|
|
231
|
+
children: parseInline(lines.join('\n'), this.options),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
createHeadingId(children) {
|
|
235
|
+
if (this.options.headingIds === false)
|
|
236
|
+
return undefined;
|
|
237
|
+
const text = plainText(children);
|
|
238
|
+
if (typeof this.options.headingIds === 'function')
|
|
239
|
+
return this.options.headingIds(text, this.index);
|
|
240
|
+
return this.slugger(text);
|
|
241
|
+
}
|
|
242
|
+
current() {
|
|
243
|
+
return this.lines[this.index] ?? '';
|
|
244
|
+
}
|
|
245
|
+
next() {
|
|
246
|
+
return this.lines[this.index + 1];
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function parseCodeInfo(info) {
|
|
250
|
+
if (!info)
|
|
251
|
+
return {};
|
|
252
|
+
const langMatch = info.match(/^([A-Za-z0-9_+.#-]+)/);
|
|
253
|
+
const lang = langMatch?.[1];
|
|
254
|
+
const meta = lang ? info.slice(lang.length).trim() : info;
|
|
255
|
+
const titleMatch = meta.match(/(?:^|\s)(?:title|file)=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/);
|
|
256
|
+
const frameworkMatch = meta.match(/(?:^|\s)framework=(?:"([^"]+)"|'([^']+)'|([^\s}]+))/);
|
|
257
|
+
const rangeMatch = meta.match(/\{([^}]+)\}|(?:^|\s)lines=([^\s]+)/);
|
|
258
|
+
const highlightLines = parseLineRanges(rangeMatch?.[1] ?? rangeMatch?.[2] ?? '');
|
|
259
|
+
const title = titleMatch ? titleMatch[1] ?? titleMatch[2] ?? titleMatch[3] : undefined;
|
|
260
|
+
const framework = frameworkMatch ? frameworkMatch[1] ?? frameworkMatch[2] ?? frameworkMatch[3] : undefined;
|
|
261
|
+
return {
|
|
262
|
+
...(lang ? { lang } : {}),
|
|
263
|
+
...(meta ? { meta } : {}),
|
|
264
|
+
...(title ? { title, file: title } : {}),
|
|
265
|
+
...(framework ? { framework: framework.toLowerCase() } : {}),
|
|
266
|
+
...(highlightLines.length ? { highlightLines } : {}),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function parseLineRanges(value) {
|
|
270
|
+
const lines = new Set();
|
|
271
|
+
for (const part of value.split(',')) {
|
|
272
|
+
const match = part.trim().match(/^(\d+)(?:-(\d+))?$/);
|
|
273
|
+
if (!match)
|
|
274
|
+
continue;
|
|
275
|
+
const start = Number(match[1]);
|
|
276
|
+
const end = Number(match[2] ?? match[1]);
|
|
277
|
+
for (let line = start; line <= end && line < start + 1000; line++)
|
|
278
|
+
lines.add(line);
|
|
279
|
+
}
|
|
280
|
+
return [...lines].sort((a, b) => a - b);
|
|
281
|
+
}
|
|
282
|
+
function listMarker(line) {
|
|
283
|
+
const match = line.match(/^(\s{0,8})([-+*]|\d{1,9}[.)])\s+(.*)$/);
|
|
284
|
+
if (!match)
|
|
285
|
+
return undefined;
|
|
286
|
+
const marker = match[2];
|
|
287
|
+
const ordered = /\d/.test(marker[0]);
|
|
288
|
+
return {
|
|
289
|
+
ordered,
|
|
290
|
+
...(ordered ? { number: Number.parseInt(marker, 10) } : {}),
|
|
291
|
+
indent: match[1].length,
|
|
292
|
+
content: match[3],
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function leadingSpaces(line) {
|
|
296
|
+
return line.match(/^ */)?.[0].length ?? 0;
|
|
297
|
+
}
|
|
298
|
+
function isBlockStart(line, next) {
|
|
299
|
+
return (/^ {0,3}(`{3,}|~{3,})/.test(line) ||
|
|
300
|
+
/^ {0,3}#{1,6}(?:\s+|$)/.test(line) ||
|
|
301
|
+
/^ {0,3}([-*_])(?:\s*\1){2,}\s*$/.test(line) ||
|
|
302
|
+
/^ {0,3}>\s?/.test(line) ||
|
|
303
|
+
listMarker(line) !== undefined ||
|
|
304
|
+
(!!next && looksLikeTableHeader(line, next)));
|
|
305
|
+
}
|
|
306
|
+
function looksLikeTableHeader(header, delimiter) {
|
|
307
|
+
if (!header.includes('|'))
|
|
308
|
+
return false;
|
|
309
|
+
const cells = splitTableRow(delimiter);
|
|
310
|
+
return cells.length > 0 && cells.every(cell => /^:?-{3,}:?$/.test(cell.trim()));
|
|
311
|
+
}
|
|
312
|
+
function splitTableRow(value) {
|
|
313
|
+
let row = value.trim();
|
|
314
|
+
if (row.startsWith('|'))
|
|
315
|
+
row = row.slice(1);
|
|
316
|
+
if (row.endsWith('|'))
|
|
317
|
+
row = row.slice(0, -1);
|
|
318
|
+
const cells = [];
|
|
319
|
+
let current = '';
|
|
320
|
+
for (let index = 0; index < row.length; index++) {
|
|
321
|
+
const char = row[index];
|
|
322
|
+
if (char === '\\' && row[index + 1] === '|') {
|
|
323
|
+
current += '|';
|
|
324
|
+
index++;
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (char === '|') {
|
|
328
|
+
cells.push(current.trim());
|
|
329
|
+
current = '';
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
current += char;
|
|
333
|
+
}
|
|
334
|
+
cells.push(current.trim());
|
|
335
|
+
return cells;
|
|
336
|
+
}
|
|
337
|
+
function parseAlign(value) {
|
|
338
|
+
const trimmed = value.trim();
|
|
339
|
+
if (trimmed.startsWith(':') && trimmed.endsWith(':'))
|
|
340
|
+
return 'center';
|
|
341
|
+
if (trimmed.endsWith(':'))
|
|
342
|
+
return 'right';
|
|
343
|
+
if (trimmed.startsWith(':'))
|
|
344
|
+
return 'left';
|
|
345
|
+
return undefined;
|
|
346
|
+
}
|
|
347
|
+
function cell(value, options) {
|
|
348
|
+
return { type: 'tableCell', children: parseInline(value, options) };
|
|
349
|
+
}
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { BlockNode, InlineNode, MarkdownInput, RenderOptions } from './types.js';
|
|
3
|
+
type ComponentMap = Partial<Record<string, string | ComponentType<any>>>;
|
|
4
|
+
export interface MarkdownReactOptions extends RenderOptions {
|
|
5
|
+
components?: ComponentMap;
|
|
6
|
+
}
|
|
7
|
+
export interface MarkdownProps extends MarkdownReactOptions {
|
|
8
|
+
children: MarkdownInput;
|
|
9
|
+
}
|
|
10
|
+
export declare function Markdown({ children, ...options }: MarkdownProps): ReactElement;
|
|
11
|
+
export declare function renderMarkdownReact(input: MarkdownInput, options?: MarkdownReactOptions): ReactNode;
|
|
12
|
+
export declare function renderBlockReact(node: BlockNode, options?: MarkdownReactOptions, key?: string): ReactElement;
|
|
13
|
+
export declare function renderInlineReact(node: InlineNode, options?: MarkdownReactOptions, key?: string): ReactNode;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAiB,UAAU,EAAE,aAAa,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAA;AAEnH,KAAK,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAExE,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,UAAU,CAAC,EAAE,YAAY,CAAA;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACzD,QAAQ,EAAE,aAAa,CAAA;CACxB;AAED,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,EAAE,aAAa,GAAG,YAAY,CAE9E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,GAAE,oBAAyB,GAAG,SAAS,CAGvG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,oBAAyB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,CAyEhH;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,GAAE,oBAAyB,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAuB/G"}
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Fragment, createElement } from 'react';
|
|
2
|
+
import { parseMarkdown } from './parser.js';
|
|
3
|
+
export function Markdown({ children, ...options }) {
|
|
4
|
+
return createElement(Fragment, null, renderMarkdownReact(children, options));
|
|
5
|
+
}
|
|
6
|
+
export function renderMarkdownReact(input, options = {}) {
|
|
7
|
+
const document = typeof input === 'string' ? parseMarkdown(input, options) : input;
|
|
8
|
+
return document.children.map((node, index) => renderBlockReact(node, options, `b:${index}`));
|
|
9
|
+
}
|
|
10
|
+
export function renderBlockReact(node, options = {}, key) {
|
|
11
|
+
switch (node.type) {
|
|
12
|
+
case 'heading':
|
|
13
|
+
return h(options, `h${node.depth}`, { key, ...(node.id ? { id: node.id } : {}), ...(node.framework ? { 'data-framework': node.framework } : {}) }, renderInlines(node.children, options), renderHeadingAnchorReact(node.id, options));
|
|
14
|
+
case 'paragraph':
|
|
15
|
+
return h(options, 'p', { key }, renderInlines(node.children, options));
|
|
16
|
+
case 'code':
|
|
17
|
+
return renderCodeBlockReact(node, options, key);
|
|
18
|
+
case 'list': {
|
|
19
|
+
const tag = node.ordered ? 'ol' : 'ul';
|
|
20
|
+
return h(options, tag, { key, ...(node.ordered && node.start && node.start !== 1 ? { start: node.start } : {}) }, node.items.map((item, index) => h(options, 'li', { key: index }, item.checked === undefined
|
|
21
|
+
? null
|
|
22
|
+
: h(options, 'input', {
|
|
23
|
+
type: 'checkbox',
|
|
24
|
+
disabled: true,
|
|
25
|
+
checked: item.checked,
|
|
26
|
+
readOnly: true,
|
|
27
|
+
}), item.checked === undefined ? null : ' ', item.children.map((child, childIndex) => renderBlockReact(child, options, `${index}:${childIndex}`)))));
|
|
28
|
+
}
|
|
29
|
+
case 'blockquote':
|
|
30
|
+
return h(options, 'blockquote', { key }, node.children.map((child, index) => renderBlockReact(child, options, `${key}:${index}`)));
|
|
31
|
+
case 'table':
|
|
32
|
+
return h(options, 'table', { key }, h(options, 'thead', null, h(options, 'tr', null, node.header.map((cell, index) => renderTableCellReact('th', cell, node.align[index], options, index)))), h(options, 'tbody', null, node.rows.map((row, rowIndex) => h(options, 'tr', { key: rowIndex }, row.map((cell, index) => renderTableCellReact('td', cell, node.align[index], options, index))))));
|
|
33
|
+
case 'thematicBreak':
|
|
34
|
+
return h(options, 'hr', { key });
|
|
35
|
+
case 'html':
|
|
36
|
+
return options.allowHtml
|
|
37
|
+
? h(options, 'div', { key, dangerouslySetInnerHTML: { __html: node.value } })
|
|
38
|
+
: h(options, 'p', { key }, node.value);
|
|
39
|
+
case 'callout':
|
|
40
|
+
return h(options, 'div', { key, className: `markdown-alert markdown-alert-${node.kind.toLowerCase()}` }, h(options, 'p', { className: 'markdown-alert-title' }, node.title), h(options, 'div', { className: 'markdown-alert-content' }, node.children.map((child, index) => renderBlockReact(child, options, `${key}:${index}`))));
|
|
41
|
+
case 'component':
|
|
42
|
+
return renderComponentReact(node, options, key);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function renderInlineReact(node, options = {}, key) {
|
|
46
|
+
switch (node.type) {
|
|
47
|
+
case 'text':
|
|
48
|
+
return node.value;
|
|
49
|
+
case 'inlineCode':
|
|
50
|
+
return h(options, 'code', { key }, node.value);
|
|
51
|
+
case 'strong':
|
|
52
|
+
return h(options, 'strong', { key }, renderInlines(node.children, options));
|
|
53
|
+
case 'emphasis':
|
|
54
|
+
return h(options, 'em', { key }, renderInlines(node.children, options));
|
|
55
|
+
case 'strike':
|
|
56
|
+
return h(options, 's', { key }, renderInlines(node.children, options));
|
|
57
|
+
case 'link':
|
|
58
|
+
return h(options, 'a', { key, href: node.href, ...(node.title ? { title: node.title } : {}) }, renderInlines(node.children, options));
|
|
59
|
+
case 'image':
|
|
60
|
+
return h(options, 'img', { key, src: node.src, alt: node.alt, ...(node.title ? { title: node.title } : {}) });
|
|
61
|
+
case 'break':
|
|
62
|
+
return h(options, 'br', { key });
|
|
63
|
+
case 'inlineHtml':
|
|
64
|
+
return options.allowHtml
|
|
65
|
+
? h(options, 'span', { key, dangerouslySetInnerHTML: { __html: node.value } })
|
|
66
|
+
: node.value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function renderInlines(nodes, options) {
|
|
70
|
+
return nodes.map((node, index) => renderInlineReact(node, options, `i:${index}`));
|
|
71
|
+
}
|
|
72
|
+
function renderCodeBlockReact(node, options, key) {
|
|
73
|
+
const lang = node.lang ?? 'plaintext';
|
|
74
|
+
const highlighter = options.highlighter;
|
|
75
|
+
const codeProps = {
|
|
76
|
+
className: `language-${lang}`,
|
|
77
|
+
};
|
|
78
|
+
const content = highlighter ? undefined : node.value;
|
|
79
|
+
const highlighted = highlighter
|
|
80
|
+
? {
|
|
81
|
+
dangerouslySetInnerHTML: {
|
|
82
|
+
__html: highlighter(node.value, lang, {
|
|
83
|
+
...(node.highlightLines ? { highlightLines: node.highlightLines } : {}),
|
|
84
|
+
...(options.codeLineNumbers !== undefined ? { lineNumbers: options.codeLineNumbers } : {}),
|
|
85
|
+
}),
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
: undefined;
|
|
89
|
+
const pre = h(options, 'pre', {
|
|
90
|
+
className: 'tm-code',
|
|
91
|
+
'data-lang': lang,
|
|
92
|
+
...(node.title ? { 'data-code-title': node.title } : {}),
|
|
93
|
+
...(node.file ? { 'data-filename': node.file } : {}),
|
|
94
|
+
...(node.framework ? { 'data-framework': node.framework } : {}),
|
|
95
|
+
}, h(options, 'code', { ...codeProps, ...highlighted }, content));
|
|
96
|
+
if (!node.title)
|
|
97
|
+
return h(options, Fragment, { key }, pre);
|
|
98
|
+
return h(options, 'figure', { key, className: 'tm-code-frame', 'data-lang': lang }, h(options, 'figcaption', null, node.title), pre);
|
|
99
|
+
}
|
|
100
|
+
function renderTableCellReact(tag, cell, align, options, key) {
|
|
101
|
+
return h(options, tag, { key, ...(align ? { style: { textAlign: align } } : {}) }, renderInlines(cell.children, options));
|
|
102
|
+
}
|
|
103
|
+
function h(options, tag, props, ...children) {
|
|
104
|
+
const component = typeof tag === 'string' ? options.components?.[tag] ?? tag : tag;
|
|
105
|
+
return createElement(component, props, ...children);
|
|
106
|
+
}
|
|
107
|
+
function renderComponentReact(node, options, key) {
|
|
108
|
+
const tag = node.tagName ?? 'md-comment-component';
|
|
109
|
+
const props = {
|
|
110
|
+
...(node.properties ?? {}),
|
|
111
|
+
};
|
|
112
|
+
if (!node.tagName) {
|
|
113
|
+
props['data-component'] = node.name;
|
|
114
|
+
if (!props['data-attributes'])
|
|
115
|
+
props['data-attributes'] = JSON.stringify(node.attributes);
|
|
116
|
+
}
|
|
117
|
+
return h(options, tag, { key, ...props }, node.children.map((child, index) => renderBlockReact(child, options, `${key}:${index}`)));
|
|
118
|
+
}
|
|
119
|
+
function renderHeadingAnchorReact(id, options) {
|
|
120
|
+
if (!id || !options.headingAnchors)
|
|
121
|
+
return null;
|
|
122
|
+
const anchorOptions = typeof options.headingAnchors === 'object' ? options.headingAnchors : {};
|
|
123
|
+
return h(options, 'a', {
|
|
124
|
+
href: `#${id}`,
|
|
125
|
+
'aria-hidden': anchorOptions.ariaHidden ?? true,
|
|
126
|
+
className: anchorOptions.className ?? 'anchor-heading anchor-heading-link',
|
|
127
|
+
tabIndex: anchorOptions.tabIndex ?? -1,
|
|
128
|
+
}, anchorOptions.content ?? '#');
|
|
129
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export type MarkdownInput = string | MarkdownDocument;
|
|
2
|
+
export interface MarkdownDocument {
|
|
3
|
+
type: 'root';
|
|
4
|
+
children: BlockNode[];
|
|
5
|
+
frontmatter?: string;
|
|
6
|
+
headings?: MarkdownHeading[];
|
|
7
|
+
}
|
|
8
|
+
export type BlockNode = HeadingNode | ParagraphNode | CodeBlockNode | ListNode | BlockquoteNode | TableNode | ThematicBreakNode | HtmlBlockNode | CalloutNode | ComponentNode;
|
|
9
|
+
export interface HeadingNode {
|
|
10
|
+
type: 'heading';
|
|
11
|
+
depth: 1 | 2 | 3 | 4 | 5 | 6;
|
|
12
|
+
id?: string;
|
|
13
|
+
framework?: string;
|
|
14
|
+
children: InlineNode[];
|
|
15
|
+
}
|
|
16
|
+
export interface ParagraphNode {
|
|
17
|
+
type: 'paragraph';
|
|
18
|
+
children: InlineNode[];
|
|
19
|
+
}
|
|
20
|
+
export interface CodeBlockNode {
|
|
21
|
+
type: 'code';
|
|
22
|
+
lang?: string;
|
|
23
|
+
meta?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
framework?: string;
|
|
26
|
+
file?: string;
|
|
27
|
+
value: string;
|
|
28
|
+
highlightLines?: number[];
|
|
29
|
+
}
|
|
30
|
+
export interface ListNode {
|
|
31
|
+
type: 'list';
|
|
32
|
+
ordered: boolean;
|
|
33
|
+
start?: number;
|
|
34
|
+
items: ListItemNode[];
|
|
35
|
+
}
|
|
36
|
+
export interface ListItemNode {
|
|
37
|
+
type: 'listItem';
|
|
38
|
+
checked?: boolean;
|
|
39
|
+
children: BlockNode[];
|
|
40
|
+
}
|
|
41
|
+
export interface BlockquoteNode {
|
|
42
|
+
type: 'blockquote';
|
|
43
|
+
children: BlockNode[];
|
|
44
|
+
}
|
|
45
|
+
export interface TableNode {
|
|
46
|
+
type: 'table';
|
|
47
|
+
align: Array<'left' | 'center' | 'right' | undefined>;
|
|
48
|
+
header: TableCellNode[];
|
|
49
|
+
rows: TableCellNode[][];
|
|
50
|
+
}
|
|
51
|
+
export interface TableCellNode {
|
|
52
|
+
type: 'tableCell';
|
|
53
|
+
children: InlineNode[];
|
|
54
|
+
}
|
|
55
|
+
export interface ThematicBreakNode {
|
|
56
|
+
type: 'thematicBreak';
|
|
57
|
+
}
|
|
58
|
+
export interface HtmlBlockNode {
|
|
59
|
+
type: 'html';
|
|
60
|
+
value: string;
|
|
61
|
+
}
|
|
62
|
+
export interface CalloutNode {
|
|
63
|
+
type: 'callout';
|
|
64
|
+
kind: string;
|
|
65
|
+
title: string;
|
|
66
|
+
children: BlockNode[];
|
|
67
|
+
}
|
|
68
|
+
export interface ComponentNode {
|
|
69
|
+
type: 'component';
|
|
70
|
+
name: string;
|
|
71
|
+
attributes: Record<string, string>;
|
|
72
|
+
children: BlockNode[];
|
|
73
|
+
tagName?: string;
|
|
74
|
+
properties?: Record<string, string>;
|
|
75
|
+
}
|
|
76
|
+
export type InlineNode = TextNode | CodeSpanNode | StrongNode | EmphasisNode | StrikeNode | LinkNode | ImageNode | BreakNode | HtmlInlineNode;
|
|
77
|
+
export interface TextNode {
|
|
78
|
+
type: 'text';
|
|
79
|
+
value: string;
|
|
80
|
+
}
|
|
81
|
+
export interface CodeSpanNode {
|
|
82
|
+
type: 'inlineCode';
|
|
83
|
+
value: string;
|
|
84
|
+
}
|
|
85
|
+
export interface StrongNode {
|
|
86
|
+
type: 'strong';
|
|
87
|
+
children: InlineNode[];
|
|
88
|
+
}
|
|
89
|
+
export interface EmphasisNode {
|
|
90
|
+
type: 'emphasis';
|
|
91
|
+
children: InlineNode[];
|
|
92
|
+
}
|
|
93
|
+
export interface StrikeNode {
|
|
94
|
+
type: 'strike';
|
|
95
|
+
children: InlineNode[];
|
|
96
|
+
}
|
|
97
|
+
export interface LinkNode {
|
|
98
|
+
type: 'link';
|
|
99
|
+
href: string;
|
|
100
|
+
title?: string;
|
|
101
|
+
children: InlineNode[];
|
|
102
|
+
}
|
|
103
|
+
export interface ImageNode {
|
|
104
|
+
type: 'image';
|
|
105
|
+
src: string;
|
|
106
|
+
alt: string;
|
|
107
|
+
title?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface BreakNode {
|
|
110
|
+
type: 'break';
|
|
111
|
+
}
|
|
112
|
+
export interface HtmlInlineNode {
|
|
113
|
+
type: 'inlineHtml';
|
|
114
|
+
value: string;
|
|
115
|
+
}
|
|
116
|
+
export interface MarkdownExtension {
|
|
117
|
+
name: string;
|
|
118
|
+
parseBlock?: (context: BlockParseContext) => BlockNode | undefined;
|
|
119
|
+
transformDocument?: (document: MarkdownDocument, context: DocumentTransformContext) => MarkdownDocument | void;
|
|
120
|
+
transformInline?: (nodes: InlineNode[], context: InlineTransformContext) => InlineNode[];
|
|
121
|
+
renderHtml?: (node: BlockNode | InlineNode, context: HtmlRenderContext) => string | undefined;
|
|
122
|
+
}
|
|
123
|
+
export interface BlockParseContext {
|
|
124
|
+
lines: string[];
|
|
125
|
+
index: number;
|
|
126
|
+
options: ParseOptions;
|
|
127
|
+
parseInline: (value: string) => InlineNode[];
|
|
128
|
+
parseBlocks: (value: string) => BlockNode[];
|
|
129
|
+
consume: (lines: number) => void;
|
|
130
|
+
}
|
|
131
|
+
export interface InlineTransformContext {
|
|
132
|
+
options: ParseOptions;
|
|
133
|
+
}
|
|
134
|
+
export interface DocumentTransformContext {
|
|
135
|
+
options: ParseOptions;
|
|
136
|
+
}
|
|
137
|
+
export interface HtmlRenderContext {
|
|
138
|
+
options: RenderOptions;
|
|
139
|
+
renderBlock: (node: BlockNode) => string;
|
|
140
|
+
renderInline: (node: InlineNode) => string;
|
|
141
|
+
}
|
|
142
|
+
export interface ParseOptions {
|
|
143
|
+
allowHtml?: boolean;
|
|
144
|
+
frontmatter?: boolean;
|
|
145
|
+
headingIds?: boolean | ((text: string, index: number) => string);
|
|
146
|
+
extensions?: MarkdownExtension[];
|
|
147
|
+
}
|
|
148
|
+
export interface RenderOptions extends ParseOptions {
|
|
149
|
+
highlighter?: CodeHighlighter;
|
|
150
|
+
codeLineNumbers?: boolean;
|
|
151
|
+
headingAnchors?: boolean | HeadingAnchorOptions;
|
|
152
|
+
}
|
|
153
|
+
export interface CodeHighlighter {
|
|
154
|
+
(code: string, lang?: string, options?: CodeHighlightOptions): string;
|
|
155
|
+
}
|
|
156
|
+
export interface CodeHighlightOptions {
|
|
157
|
+
highlightLines?: number[];
|
|
158
|
+
lineNumbers?: boolean;
|
|
159
|
+
}
|
|
160
|
+
export interface HeadingAnchorOptions {
|
|
161
|
+
content?: string;
|
|
162
|
+
className?: string;
|
|
163
|
+
ariaHidden?: boolean;
|
|
164
|
+
tabIndex?: number;
|
|
165
|
+
}
|
|
166
|
+
export interface MarkdownHeading {
|
|
167
|
+
id: string;
|
|
168
|
+
text: string;
|
|
169
|
+
level: number;
|
|
170
|
+
framework?: string;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,gBAAgB,CAAA;AAErD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,aAAa,GACb,aAAa,GACb,QAAQ,GACR,cAAc,GACd,SAAS,GACT,iBAAiB,GACjB,aAAa,GACb,WAAW,GACX,aAAa,CAAA;AAEjB,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAA;IACjB,QAAQ,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC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