@uiw/react-md-editor 4.1.5 → 4.1.7
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 +16 -1
- package/dist/mdeditor.css +5 -0
- package/dist/mdeditor.js +2382 -1031
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/Editor.factory.js +85 -11
- package/esm/Types.d.ts +6 -0
- package/esm/commands/index.cn.d.ts +2 -1
- package/esm/commands/index.cn.js +2 -2
- package/esm/commands/index.d.ts +2 -2
- package/esm/commands/index.js +2 -2
- package/esm/commands/list.d.ts +1 -1
- package/esm/commands/list.js +9 -3
- package/esm/components/TextArea/Markdown.common.d.ts +3 -5
- package/esm/components/TextArea/Markdown.common.js +2 -56
- package/esm/components/TextArea/Markdown.d.ts +3 -5
- package/esm/components/TextArea/Markdown.factory.d.ts +6 -0
- package/esm/components/TextArea/Markdown.factory.js +138 -0
- package/esm/components/TextArea/Markdown.js +2 -63
- package/esm/components/TextArea/factory.js +6 -2
- package/esm/components/TextArea/index.css +5 -0
- package/esm/components/TextArea/index.less +5 -0
- package/esm/components/TextArea/splitBlocks.d.ts +13 -0
- package/esm/components/TextArea/splitBlocks.js +111 -0
- package/esm/package.json +1 -0
- package/lib/Editor.factory.js +93 -12
- package/lib/Types.d.ts +6 -0
- package/lib/commands/index.cn.d.ts +2 -1
- package/lib/commands/index.cn.js +8 -1
- package/lib/commands/index.d.ts +2 -2
- package/lib/commands/index.js +6 -0
- package/lib/commands/list.d.ts +1 -1
- package/lib/commands/list.js +5 -1
- package/lib/components/TextArea/Markdown.common.d.ts +3 -5
- package/lib/components/TextArea/Markdown.common.js +3 -60
- package/lib/components/TextArea/Markdown.d.ts +3 -5
- package/lib/components/TextArea/Markdown.factory.d.ts +6 -0
- package/lib/components/TextArea/Markdown.factory.js +148 -0
- package/lib/components/TextArea/Markdown.js +3 -67
- package/lib/components/TextArea/factory.js +6 -2
- package/lib/components/TextArea/index.less +5 -0
- package/lib/components/TextArea/splitBlocks.d.ts +13 -0
- package/lib/components/TextArea/splitBlocks.js +117 -0
- package/markdown-editor.css +5 -0
- package/package.json +18 -12
- package/src/Editor.factory.tsx +83 -4
- package/src/Types.ts +6 -0
- package/src/commands/index.cn.ts +2 -0
- package/src/commands/index.ts +2 -1
- package/src/commands/list.tsx +11 -2
- package/src/components/TextArea/Markdown.common.tsx +3 -46
- package/src/components/TextArea/Markdown.factory.tsx +132 -0
- package/src/components/TextArea/Markdown.tsx +3 -55
- package/src/components/TextArea/factory.tsx +7 -4
- package/src/components/TextArea/index.less +5 -0
- package/src/components/TextArea/splitBlocks.ts +114 -0
package/dist/mdeditor.js
CHANGED
|
@@ -103,276 +103,6 @@ module.exports = {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
/***/ },
|
|
107
|
-
|
|
108
|
-
/***/ 689
|
|
109
|
-
(module) {
|
|
110
|
-
|
|
111
|
-
"use strict";
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// http://www.w3.org/TR/CSS21/grammar.html
|
|
115
|
-
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
|
|
116
|
-
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
117
|
-
|
|
118
|
-
var NEWLINE_REGEX = /\n/g;
|
|
119
|
-
var WHITESPACE_REGEX = /^\s*/;
|
|
120
|
-
|
|
121
|
-
// declaration
|
|
122
|
-
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
|
|
123
|
-
var COLON_REGEX = /^:\s*/;
|
|
124
|
-
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
|
|
125
|
-
var SEMICOLON_REGEX = /^[;\s]*/;
|
|
126
|
-
|
|
127
|
-
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
|
128
|
-
var TRIM_REGEX = /^\s+|\s+$/g;
|
|
129
|
-
|
|
130
|
-
// strings
|
|
131
|
-
var NEWLINE = '\n';
|
|
132
|
-
var FORWARD_SLASH = '/';
|
|
133
|
-
var ASTERISK = '*';
|
|
134
|
-
var EMPTY_STRING = '';
|
|
135
|
-
|
|
136
|
-
// types
|
|
137
|
-
var TYPE_COMMENT = 'comment';
|
|
138
|
-
var TYPE_DECLARATION = 'declaration';
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* @param {String} style
|
|
142
|
-
* @param {Object} [options]
|
|
143
|
-
* @return {Object[]}
|
|
144
|
-
* @throws {TypeError}
|
|
145
|
-
* @throws {Error}
|
|
146
|
-
*/
|
|
147
|
-
function index (style, options) {
|
|
148
|
-
if (typeof style !== 'string') {
|
|
149
|
-
throw new TypeError('First argument must be a string');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (!style) return [];
|
|
153
|
-
|
|
154
|
-
options = options || {};
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Positional.
|
|
158
|
-
*/
|
|
159
|
-
var lineno = 1;
|
|
160
|
-
var column = 1;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Update lineno and column based on `str`.
|
|
164
|
-
*
|
|
165
|
-
* @param {String} str
|
|
166
|
-
*/
|
|
167
|
-
function updatePosition(str) {
|
|
168
|
-
var lines = str.match(NEWLINE_REGEX);
|
|
169
|
-
if (lines) lineno += lines.length;
|
|
170
|
-
var i = str.lastIndexOf(NEWLINE);
|
|
171
|
-
column = ~i ? str.length - i : column + str.length;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Mark position and patch `node.position`.
|
|
176
|
-
*
|
|
177
|
-
* @return {Function}
|
|
178
|
-
*/
|
|
179
|
-
function position() {
|
|
180
|
-
var start = { line: lineno, column: column };
|
|
181
|
-
return function (node) {
|
|
182
|
-
node.position = new Position(start);
|
|
183
|
-
whitespace();
|
|
184
|
-
return node;
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Store position information for a node.
|
|
190
|
-
*
|
|
191
|
-
* @constructor
|
|
192
|
-
* @property {Object} start
|
|
193
|
-
* @property {Object} end
|
|
194
|
-
* @property {undefined|String} source
|
|
195
|
-
*/
|
|
196
|
-
function Position(start) {
|
|
197
|
-
this.start = start;
|
|
198
|
-
this.end = { line: lineno, column: column };
|
|
199
|
-
this.source = options.source;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Non-enumerable source string.
|
|
204
|
-
*/
|
|
205
|
-
Position.prototype.content = style;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Error `msg`.
|
|
209
|
-
*
|
|
210
|
-
* @param {String} msg
|
|
211
|
-
* @throws {Error}
|
|
212
|
-
*/
|
|
213
|
-
function error(msg) {
|
|
214
|
-
var err = new Error(
|
|
215
|
-
options.source + ':' + lineno + ':' + column + ': ' + msg
|
|
216
|
-
);
|
|
217
|
-
err.reason = msg;
|
|
218
|
-
err.filename = options.source;
|
|
219
|
-
err.line = lineno;
|
|
220
|
-
err.column = column;
|
|
221
|
-
err.source = style;
|
|
222
|
-
|
|
223
|
-
if (options.silent) ; else {
|
|
224
|
-
throw err;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Match `re` and return captures.
|
|
230
|
-
*
|
|
231
|
-
* @param {RegExp} re
|
|
232
|
-
* @return {undefined|Array}
|
|
233
|
-
*/
|
|
234
|
-
function match(re) {
|
|
235
|
-
var m = re.exec(style);
|
|
236
|
-
if (!m) return;
|
|
237
|
-
var str = m[0];
|
|
238
|
-
updatePosition(str);
|
|
239
|
-
style = style.slice(str.length);
|
|
240
|
-
return m;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Parse whitespace.
|
|
245
|
-
*/
|
|
246
|
-
function whitespace() {
|
|
247
|
-
match(WHITESPACE_REGEX);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Parse comments.
|
|
252
|
-
*
|
|
253
|
-
* @param {Object[]} [rules]
|
|
254
|
-
* @return {Object[]}
|
|
255
|
-
*/
|
|
256
|
-
function comments(rules) {
|
|
257
|
-
var c;
|
|
258
|
-
rules = rules || [];
|
|
259
|
-
while ((c = comment())) {
|
|
260
|
-
if (c !== false) {
|
|
261
|
-
rules.push(c);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
return rules;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Parse comment.
|
|
269
|
-
*
|
|
270
|
-
* @return {Object}
|
|
271
|
-
* @throws {Error}
|
|
272
|
-
*/
|
|
273
|
-
function comment() {
|
|
274
|
-
var pos = position();
|
|
275
|
-
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
|
|
276
|
-
|
|
277
|
-
var i = 2;
|
|
278
|
-
while (
|
|
279
|
-
EMPTY_STRING != style.charAt(i) &&
|
|
280
|
-
(ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))
|
|
281
|
-
) {
|
|
282
|
-
++i;
|
|
283
|
-
}
|
|
284
|
-
i += 2;
|
|
285
|
-
|
|
286
|
-
if (EMPTY_STRING === style.charAt(i - 1)) {
|
|
287
|
-
return error('End of comment missing');
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
var str = style.slice(2, i - 2);
|
|
291
|
-
column += 2;
|
|
292
|
-
updatePosition(str);
|
|
293
|
-
style = style.slice(i);
|
|
294
|
-
column += 2;
|
|
295
|
-
|
|
296
|
-
return pos({
|
|
297
|
-
type: TYPE_COMMENT,
|
|
298
|
-
comment: str
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Parse declaration.
|
|
304
|
-
*
|
|
305
|
-
* @return {Object}
|
|
306
|
-
* @throws {Error}
|
|
307
|
-
*/
|
|
308
|
-
function declaration() {
|
|
309
|
-
var pos = position();
|
|
310
|
-
|
|
311
|
-
// prop
|
|
312
|
-
var prop = match(PROPERTY_REGEX);
|
|
313
|
-
if (!prop) return;
|
|
314
|
-
comment();
|
|
315
|
-
|
|
316
|
-
// :
|
|
317
|
-
if (!match(COLON_REGEX)) return error("property missing ':'");
|
|
318
|
-
|
|
319
|
-
// val
|
|
320
|
-
var val = match(VALUE_REGEX);
|
|
321
|
-
|
|
322
|
-
var ret = pos({
|
|
323
|
-
type: TYPE_DECLARATION,
|
|
324
|
-
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
|
|
325
|
-
value: val
|
|
326
|
-
? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
|
|
327
|
-
: EMPTY_STRING
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
// ;
|
|
331
|
-
match(SEMICOLON_REGEX);
|
|
332
|
-
|
|
333
|
-
return ret;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Parse declarations.
|
|
338
|
-
*
|
|
339
|
-
* @return {Object[]}
|
|
340
|
-
*/
|
|
341
|
-
function declarations() {
|
|
342
|
-
var decls = [];
|
|
343
|
-
|
|
344
|
-
comments(decls);
|
|
345
|
-
|
|
346
|
-
// declarations
|
|
347
|
-
var decl;
|
|
348
|
-
while ((decl = declaration())) {
|
|
349
|
-
if (decl !== false) {
|
|
350
|
-
decls.push(decl);
|
|
351
|
-
comments(decls);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
return decls;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
whitespace();
|
|
359
|
-
return declarations();
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Trim `str`.
|
|
364
|
-
*
|
|
365
|
-
* @param {String} str
|
|
366
|
-
* @return {String}
|
|
367
|
-
*/
|
|
368
|
-
function trim(str) {
|
|
369
|
-
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
module.exports = index;
|
|
373
|
-
//# sourceMappingURL=index.js.map
|
|
374
|
-
|
|
375
|
-
|
|
376
106
|
/***/ },
|
|
377
107
|
|
|
378
108
|
/***/ 934
|
|
@@ -416,111 +146,6 @@ exports["default"] = parsePart;
|
|
|
416
146
|
module.exports = parsePart;
|
|
417
147
|
|
|
418
148
|
|
|
419
|
-
/***/ },
|
|
420
|
-
|
|
421
|
-
/***/ 969
|
|
422
|
-
(__unused_webpack_module, exports) {
|
|
423
|
-
|
|
424
|
-
"use strict";
|
|
425
|
-
|
|
426
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
427
|
-
exports.camelCase = void 0;
|
|
428
|
-
var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
|
|
429
|
-
var HYPHEN_REGEX = /-([a-z])/g;
|
|
430
|
-
var NO_HYPHEN_REGEX = /^[^-]+$/;
|
|
431
|
-
var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
|
|
432
|
-
var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
|
|
433
|
-
/**
|
|
434
|
-
* Checks whether to skip camelCase.
|
|
435
|
-
*/
|
|
436
|
-
var skipCamelCase = function (property) {
|
|
437
|
-
return !property ||
|
|
438
|
-
NO_HYPHEN_REGEX.test(property) ||
|
|
439
|
-
CUSTOM_PROPERTY_REGEX.test(property);
|
|
440
|
-
};
|
|
441
|
-
/**
|
|
442
|
-
* Replacer that capitalizes first character.
|
|
443
|
-
*/
|
|
444
|
-
var capitalize = function (match, character) {
|
|
445
|
-
return character.toUpperCase();
|
|
446
|
-
};
|
|
447
|
-
/**
|
|
448
|
-
* Replacer that removes beginning hyphen of vendor prefix property.
|
|
449
|
-
*/
|
|
450
|
-
var trimHyphen = function (match, prefix) { return "".concat(prefix, "-"); };
|
|
451
|
-
/**
|
|
452
|
-
* CamelCases a CSS property.
|
|
453
|
-
*/
|
|
454
|
-
var camelCase = function (property, options) {
|
|
455
|
-
if (options === void 0) { options = {}; }
|
|
456
|
-
if (skipCamelCase(property)) {
|
|
457
|
-
return property;
|
|
458
|
-
}
|
|
459
|
-
property = property.toLowerCase();
|
|
460
|
-
if (options.reactCompat) {
|
|
461
|
-
// `-ms` vendor prefix should not be capitalized
|
|
462
|
-
property = property.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
|
|
463
|
-
}
|
|
464
|
-
else {
|
|
465
|
-
// for non-React, remove first hyphen so vendor prefix is not capitalized
|
|
466
|
-
property = property.replace(VENDOR_PREFIX_REGEX, trimHyphen);
|
|
467
|
-
}
|
|
468
|
-
return property.replace(HYPHEN_REGEX, capitalize);
|
|
469
|
-
};
|
|
470
|
-
exports.camelCase = camelCase;
|
|
471
|
-
//# sourceMappingURL=utilities.js.map
|
|
472
|
-
|
|
473
|
-
/***/ },
|
|
474
|
-
|
|
475
|
-
/***/ 857
|
|
476
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
477
|
-
|
|
478
|
-
"use strict";
|
|
479
|
-
|
|
480
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
481
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
482
|
-
};
|
|
483
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
484
|
-
exports["default"] = StyleToObject;
|
|
485
|
-
const inline_style_parser_1 = __importDefault(__webpack_require__(689));
|
|
486
|
-
/**
|
|
487
|
-
* Parses inline style to object.
|
|
488
|
-
*
|
|
489
|
-
* @param style - Inline style.
|
|
490
|
-
* @param iterator - Iterator.
|
|
491
|
-
* @returns - Style object or null.
|
|
492
|
-
*
|
|
493
|
-
* @example Parsing inline style to object:
|
|
494
|
-
*
|
|
495
|
-
* ```js
|
|
496
|
-
* import parse from 'style-to-object';
|
|
497
|
-
* parse('line-height: 42;'); // { 'line-height': '42' }
|
|
498
|
-
* ```
|
|
499
|
-
*/
|
|
500
|
-
function StyleToObject(style, iterator) {
|
|
501
|
-
let styleObject = null;
|
|
502
|
-
if (!style || typeof style !== 'string') {
|
|
503
|
-
return styleObject;
|
|
504
|
-
}
|
|
505
|
-
const declarations = (0, inline_style_parser_1.default)(style);
|
|
506
|
-
const hasIterator = typeof iterator === 'function';
|
|
507
|
-
declarations.forEach((declaration) => {
|
|
508
|
-
if (declaration.type !== 'declaration') {
|
|
509
|
-
return;
|
|
510
|
-
}
|
|
511
|
-
const { property, value } = declaration;
|
|
512
|
-
if (hasIterator) {
|
|
513
|
-
iterator(property, value, declaration);
|
|
514
|
-
}
|
|
515
|
-
else if (value) {
|
|
516
|
-
styleObject = styleObject || {};
|
|
517
|
-
styleObject[property] = value;
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
return styleObject;
|
|
521
|
-
}
|
|
522
|
-
//# sourceMappingURL=index.js.map
|
|
523
|
-
|
|
524
149
|
/***/ },
|
|
525
150
|
|
|
526
151
|
/***/ 442
|
|
@@ -656,6 +281,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
656
281
|
issue: () => (/* reexport */ issue),
|
|
657
282
|
italic: () => (/* reexport */ italic),
|
|
658
283
|
link: () => (/* reexport */ commands_link_link),
|
|
284
|
+
makeList: () => (/* reexport */ makeList),
|
|
659
285
|
orderedListCommand: () => (/* reexport */ orderedListCommand),
|
|
660
286
|
quote: () => (/* reexport */ quote),
|
|
661
287
|
reducer: () => (/* reexport */ reducer),
|
|
@@ -823,45 +449,6 @@ if (true) {
|
|
|
823
449
|
|
|
824
450
|
});
|
|
825
451
|
|
|
826
|
-
// MODULE: ../node_modules/style-to-js/cjs/index.js
|
|
827
|
-
var style_to_js_cjs_namespaceFn = /*#__PURE__*/__webpack_require__.cw(function(module) {
|
|
828
|
-
|
|
829
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
830
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
831
|
-
};
|
|
832
|
-
var style_to_object_1 = __importDefault((cjs_namespaceFn()));
|
|
833
|
-
var utilities_1 = (utilities_namespaceFn());
|
|
834
|
-
/**
|
|
835
|
-
* Parses CSS inline style to JavaScript object (camelCased).
|
|
836
|
-
*/
|
|
837
|
-
function StyleToJS(style, options) {
|
|
838
|
-
var output = {};
|
|
839
|
-
if (!style || typeof style !== 'string') {
|
|
840
|
-
return output;
|
|
841
|
-
}
|
|
842
|
-
(0, style_to_object_1.default)(style, function (property, value) {
|
|
843
|
-
// skip CSS comment
|
|
844
|
-
if (property && value) {
|
|
845
|
-
output[(0, utilities_1.camelCase)(property, options)] = value;
|
|
846
|
-
}
|
|
847
|
-
});
|
|
848
|
-
return output;
|
|
849
|
-
}
|
|
850
|
-
StyleToJS.default = StyleToJS;
|
|
851
|
-
module.exports = StyleToJS;
|
|
852
|
-
//# sourceMappingURL=index.js.map
|
|
853
|
-
});
|
|
854
|
-
|
|
855
|
-
// EXTERNAL MODULE: ../node_modules/style-to-js/cjs/utilities.js
|
|
856
|
-
var utilities_namespaceFn = () => {
|
|
857
|
-
return __webpack_require__(969);
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
// EXTERNAL MODULE: ../node_modules/style-to-object/cjs/index.js
|
|
861
|
-
var cjs_namespaceFn = () => {
|
|
862
|
-
return __webpack_require__(857);
|
|
863
|
-
};
|
|
864
|
-
|
|
865
452
|
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
866
453
|
var external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn = () => {
|
|
867
454
|
return __webpack_require__(442);
|
|
@@ -941,6 +528,7 @@ __webpack_require__.d(commands_namespaceObject, {
|
|
|
941
528
|
issue: () => (issue),
|
|
942
529
|
italic: () => (italic),
|
|
943
530
|
link: () => (commands_link_link),
|
|
531
|
+
makeList: () => (makeList),
|
|
944
532
|
orderedListCommand: () => (orderedListCommand),
|
|
945
533
|
quote: () => (quote),
|
|
946
534
|
strikethrough: () => (strikeThrough_strikethrough),
|
|
@@ -8552,6 +8140,8 @@ function space_separated_tokens_stringify(values) {
|
|
|
8552
8140
|
|
|
8553
8141
|
|
|
8554
8142
|
/**
|
|
8143
|
+
* Create an `h` function.
|
|
8144
|
+
*
|
|
8555
8145
|
* @param {Schema} schema
|
|
8556
8146
|
* Schema to use.
|
|
8557
8147
|
* @param {string} defaultTagName
|
|
@@ -8569,23 +8159,25 @@ function createH(schema, defaultTagName, caseSensitive) {
|
|
|
8569
8159
|
*
|
|
8570
8160
|
* @overload
|
|
8571
8161
|
* @param {null | undefined} [selector]
|
|
8162
|
+
* Nothing to get a root.
|
|
8572
8163
|
* @param {...Child} children
|
|
8164
|
+
* Children.
|
|
8573
8165
|
* @returns {Root}
|
|
8166
|
+
* Root.
|
|
8574
8167
|
*
|
|
8575
8168
|
* @overload
|
|
8576
8169
|
* @param {string} selector
|
|
8577
|
-
*
|
|
8578
|
-
* @param {
|
|
8579
|
-
*
|
|
8580
|
-
*
|
|
8581
|
-
* @overload
|
|
8582
|
-
* @param {string} selector
|
|
8170
|
+
* Selector.
|
|
8171
|
+
* @param {Child | Properties} [properties]
|
|
8172
|
+
* Properties (or first child) (default: `undefined`).
|
|
8583
8173
|
* @param {...Child} children
|
|
8174
|
+
* Children.
|
|
8584
8175
|
* @returns {Element}
|
|
8176
|
+
* Element.
|
|
8585
8177
|
*
|
|
8586
8178
|
* @param {string | null | undefined} [selector]
|
|
8587
8179
|
* Selector.
|
|
8588
|
-
* @param {Child | Properties
|
|
8180
|
+
* @param {Child | Properties} [properties]
|
|
8589
8181
|
* Properties (or first child) (default: `undefined`).
|
|
8590
8182
|
* @param {...Child} children
|
|
8591
8183
|
* Children.
|
|
@@ -8623,7 +8215,11 @@ function createH(schema, defaultTagName, caseSensitive) {
|
|
|
8623
8215
|
addChild(node.children, child)
|
|
8624
8216
|
}
|
|
8625
8217
|
|
|
8626
|
-
if (
|
|
8218
|
+
if (
|
|
8219
|
+
node.type === 'element' &&
|
|
8220
|
+
node.tagName === 'template' &&
|
|
8221
|
+
schema.space === 'html'
|
|
8222
|
+
) {
|
|
8627
8223
|
node.content = {type: 'root', children: node.children}
|
|
8628
8224
|
node.children = []
|
|
8629
8225
|
}
|
|
@@ -8684,6 +8280,8 @@ function isChild(value) {
|
|
|
8684
8280
|
}
|
|
8685
8281
|
|
|
8686
8282
|
/**
|
|
8283
|
+
* Add a property.
|
|
8284
|
+
*
|
|
8687
8285
|
* @param {Schema} schema
|
|
8688
8286
|
* Schema.
|
|
8689
8287
|
* @param {Properties} properties
|
|
@@ -8696,13 +8294,13 @@ function isChild(value) {
|
|
|
8696
8294
|
* Nothing.
|
|
8697
8295
|
*/
|
|
8698
8296
|
function addProperty(schema, properties, key, value) {
|
|
8297
|
+
// Ignore nullish and NaN values.
|
|
8298
|
+
if (value === null || value === undefined) return
|
|
8299
|
+
|
|
8699
8300
|
const info = find(schema, key)
|
|
8700
8301
|
/** @type {PropertyValue} */
|
|
8701
8302
|
let result
|
|
8702
8303
|
|
|
8703
|
-
// Ignore nullish and NaN values.
|
|
8704
|
-
if (value === null || value === undefined) return
|
|
8705
|
-
|
|
8706
8304
|
if (typeof value === 'number') {
|
|
8707
8305
|
// Ignore NaN.
|
|
8708
8306
|
if (Number.isNaN(value)) return
|
|
@@ -8727,7 +8325,7 @@ function addProperty(schema, properties, key, value) {
|
|
|
8727
8325
|
} else if (Array.isArray(value)) {
|
|
8728
8326
|
result = [...value]
|
|
8729
8327
|
} else {
|
|
8730
|
-
result = info.property === 'style' ?
|
|
8328
|
+
result = info.property === 'style' ? style(value) : String(value)
|
|
8731
8329
|
}
|
|
8732
8330
|
|
|
8733
8331
|
if (Array.isArray(result)) {
|
|
@@ -8749,15 +8347,16 @@ function addProperty(schema, properties, key, value) {
|
|
|
8749
8347
|
// Class names (which can be added both on the `selector` and here).
|
|
8750
8348
|
if (info.property === 'className' && Array.isArray(properties.className)) {
|
|
8751
8349
|
// Assume no booleans in `className`.
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
)
|
|
8350
|
+
const add = /** @type {Array<number | string> | number | string} */ (result)
|
|
8351
|
+
result = [...properties.className, ...(Array.isArray(add) ? add : [add])]
|
|
8755
8352
|
}
|
|
8756
8353
|
|
|
8757
8354
|
properties[info.property] = result
|
|
8758
8355
|
}
|
|
8759
8356
|
|
|
8760
8357
|
/**
|
|
8358
|
+
* Add a child.
|
|
8359
|
+
*
|
|
8761
8360
|
* @param {Array<RootContent>} nodes
|
|
8762
8361
|
* Children.
|
|
8763
8362
|
* @param {Child} value
|
|
@@ -8822,7 +8421,7 @@ function parsePrimitive(info, name, value) {
|
|
|
8822
8421
|
* @returns {string}
|
|
8823
8422
|
* CSS string.
|
|
8824
8423
|
*/
|
|
8825
|
-
function
|
|
8424
|
+
function style(styles) {
|
|
8826
8425
|
/** @type {Array<string>} */
|
|
8827
8426
|
const result = []
|
|
8828
8427
|
|
|
@@ -36972,7 +36571,7 @@ const webNamespaces = {
|
|
|
36972
36571
|
|
|
36973
36572
|
;// ../node_modules/hast-util-from-parse5/lib/index.js
|
|
36974
36573
|
/**
|
|
36975
|
-
* @import {ElementData, Element, Nodes, RootContent, Root} from 'hast'
|
|
36574
|
+
* @import {ElementContent, ElementData, Element, Nodes, RootContent, Root} from 'hast'
|
|
36976
36575
|
* @import {DefaultTreeAdapterMap, Token} from 'parse5'
|
|
36977
36576
|
* @import {Schema} from 'property-information'
|
|
36978
36577
|
* @import {Point, Position} from 'unist'
|
|
@@ -37143,7 +36742,7 @@ function hast_util_from_parse5_lib_all(state, nodes) {
|
|
|
37143
36742
|
* hast node.
|
|
37144
36743
|
*/
|
|
37145
36744
|
function lib_element(state, node) {
|
|
37146
|
-
const schema = state
|
|
36745
|
+
const {schema} = state
|
|
37147
36746
|
|
|
37148
36747
|
state.schema = node.namespaceURI === webNamespaces.svg ? property_information_svg : property_information_html
|
|
37149
36748
|
|
|
@@ -37168,19 +36767,30 @@ function lib_element(state, node) {
|
|
|
37168
36767
|
|
|
37169
36768
|
// Switch content.
|
|
37170
36769
|
if (result.tagName === 'template') {
|
|
37171
|
-
|
|
37172
|
-
|
|
37173
|
-
|
|
37174
|
-
|
|
37175
|
-
|
|
37176
|
-
|
|
37177
|
-
|
|
37178
|
-
|
|
37179
|
-
|
|
37180
|
-
|
|
36770
|
+
// Only `template`s in HTML have content.
|
|
36771
|
+
if (node.namespaceURI === webNamespaces.html) {
|
|
36772
|
+
const reference = /** @type {DefaultTreeAdapterMap['template']} */ (node)
|
|
36773
|
+
const pos = reference.sourceCodeLocation
|
|
36774
|
+
const startTag = pos && pos.startTag && position(pos.startTag)
|
|
36775
|
+
const endTag = pos && pos.endTag && position(pos.endTag)
|
|
36776
|
+
|
|
36777
|
+
// Root in, root out.
|
|
36778
|
+
const content = /** @type {Root} */ (hast_util_from_parse5_lib_one(state, reference.content))
|
|
36779
|
+
|
|
36780
|
+
if (startTag && endTag && state.file) {
|
|
36781
|
+
content.position = {start: startTag.end, end: endTag.start}
|
|
36782
|
+
}
|
|
36783
|
+
|
|
36784
|
+
result.content = content
|
|
36785
|
+
} else if (result.content) {
|
|
36786
|
+
// In SVG and MathML `template`s are normal elements.
|
|
36787
|
+
// `h` moves their children into `content`, move them back.
|
|
36788
|
+
// And assume no roots or doctypes in `content`.
|
|
36789
|
+
result.children = /** @type {Array<ElementContent>} */ (
|
|
36790
|
+
result.content.children
|
|
36791
|
+
)
|
|
36792
|
+
delete result.content
|
|
37181
36793
|
}
|
|
37182
|
-
|
|
37183
|
-
result.content = content
|
|
37184
36794
|
}
|
|
37185
36795
|
|
|
37186
36796
|
state.schema = schema
|
|
@@ -37353,7 +36963,7 @@ const emptyOptions = {}
|
|
|
37353
36963
|
|
|
37354
36964
|
const hast_util_to_parse5_lib_own = {}.hasOwnProperty
|
|
37355
36965
|
|
|
37356
|
-
const hast_util_to_parse5_lib_one = zwitch('type', {handlers: {root: lib_root, element: hast_util_to_parse5_lib_element, text: lib_text, comment
|
|
36966
|
+
const hast_util_to_parse5_lib_one = zwitch('type', {handlers: {root: lib_root, element: hast_util_to_parse5_lib_element, text: lib_text, comment, doctype}})
|
|
37357
36967
|
|
|
37358
36968
|
/**
|
|
37359
36969
|
* Transform a hast tree to a `parse5` AST.
|
|
@@ -37451,7 +37061,7 @@ function lib_text(node) {
|
|
|
37451
37061
|
* @returns {Parse5Comment}
|
|
37452
37062
|
* Parse5 node.
|
|
37453
37063
|
*/
|
|
37454
|
-
function
|
|
37064
|
+
function comment(node) {
|
|
37455
37065
|
/** @type {Parse5Comment} */
|
|
37456
37066
|
const result = {
|
|
37457
37067
|
nodeName: '#comment',
|
|
@@ -46436,7 +46046,7 @@ function raw(tree, options) {
|
|
|
46436
46046
|
const document = documentMode(tree)
|
|
46437
46047
|
/** @type {(node: Nodes, state: State) => undefined} */
|
|
46438
46048
|
const one = zwitch('type', {
|
|
46439
|
-
handlers: {root: hast_util_raw_lib_root, element: hast_util_raw_lib_element, text: hast_util_raw_lib_text, comment:
|
|
46049
|
+
handlers: {root: hast_util_raw_lib_root, element: hast_util_raw_lib_element, text: hast_util_raw_lib_text, comment: lib_comment, doctype: lib_doctype, raw: handleRaw},
|
|
46440
46050
|
unknown
|
|
46441
46051
|
})
|
|
46442
46052
|
|
|
@@ -46631,7 +46241,7 @@ function stitch(node, state) {
|
|
|
46631
46241
|
// Hack: `value` is supposed to be a string, but as none of the tools
|
|
46632
46242
|
// (`parse5` or `hast-util-from-parse5`) looks at it, we can pass nodes
|
|
46633
46243
|
// through.
|
|
46634
|
-
|
|
46244
|
+
lib_comment({type: 'comment', value: {stitch: clone}}, state)
|
|
46635
46245
|
}
|
|
46636
46246
|
|
|
46637
46247
|
/**
|
|
@@ -46644,7 +46254,7 @@ function stitch(node, state) {
|
|
|
46644
46254
|
* @returns {undefined}
|
|
46645
46255
|
* Nothing.
|
|
46646
46256
|
*/
|
|
46647
|
-
function
|
|
46257
|
+
function lib_comment(node, state) {
|
|
46648
46258
|
/** @type {string} */
|
|
46649
46259
|
// @ts-expect-error: we pass stitches through.
|
|
46650
46260
|
const data = node.value
|
|
@@ -47191,9 +46801,288 @@ const hastToReact = {
|
|
|
47191
46801
|
xmlnsXLink: 'xmlnsXlink'
|
|
47192
46802
|
}
|
|
47193
46803
|
|
|
47194
|
-
;// ../node_modules/style-
|
|
47195
|
-
|
|
46804
|
+
;// ../node_modules/inline-style-parser/esm/index.mjs
|
|
46805
|
+
// http://www.w3.org/TR/CSS21/grammar.html
|
|
46806
|
+
// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
|
|
46807
|
+
var COMMENT_REGEX = /\/\*(?:[^*]|\*(?!\/))*\*\//g;
|
|
46808
|
+
|
|
46809
|
+
var NEWLINE_REGEX = /\n/g;
|
|
46810
|
+
var WHITESPACE_REGEX = /^\s*/;
|
|
46811
|
+
|
|
46812
|
+
// declaration
|
|
46813
|
+
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
|
|
46814
|
+
var COLON_REGEX = /^:\s*/;
|
|
46815
|
+
var VALUE_REGEX =
|
|
46816
|
+
/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/;
|
|
46817
|
+
var SEMICOLON_REGEX = /^[;\s]*/;
|
|
46818
|
+
|
|
46819
|
+
// strings
|
|
46820
|
+
var NEWLINE = '\n';
|
|
46821
|
+
var FORWARD_SLASH = '/';
|
|
46822
|
+
var ASTERISK = '*';
|
|
46823
|
+
var EMPTY_STRING = '';
|
|
46824
|
+
|
|
46825
|
+
// types
|
|
46826
|
+
var TYPE_COMMENT = 'comment';
|
|
46827
|
+
var TYPE_DECLARATION = 'declaration';
|
|
46828
|
+
|
|
46829
|
+
/**
|
|
46830
|
+
* @param {String} style
|
|
46831
|
+
* @param {Object} [options]
|
|
46832
|
+
* @return {Object[]}
|
|
46833
|
+
* @throws {TypeError}
|
|
46834
|
+
* @throws {Error}
|
|
46835
|
+
*/
|
|
46836
|
+
function index (style, options) {
|
|
46837
|
+
if (typeof style !== 'string') {
|
|
46838
|
+
throw new TypeError('First argument must be a string');
|
|
46839
|
+
}
|
|
46840
|
+
|
|
46841
|
+
if (!style) return [];
|
|
46842
|
+
|
|
46843
|
+
options = options || {};
|
|
46844
|
+
|
|
46845
|
+
/**
|
|
46846
|
+
* Positional.
|
|
46847
|
+
*/
|
|
46848
|
+
var lineno = 1;
|
|
46849
|
+
var column = 1;
|
|
46850
|
+
|
|
46851
|
+
/**
|
|
46852
|
+
* Update lineno and column based on `str`.
|
|
46853
|
+
*
|
|
46854
|
+
* @param {String} str
|
|
46855
|
+
*/
|
|
46856
|
+
function updatePosition(str) {
|
|
46857
|
+
var lines = str.match(NEWLINE_REGEX);
|
|
46858
|
+
if (lines) lineno += lines.length;
|
|
46859
|
+
var i = str.lastIndexOf(NEWLINE);
|
|
46860
|
+
column = ~i ? str.length - i : column + str.length;
|
|
46861
|
+
}
|
|
46862
|
+
|
|
46863
|
+
/**
|
|
46864
|
+
* Mark position and patch `node.position`.
|
|
46865
|
+
*
|
|
46866
|
+
* @return {Function}
|
|
46867
|
+
*/
|
|
46868
|
+
function position() {
|
|
46869
|
+
var start = { line: lineno, column: column };
|
|
46870
|
+
return function (node) {
|
|
46871
|
+
node.position = new Position(start);
|
|
46872
|
+
whitespace();
|
|
46873
|
+
return node;
|
|
46874
|
+
};
|
|
46875
|
+
}
|
|
46876
|
+
|
|
46877
|
+
/**
|
|
46878
|
+
* Store position information for a node.
|
|
46879
|
+
*
|
|
46880
|
+
* @constructor
|
|
46881
|
+
* @property {Object} start
|
|
46882
|
+
* @property {Object} end
|
|
46883
|
+
* @property {undefined|String} source
|
|
46884
|
+
*/
|
|
46885
|
+
function Position(start) {
|
|
46886
|
+
this.start = start;
|
|
46887
|
+
this.end = { line: lineno, column: column };
|
|
46888
|
+
this.source = options.source;
|
|
46889
|
+
}
|
|
46890
|
+
|
|
46891
|
+
/**
|
|
46892
|
+
* Non-enumerable source string.
|
|
46893
|
+
*/
|
|
46894
|
+
Position.prototype.content = style;
|
|
46895
|
+
|
|
46896
|
+
/**
|
|
46897
|
+
* Error `msg`.
|
|
46898
|
+
*
|
|
46899
|
+
* @param {String} msg
|
|
46900
|
+
* @throws {Error}
|
|
46901
|
+
*/
|
|
46902
|
+
function error(msg) {
|
|
46903
|
+
var err = new Error(
|
|
46904
|
+
options.source + ':' + lineno + ':' + column + ': ' + msg
|
|
46905
|
+
);
|
|
46906
|
+
err.reason = msg;
|
|
46907
|
+
err.filename = options.source;
|
|
46908
|
+
err.line = lineno;
|
|
46909
|
+
err.column = column;
|
|
46910
|
+
err.source = style;
|
|
46911
|
+
|
|
46912
|
+
if (options.silent) ; else {
|
|
46913
|
+
throw err;
|
|
46914
|
+
}
|
|
46915
|
+
}
|
|
46916
|
+
|
|
46917
|
+
/**
|
|
46918
|
+
* Match `re` and return captures.
|
|
46919
|
+
*
|
|
46920
|
+
* @param {RegExp} re
|
|
46921
|
+
* @return {undefined|Array}
|
|
46922
|
+
*/
|
|
46923
|
+
function match(re) {
|
|
46924
|
+
var m = re.exec(style);
|
|
46925
|
+
if (!m) return;
|
|
46926
|
+
var str = m[0];
|
|
46927
|
+
updatePosition(str);
|
|
46928
|
+
style = style.slice(str.length);
|
|
46929
|
+
return m;
|
|
46930
|
+
}
|
|
46931
|
+
|
|
46932
|
+
/**
|
|
46933
|
+
* Parse whitespace.
|
|
46934
|
+
*/
|
|
46935
|
+
function whitespace() {
|
|
46936
|
+
match(WHITESPACE_REGEX);
|
|
46937
|
+
}
|
|
46938
|
+
|
|
46939
|
+
/**
|
|
46940
|
+
* Parse comments.
|
|
46941
|
+
*
|
|
46942
|
+
* @param {Object[]} rules
|
|
46943
|
+
* @return {Object[]}
|
|
46944
|
+
*/
|
|
46945
|
+
function comments(rules) {
|
|
46946
|
+
var c;
|
|
46947
|
+
while ((c = comment())) {
|
|
46948
|
+
rules.push(c);
|
|
46949
|
+
}
|
|
46950
|
+
return rules;
|
|
46951
|
+
}
|
|
46952
|
+
|
|
46953
|
+
/**
|
|
46954
|
+
* Parse comment.
|
|
46955
|
+
*
|
|
46956
|
+
* @return {Object}
|
|
46957
|
+
* @throws {Error}
|
|
46958
|
+
*/
|
|
46959
|
+
function comment() {
|
|
46960
|
+
var pos = position();
|
|
46961
|
+
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
|
|
46962
|
+
|
|
46963
|
+
var i = 2;
|
|
46964
|
+
while (
|
|
46965
|
+
EMPTY_STRING != style.charAt(i) &&
|
|
46966
|
+
(ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))
|
|
46967
|
+
) {
|
|
46968
|
+
++i;
|
|
46969
|
+
}
|
|
46970
|
+
i += 2;
|
|
46971
|
+
|
|
46972
|
+
if (EMPTY_STRING === style.charAt(i - 1)) {
|
|
46973
|
+
return error('End of comment missing');
|
|
46974
|
+
}
|
|
46975
|
+
|
|
46976
|
+
var str = style.slice(2, i - 2);
|
|
46977
|
+
column += 2;
|
|
46978
|
+
updatePosition(str);
|
|
46979
|
+
style = style.slice(i);
|
|
46980
|
+
column += 2;
|
|
46981
|
+
|
|
46982
|
+
return pos({
|
|
46983
|
+
type: TYPE_COMMENT,
|
|
46984
|
+
comment: str
|
|
46985
|
+
});
|
|
46986
|
+
}
|
|
46987
|
+
|
|
46988
|
+
/**
|
|
46989
|
+
* Parse declaration.
|
|
46990
|
+
*
|
|
46991
|
+
* @return {Object}
|
|
46992
|
+
* @throws {Error}
|
|
46993
|
+
*/
|
|
46994
|
+
function declaration() {
|
|
46995
|
+
var pos = position();
|
|
46996
|
+
|
|
46997
|
+
// prop
|
|
46998
|
+
var prop = match(PROPERTY_REGEX);
|
|
46999
|
+
if (!prop) return;
|
|
47000
|
+
comment();
|
|
47001
|
+
|
|
47002
|
+
// :
|
|
47003
|
+
if (!match(COLON_REGEX)) return error("property missing ':'");
|
|
47004
|
+
|
|
47005
|
+
// val
|
|
47006
|
+
var val = match(VALUE_REGEX);
|
|
47007
|
+
|
|
47008
|
+
var ret = pos({
|
|
47009
|
+
type: TYPE_DECLARATION,
|
|
47010
|
+
property: prop[0].replace(COMMENT_REGEX, EMPTY_STRING).trim(),
|
|
47011
|
+
value: val
|
|
47012
|
+
? val[0].replace(COMMENT_REGEX, EMPTY_STRING).trim()
|
|
47013
|
+
: EMPTY_STRING
|
|
47014
|
+
});
|
|
47015
|
+
|
|
47016
|
+
// ;
|
|
47017
|
+
match(SEMICOLON_REGEX);
|
|
47018
|
+
|
|
47019
|
+
return ret;
|
|
47020
|
+
}
|
|
47021
|
+
|
|
47022
|
+
/**
|
|
47023
|
+
* Parse declarations.
|
|
47024
|
+
*
|
|
47025
|
+
* @return {Object[]}
|
|
47026
|
+
*/
|
|
47027
|
+
function declarations() {
|
|
47028
|
+
var decls = [];
|
|
47029
|
+
|
|
47030
|
+
comments(decls);
|
|
47031
|
+
|
|
47032
|
+
// declarations
|
|
47033
|
+
var decl;
|
|
47034
|
+
while ((decl = declaration())) {
|
|
47035
|
+
decls.push(decl);
|
|
47036
|
+
comments(decls);
|
|
47037
|
+
}
|
|
47038
|
+
|
|
47039
|
+
return decls;
|
|
47040
|
+
}
|
|
47041
|
+
|
|
47042
|
+
whitespace();
|
|
47043
|
+
return declarations();
|
|
47044
|
+
}
|
|
47045
|
+
|
|
47046
|
+
|
|
47047
|
+
//# sourceMappingURL=index.mjs.map
|
|
47048
|
+
|
|
47049
|
+
;// ../node_modules/style-to-object/esm/index.mjs
|
|
47050
|
+
|
|
47051
|
+
//#region src/index.ts
|
|
47052
|
+
/**
|
|
47053
|
+
* Parses inline style to object.
|
|
47054
|
+
*
|
|
47055
|
+
* @param style - Inline style.
|
|
47056
|
+
* @param iterator - Iterator.
|
|
47057
|
+
* @returns - Style object or null.
|
|
47058
|
+
*
|
|
47059
|
+
* @example Parsing inline style to object:
|
|
47060
|
+
*
|
|
47061
|
+
* ```js
|
|
47062
|
+
* import parse from 'style-to-object';
|
|
47063
|
+
* parse('line-height: 42;'); // { 'line-height': '42' }
|
|
47064
|
+
* ```
|
|
47065
|
+
*/
|
|
47066
|
+
function StyleToObject(style, iterator) {
|
|
47067
|
+
let styleObject = null;
|
|
47068
|
+
if (!style || typeof style !== "string") return styleObject;
|
|
47069
|
+
const declarations = index(style);
|
|
47070
|
+
const hasIterator = typeof iterator === "function";
|
|
47071
|
+
declarations.forEach((declaration) => {
|
|
47072
|
+
if (declaration.type !== "declaration") return;
|
|
47073
|
+
const { property, value } = declaration;
|
|
47074
|
+
if (hasIterator) iterator(property, value, declaration);
|
|
47075
|
+
else if (value) {
|
|
47076
|
+
styleObject = styleObject ?? {};
|
|
47077
|
+
styleObject[property] = value;
|
|
47078
|
+
}
|
|
47079
|
+
});
|
|
47080
|
+
return styleObject;
|
|
47081
|
+
}
|
|
47082
|
+
//#endregion
|
|
47083
|
+
|
|
47196
47084
|
|
|
47085
|
+
//# sourceMappingURL=index.mjs.map
|
|
47197
47086
|
;// ../node_modules/vfile-message/node_modules/unist-util-stringify-position/lib/index.js
|
|
47198
47087
|
/**
|
|
47199
47088
|
* @typedef {import('unist').Node} Node
|
|
@@ -47625,6 +47514,7 @@ const hast_util_to_jsx_runtime_lib_own = {}.hasOwnProperty
|
|
|
47625
47514
|
const emptyMap = new Map()
|
|
47626
47515
|
|
|
47627
47516
|
const lib_cap = /[A-Z]/g
|
|
47517
|
+
const dashLetter = /-([a-z])/g
|
|
47628
47518
|
|
|
47629
47519
|
// `react-dom` triggers a warning for *any* white space in tables.
|
|
47630
47520
|
// To follow GFM, `mdast-util-to-hast` injects line endings between elements.
|
|
@@ -47961,6 +47851,8 @@ function addChildren(props, children) {
|
|
|
47961
47851
|
}
|
|
47962
47852
|
|
|
47963
47853
|
/**
|
|
47854
|
+
* Create a production `create` function.
|
|
47855
|
+
*
|
|
47964
47856
|
* @param {string | undefined} _
|
|
47965
47857
|
* Path to file.
|
|
47966
47858
|
* @param {Jsx} jsx
|
|
@@ -47972,7 +47864,12 @@ function addChildren(props, children) {
|
|
|
47972
47864
|
*/
|
|
47973
47865
|
function productionCreate(_, jsx, jsxs) {
|
|
47974
47866
|
return create
|
|
47975
|
-
|
|
47867
|
+
|
|
47868
|
+
/**
|
|
47869
|
+
* Create a production element.
|
|
47870
|
+
*
|
|
47871
|
+
* @type {Create}
|
|
47872
|
+
*/
|
|
47976
47873
|
function create(_, type, props, key) {
|
|
47977
47874
|
// Only an array when there are 2 or more children.
|
|
47978
47875
|
const isStaticChildren = Array.isArray(props.children)
|
|
@@ -47982,6 +47879,8 @@ function productionCreate(_, jsx, jsxs) {
|
|
|
47982
47879
|
}
|
|
47983
47880
|
|
|
47984
47881
|
/**
|
|
47882
|
+
* Create a development `create` function.
|
|
47883
|
+
*
|
|
47985
47884
|
* @param {string | undefined} filePath
|
|
47986
47885
|
* Path to file.
|
|
47987
47886
|
* @param {JsxDev} jsxDEV
|
|
@@ -47991,7 +47890,12 @@ function productionCreate(_, jsx, jsxs) {
|
|
|
47991
47890
|
*/
|
|
47992
47891
|
function developmentCreate(filePath, jsxDEV) {
|
|
47993
47892
|
return create
|
|
47994
|
-
|
|
47893
|
+
|
|
47894
|
+
/**
|
|
47895
|
+
* Create a development element.
|
|
47896
|
+
*
|
|
47897
|
+
* @type {Create}
|
|
47898
|
+
*/
|
|
47995
47899
|
function create(node, type, props, key) {
|
|
47996
47900
|
// Only an array when there are 2 or more children.
|
|
47997
47901
|
const isStaticChildren = Array.isArray(props.children)
|
|
@@ -48094,7 +47998,7 @@ function createJsxElementProps(state, node) {
|
|
|
48094
47998
|
}
|
|
48095
47999
|
} else {
|
|
48096
48000
|
// For JSX, the author is responsible of passing in the correct values.
|
|
48097
|
-
const name = attribute
|
|
48001
|
+
const {name} = attribute
|
|
48098
48002
|
/** @type {unknown} */
|
|
48099
48003
|
let value
|
|
48100
48004
|
|
|
@@ -48183,8 +48087,6 @@ function createChildren(state, node) {
|
|
|
48183
48087
|
* Field for runtime, optional.
|
|
48184
48088
|
*/
|
|
48185
48089
|
function lib_createProperty(state, prop, value) {
|
|
48186
|
-
const info = find(state.schema, prop)
|
|
48187
|
-
|
|
48188
48090
|
// Ignore nullish and `NaN` values.
|
|
48189
48091
|
if (
|
|
48190
48092
|
value === null ||
|
|
@@ -48194,6 +48096,8 @@ function lib_createProperty(state, prop, value) {
|
|
|
48194
48096
|
return
|
|
48195
48097
|
}
|
|
48196
48098
|
|
|
48099
|
+
const info = find(state.schema, prop)
|
|
48100
|
+
|
|
48197
48101
|
if (Array.isArray(value)) {
|
|
48198
48102
|
// Accept `array`.
|
|
48199
48103
|
// Most props are space-separated.
|
|
@@ -48202,12 +48106,12 @@ function lib_createProperty(state, prop, value) {
|
|
|
48202
48106
|
|
|
48203
48107
|
// React only accepts `style` as object.
|
|
48204
48108
|
if (info.property === 'style') {
|
|
48205
|
-
|
|
48206
|
-
typeof value === 'object'
|
|
48207
|
-
|
|
48208
|
-
|
|
48209
|
-
|
|
48210
|
-
|
|
48109
|
+
const styleObject =
|
|
48110
|
+
typeof value === 'object'
|
|
48111
|
+
? state.stylePropertyNameCase === 'dom'
|
|
48112
|
+
? value
|
|
48113
|
+
: transformStylesToCssCasing(value)
|
|
48114
|
+
: parseStyle(state, String(value))
|
|
48211
48115
|
|
|
48212
48116
|
return ['style', styleObject]
|
|
48213
48117
|
}
|
|
@@ -48229,12 +48133,32 @@ function lib_createProperty(state, prop, value) {
|
|
|
48229
48133
|
* CSS declarations.
|
|
48230
48134
|
* @returns {Style}
|
|
48231
48135
|
* Properties.
|
|
48232
|
-
* @throws
|
|
48233
|
-
*
|
|
48136
|
+
* @throws {VFileMessage}
|
|
48137
|
+
* When CSS cannot be parsed.
|
|
48234
48138
|
*/
|
|
48235
48139
|
function parseStyle(state, value) {
|
|
48140
|
+
/** @type {Style} */
|
|
48141
|
+
const result = {}
|
|
48142
|
+
|
|
48236
48143
|
try {
|
|
48237
|
-
|
|
48144
|
+
StyleToObject(value, function (property, value) {
|
|
48145
|
+
if (property && value) {
|
|
48146
|
+
let name = property
|
|
48147
|
+
|
|
48148
|
+
// Custom properties are case-sensitive, other properties are not.
|
|
48149
|
+
if (name.slice(0, 2) !== '--') {
|
|
48150
|
+
name = name.toLowerCase()
|
|
48151
|
+
|
|
48152
|
+
if (state.stylePropertyNameCase === 'dom') {
|
|
48153
|
+
// Handle `-ms-xxx` -> `msXxx`.
|
|
48154
|
+
if (name.slice(0, 4) === '-ms-') name = name.slice(1)
|
|
48155
|
+
name = name.replace(dashLetter, toCamel)
|
|
48156
|
+
}
|
|
48157
|
+
}
|
|
48158
|
+
|
|
48159
|
+
result[name] = value
|
|
48160
|
+
}
|
|
48161
|
+
})
|
|
48238
48162
|
} catch (error) {
|
|
48239
48163
|
if (state.ignoreInvalidStyle) {
|
|
48240
48164
|
return {}
|
|
@@ -48252,6 +48176,8 @@ function parseStyle(state, value) {
|
|
|
48252
48176
|
|
|
48253
48177
|
throw message
|
|
48254
48178
|
}
|
|
48179
|
+
|
|
48180
|
+
return result
|
|
48255
48181
|
}
|
|
48256
48182
|
|
|
48257
48183
|
/**
|
|
@@ -48319,9 +48245,14 @@ function findComponentFromName(state, name, allowExpression) {
|
|
|
48319
48245
|
}
|
|
48320
48246
|
|
|
48321
48247
|
/**
|
|
48248
|
+
* Crash because MDX estrees cannot be handled without `createEvaluater`.
|
|
48249
|
+
*
|
|
48322
48250
|
* @param {State} state
|
|
48251
|
+
* Info passed around.
|
|
48323
48252
|
* @param {Position | undefined} [place]
|
|
48253
|
+
* Place of the node that cannot be handled (optional).
|
|
48324
48254
|
* @returns {never}
|
|
48255
|
+
* Nothing (always throws).
|
|
48325
48256
|
*/
|
|
48326
48257
|
function crashEstree(state, place) {
|
|
48327
48258
|
const message = new VFileMessage(
|
|
@@ -48343,7 +48274,9 @@ function crashEstree(state, place) {
|
|
|
48343
48274
|
* Transform a DOM casing style object to a CSS casing style object.
|
|
48344
48275
|
*
|
|
48345
48276
|
* @param {Style} domCasing
|
|
48277
|
+
* DOM casing style object.
|
|
48346
48278
|
* @returns {Style}
|
|
48279
|
+
* CSS casing style object.
|
|
48347
48280
|
*/
|
|
48348
48281
|
function transformStylesToCssCasing(domCasing) {
|
|
48349
48282
|
/** @type {Style} */
|
|
@@ -48364,9 +48297,12 @@ function transformStylesToCssCasing(domCasing) {
|
|
|
48364
48297
|
* Transform a DOM casing style field to a CSS casing style field.
|
|
48365
48298
|
*
|
|
48366
48299
|
* @param {string} from
|
|
48300
|
+
* DOM casing style field.
|
|
48367
48301
|
* @returns {string}
|
|
48302
|
+
* CSS casing style field.
|
|
48368
48303
|
*/
|
|
48369
48304
|
function transformStyleToCssCasing(from) {
|
|
48305
|
+
if (from.slice(0, 2) === '--') return from
|
|
48370
48306
|
let to = from.replace(lib_cap, toDash)
|
|
48371
48307
|
// Handle `ms-xxx` -> `-ms-xxx`.
|
|
48372
48308
|
if (to.slice(0, 3) === 'ms-') to = '-' + to
|
|
@@ -48385,6 +48321,20 @@ function toDash($0) {
|
|
|
48385
48321
|
return '-' + $0.toLowerCase()
|
|
48386
48322
|
}
|
|
48387
48323
|
|
|
48324
|
+
/**
|
|
48325
|
+
* Make `$1` camel cased.
|
|
48326
|
+
*
|
|
48327
|
+
* @param {string} _
|
|
48328
|
+
* Dash and lower letter.
|
|
48329
|
+
* @param {string} $1
|
|
48330
|
+
* Lower letter.
|
|
48331
|
+
* @returns {string}
|
|
48332
|
+
* Capitalized letter.
|
|
48333
|
+
*/
|
|
48334
|
+
function toCamel(_, $1) {
|
|
48335
|
+
return $1.toUpperCase()
|
|
48336
|
+
}
|
|
48337
|
+
|
|
48388
48338
|
;// ../node_modules/html-url-attributes/lib/index.js
|
|
48389
48339
|
/**
|
|
48390
48340
|
* HTML URL properties.
|
|
@@ -50600,7 +50550,7 @@ function initializeFlow(effects) {
|
|
|
50600
50550
|
const resolver = {
|
|
50601
50551
|
resolveAll: createResolver()
|
|
50602
50552
|
};
|
|
50603
|
-
const
|
|
50553
|
+
const string = initializeFactory('string');
|
|
50604
50554
|
const text_text = initializeFactory('text');
|
|
50605
50555
|
|
|
50606
50556
|
/**
|
|
@@ -57277,7 +57227,7 @@ function lib_parse_parse(options) {
|
|
|
57277
57227
|
document: create(document_document),
|
|
57278
57228
|
flow: create(initialize_flow_flow),
|
|
57279
57229
|
lazy: {},
|
|
57280
|
-
string: create(
|
|
57230
|
+
string: create(string),
|
|
57281
57231
|
text: create(text_text)
|
|
57282
57232
|
};
|
|
57283
57233
|
return parser;
|
|
@@ -66728,460 +66678,1342 @@ function checkEmphasis(state) {
|
|
|
66728
66678
|
return marker
|
|
66729
66679
|
}
|
|
66730
66680
|
|
|
66731
|
-
;// ../node_modules/mdast-util-to-markdown/
|
|
66681
|
+
;// ../node_modules/mdast-util-to-markdown/node_modules/micromark-util-character/index.js
|
|
66732
66682
|
/**
|
|
66733
|
-
* @import {
|
|
66734
|
-
* @import {Emphasis, Parents} from 'mdast'
|
|
66683
|
+
* @import {Code} from 'micromark-util-types'
|
|
66735
66684
|
*/
|
|
66736
66685
|
|
|
66737
|
-
|
|
66738
|
-
|
|
66739
|
-
emphasis_emphasis.attention = emphasis_attention
|
|
66740
|
-
emphasis_emphasis.peek = peek
|
|
66741
|
-
|
|
66742
66686
|
/**
|
|
66743
|
-
*
|
|
66687
|
+
* Check whether the character code represents an ASCII alpha (`a` through `z`,
|
|
66688
|
+
* case insensitive).
|
|
66744
66689
|
*
|
|
66745
|
-
*
|
|
66690
|
+
* An **ASCII alpha** is an ASCII upper alpha or ASCII lower alpha.
|
|
66746
66691
|
*
|
|
66747
|
-
*
|
|
66748
|
-
*
|
|
66749
|
-
*
|
|
66750
|
-
*
|
|
66751
|
-
*
|
|
66752
|
-
*
|
|
66753
|
-
* @param
|
|
66754
|
-
*
|
|
66755
|
-
* @returns {
|
|
66756
|
-
*
|
|
66692
|
+
* An **ASCII upper alpha** is a character in the inclusive range U+0041 (`A`)
|
|
66693
|
+
* to U+005A (`Z`).
|
|
66694
|
+
*
|
|
66695
|
+
* An **ASCII lower alpha** is a character in the inclusive range U+0061 (`a`)
|
|
66696
|
+
* to U+007A (`z`).
|
|
66697
|
+
*
|
|
66698
|
+
* @param code
|
|
66699
|
+
* Code.
|
|
66700
|
+
* @returns {boolean}
|
|
66701
|
+
* Whether it matches.
|
|
66757
66702
|
*/
|
|
66758
|
-
|
|
66759
|
-
const exit = state.enter('phrasing')
|
|
66760
|
-
const value = state.containerPhrasing({type: 'root', children: [node]}, info)
|
|
66761
|
-
exit()
|
|
66762
|
-
return value
|
|
66763
|
-
}
|
|
66703
|
+
const mdast_util_to_markdown_node_modules_micromark_util_character_asciiAlpha = mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(/[A-Za-z]/);
|
|
66764
66704
|
|
|
66765
66705
|
/**
|
|
66766
|
-
*
|
|
66706
|
+
* Check whether the character code represents an ASCII alphanumeric (`a`
|
|
66707
|
+
* through `z`, case insensitive, or `0` through `9`).
|
|
66767
66708
|
*
|
|
66768
|
-
*
|
|
66769
|
-
*
|
|
66770
|
-
*
|
|
66771
|
-
*
|
|
66772
|
-
*
|
|
66773
|
-
*
|
|
66709
|
+
* An **ASCII alphanumeric** is an ASCII digit (see `asciiDigit`) or ASCII alpha
|
|
66710
|
+
* (see `asciiAlpha`).
|
|
66711
|
+
*
|
|
66712
|
+
* @param code
|
|
66713
|
+
* Code.
|
|
66714
|
+
* @returns {boolean}
|
|
66715
|
+
* Whether it matches.
|
|
66774
66716
|
*/
|
|
66775
|
-
|
|
66776
|
-
const marker = checkEmphasis(state)
|
|
66777
|
-
return {
|
|
66778
|
-
construct: 'emphasis',
|
|
66779
|
-
markers: marker === '*' ? ['*', '_'] : ['_', '*'],
|
|
66780
|
-
sizes: [1]
|
|
66781
|
-
}
|
|
66782
|
-
}
|
|
66717
|
+
const mdast_util_to_markdown_node_modules_micromark_util_character_asciiAlphanumeric = mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(/[\dA-Za-z]/);
|
|
66783
66718
|
|
|
66784
66719
|
/**
|
|
66785
|
-
*
|
|
66720
|
+
* Check whether the character code represents an ASCII atext.
|
|
66786
66721
|
*
|
|
66787
|
-
*
|
|
66788
|
-
*
|
|
66789
|
-
*
|
|
66790
|
-
*
|
|
66791
|
-
*
|
|
66792
|
-
*
|
|
66793
|
-
*
|
|
66794
|
-
*
|
|
66722
|
+
* atext is an ASCII alphanumeric (see `asciiAlphanumeric`), or a character in
|
|
66723
|
+
* the inclusive ranges U+0023 NUMBER SIGN (`#`) to U+0027 APOSTROPHE (`'`),
|
|
66724
|
+
* U+002A ASTERISK (`*`), U+002B PLUS SIGN (`+`), U+002D DASH (`-`), U+002F
|
|
66725
|
+
* SLASH (`/`), U+003D EQUALS TO (`=`), U+003F QUESTION MARK (`?`), U+005E
|
|
66726
|
+
* CARET (`^`) to U+0060 GRAVE ACCENT (`` ` ``), or U+007B LEFT CURLY BRACE
|
|
66727
|
+
* (`{`) to U+007E TILDE (`~`).
|
|
66728
|
+
*
|
|
66729
|
+
* See:
|
|
66730
|
+
* **\[RFC5322]**:
|
|
66731
|
+
* [Internet Message Format](https://tools.ietf.org/html/rfc5322).
|
|
66732
|
+
* P. Resnick.
|
|
66733
|
+
* IETF.
|
|
66734
|
+
*
|
|
66735
|
+
* @param code
|
|
66736
|
+
* Code.
|
|
66737
|
+
* @returns {boolean}
|
|
66738
|
+
* Whether it matches.
|
|
66795
66739
|
*/
|
|
66796
|
-
|
|
66797
|
-
return state.options.emphasis || '*'
|
|
66798
|
-
}
|
|
66740
|
+
const mdast_util_to_markdown_node_modules_micromark_util_character_asciiAtext = mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(/[#-'*+\--9=?A-Z^-~]/);
|
|
66799
66741
|
|
|
66800
|
-
;// ../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
|
|
66801
66742
|
/**
|
|
66802
|
-
*
|
|
66743
|
+
* Check whether a character code is an ASCII control character.
|
|
66803
66744
|
*
|
|
66804
|
-
*
|
|
66805
|
-
*
|
|
66806
|
-
*
|
|
66807
|
-
*
|
|
66745
|
+
* An **ASCII control** is a character in the inclusive range U+0000 NULL (NUL)
|
|
66746
|
+
* to U+001F (US), or U+007F (DEL).
|
|
66747
|
+
*
|
|
66748
|
+
* @param {Code} code
|
|
66749
|
+
* Code.
|
|
66750
|
+
* @returns {boolean}
|
|
66751
|
+
* Whether it matches.
|
|
66808
66752
|
*/
|
|
66809
|
-
function
|
|
66810
|
-
return
|
|
66753
|
+
function mdast_util_to_markdown_node_modules_micromark_util_character_asciiControl(code) {
|
|
66754
|
+
return (
|
|
66755
|
+
// Special whitespace codes (which have negative values), C0 and Control
|
|
66756
|
+
// character DEL
|
|
66757
|
+
code !== null && (code < 32 || code === 127)
|
|
66758
|
+
);
|
|
66811
66759
|
}
|
|
66812
66760
|
|
|
66813
|
-
;// ../node_modules/mdast-util-to-markdown/node_modules/mdast-util-to-string/lib/index.js
|
|
66814
66761
|
/**
|
|
66815
|
-
*
|
|
66762
|
+
* Check whether the character code represents an ASCII digit (`0` through `9`).
|
|
66816
66763
|
*
|
|
66817
|
-
*
|
|
66818
|
-
*
|
|
66819
|
-
*
|
|
66820
|
-
*
|
|
66821
|
-
*
|
|
66822
|
-
*
|
|
66764
|
+
* An **ASCII digit** is a character in the inclusive range U+0030 (`0`) to
|
|
66765
|
+
* U+0039 (`9`).
|
|
66766
|
+
*
|
|
66767
|
+
* @param code
|
|
66768
|
+
* Code.
|
|
66769
|
+
* @returns {boolean}
|
|
66770
|
+
* Whether it matches.
|
|
66823
66771
|
*/
|
|
66824
|
-
|
|
66825
|
-
/** @type {Options} */
|
|
66826
|
-
const node_modules_mdast_util_to_string_lib_emptyOptions = {}
|
|
66772
|
+
const mdast_util_to_markdown_node_modules_micromark_util_character_asciiDigit = mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(/\d/);
|
|
66827
66773
|
|
|
66828
66774
|
/**
|
|
66829
|
-
*
|
|
66775
|
+
* Check whether the character code represents an ASCII hex digit (`a` through
|
|
66776
|
+
* `f`, case insensitive, or `0` through `9`).
|
|
66830
66777
|
*
|
|
66831
|
-
*
|
|
66832
|
-
*
|
|
66778
|
+
* An **ASCII hex digit** is an ASCII digit (see `asciiDigit`), ASCII upper hex
|
|
66779
|
+
* digit, or an ASCII lower hex digit.
|
|
66833
66780
|
*
|
|
66834
|
-
*
|
|
66835
|
-
*
|
|
66836
|
-
*
|
|
66837
|
-
*
|
|
66838
|
-
*
|
|
66839
|
-
*
|
|
66781
|
+
* An **ASCII upper hex digit** is a character in the inclusive range U+0041
|
|
66782
|
+
* (`A`) to U+0046 (`F`).
|
|
66783
|
+
*
|
|
66784
|
+
* An **ASCII lower hex digit** is a character in the inclusive range U+0061
|
|
66785
|
+
* (`a`) to U+0066 (`f`).
|
|
66786
|
+
*
|
|
66787
|
+
* @param code
|
|
66788
|
+
* Code.
|
|
66789
|
+
* @returns {boolean}
|
|
66790
|
+
* Whether it matches.
|
|
66840
66791
|
*/
|
|
66841
|
-
|
|
66842
|
-
const settings = options || node_modules_mdast_util_to_string_lib_emptyOptions
|
|
66843
|
-
const includeImageAlt =
|
|
66844
|
-
typeof settings.includeImageAlt === 'boolean'
|
|
66845
|
-
? settings.includeImageAlt
|
|
66846
|
-
: true
|
|
66847
|
-
const includeHtml =
|
|
66848
|
-
typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true
|
|
66849
|
-
|
|
66850
|
-
return node_modules_mdast_util_to_string_lib_one(value, includeImageAlt, includeHtml)
|
|
66851
|
-
}
|
|
66792
|
+
const mdast_util_to_markdown_node_modules_micromark_util_character_asciiHexDigit = mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(/[\dA-Fa-f]/);
|
|
66852
66793
|
|
|
66853
66794
|
/**
|
|
66854
|
-
*
|
|
66795
|
+
* Check whether the character code represents ASCII punctuation.
|
|
66855
66796
|
*
|
|
66856
|
-
*
|
|
66857
|
-
*
|
|
66858
|
-
*
|
|
66859
|
-
*
|
|
66860
|
-
*
|
|
66861
|
-
*
|
|
66862
|
-
*
|
|
66863
|
-
*
|
|
66797
|
+
* An **ASCII punctuation** is a character in the inclusive ranges U+0021
|
|
66798
|
+
* EXCLAMATION MARK (`!`) to U+002F SLASH (`/`), U+003A COLON (`:`) to U+0040 AT
|
|
66799
|
+
* SIGN (`@`), U+005B LEFT SQUARE BRACKET (`[`) to U+0060 GRAVE ACCENT
|
|
66800
|
+
* (`` ` ``), or U+007B LEFT CURLY BRACE (`{`) to U+007E TILDE (`~`).
|
|
66801
|
+
*
|
|
66802
|
+
* @param code
|
|
66803
|
+
* Code.
|
|
66804
|
+
* @returns {boolean}
|
|
66805
|
+
* Whether it matches.
|
|
66864
66806
|
*/
|
|
66865
|
-
|
|
66866
|
-
if (mdast_util_to_string_lib_node(value)) {
|
|
66867
|
-
if ('value' in value) {
|
|
66868
|
-
return value.type === 'html' && !includeHtml ? '' : value.value
|
|
66869
|
-
}
|
|
66870
|
-
|
|
66871
|
-
if (includeImageAlt && 'alt' in value && value.alt) {
|
|
66872
|
-
return value.alt
|
|
66873
|
-
}
|
|
66874
|
-
|
|
66875
|
-
if ('children' in value) {
|
|
66876
|
-
return node_modules_mdast_util_to_string_lib_all(value.children, includeImageAlt, includeHtml)
|
|
66877
|
-
}
|
|
66878
|
-
}
|
|
66879
|
-
|
|
66880
|
-
if (Array.isArray(value)) {
|
|
66881
|
-
return node_modules_mdast_util_to_string_lib_all(value, includeImageAlt, includeHtml)
|
|
66882
|
-
}
|
|
66807
|
+
const mdast_util_to_markdown_node_modules_micromark_util_character_asciiPunctuation = mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(/[!-/:-@[-`{-~]/);
|
|
66883
66808
|
|
|
66884
|
-
|
|
66809
|
+
/**
|
|
66810
|
+
* Check whether a character code is a markdown line ending.
|
|
66811
|
+
*
|
|
66812
|
+
* A **markdown line ending** is the virtual characters M-0003 CARRIAGE RETURN
|
|
66813
|
+
* LINE FEED (CRLF), M-0004 LINE FEED (LF) and M-0005 CARRIAGE RETURN (CR).
|
|
66814
|
+
*
|
|
66815
|
+
* In micromark, the actual character U+000A LINE FEED (LF) and U+000D CARRIAGE
|
|
66816
|
+
* RETURN (CR) are replaced by these virtual characters depending on whether
|
|
66817
|
+
* they occurred together.
|
|
66818
|
+
*
|
|
66819
|
+
* @param {Code} code
|
|
66820
|
+
* Code.
|
|
66821
|
+
* @returns {boolean}
|
|
66822
|
+
* Whether it matches.
|
|
66823
|
+
*/
|
|
66824
|
+
function mdast_util_to_markdown_node_modules_micromark_util_character_markdownLineEnding(code) {
|
|
66825
|
+
return code !== null && code < -2;
|
|
66885
66826
|
}
|
|
66886
66827
|
|
|
66887
66828
|
/**
|
|
66888
|
-
*
|
|
66829
|
+
* Check whether a character code is a markdown line ending (see
|
|
66830
|
+
* `markdownLineEnding`) or markdown space (see `markdownSpace`).
|
|
66889
66831
|
*
|
|
66890
|
-
* @param {
|
|
66891
|
-
*
|
|
66892
|
-
* @
|
|
66893
|
-
*
|
|
66894
|
-
* @param {boolean} includeHtml
|
|
66895
|
-
* Include HTML.
|
|
66896
|
-
* @returns {string}
|
|
66897
|
-
* Serialized nodes.
|
|
66832
|
+
* @param {Code} code
|
|
66833
|
+
* Code.
|
|
66834
|
+
* @returns {boolean}
|
|
66835
|
+
* Whether it matches.
|
|
66898
66836
|
*/
|
|
66899
|
-
function
|
|
66900
|
-
|
|
66901
|
-
const result = []
|
|
66902
|
-
let index = -1
|
|
66903
|
-
|
|
66904
|
-
while (++index < values.length) {
|
|
66905
|
-
result[index] = node_modules_mdast_util_to_string_lib_one(values[index], includeImageAlt, includeHtml)
|
|
66906
|
-
}
|
|
66907
|
-
|
|
66908
|
-
return result.join('')
|
|
66837
|
+
function mdast_util_to_markdown_node_modules_micromark_util_character_markdownLineEndingOrSpace(code) {
|
|
66838
|
+
return code !== null && (code < 0 || code === 32);
|
|
66909
66839
|
}
|
|
66910
66840
|
|
|
66911
66841
|
/**
|
|
66912
|
-
* Check
|
|
66842
|
+
* Check whether a character code is a markdown space.
|
|
66913
66843
|
*
|
|
66914
|
-
*
|
|
66915
|
-
*
|
|
66916
|
-
*
|
|
66917
|
-
*
|
|
66844
|
+
* A **markdown space** is the concrete character U+0020 SPACE (SP) and the
|
|
66845
|
+
* virtual characters M-0001 VIRTUAL SPACE (VS) and M-0002 HORIZONTAL TAB (HT).
|
|
66846
|
+
*
|
|
66847
|
+
* In micromark, the actual character U+0009 CHARACTER TABULATION (HT) is
|
|
66848
|
+
* replaced by one M-0002 HORIZONTAL TAB (HT) and between 0 and 3 M-0001 VIRTUAL
|
|
66849
|
+
* SPACE (VS) characters, depending on the column at which the tab occurred.
|
|
66850
|
+
*
|
|
66851
|
+
* @param {Code} code
|
|
66852
|
+
* Code.
|
|
66853
|
+
* @returns {boolean}
|
|
66854
|
+
* Whether it matches.
|
|
66918
66855
|
*/
|
|
66919
|
-
function
|
|
66920
|
-
return
|
|
66856
|
+
function mdast_util_to_markdown_node_modules_micromark_util_character_markdownSpace(code) {
|
|
66857
|
+
return code === -2 || code === -1 || code === 32;
|
|
66921
66858
|
}
|
|
66922
66859
|
|
|
66923
|
-
|
|
66860
|
+
// Size note: removing ASCII from the regex and using `asciiPunctuation` here
|
|
66861
|
+
// In fact adds to the bundle size.
|
|
66924
66862
|
/**
|
|
66925
|
-
*
|
|
66926
|
-
*
|
|
66863
|
+
* Check whether the character code represents Unicode punctuation.
|
|
66864
|
+
*
|
|
66865
|
+
* A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation,
|
|
66866
|
+
* Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf`
|
|
66867
|
+
* (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po`
|
|
66868
|
+
* (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII
|
|
66869
|
+
* punctuation (see `asciiPunctuation`).
|
|
66870
|
+
*
|
|
66871
|
+
* See:
|
|
66872
|
+
* **\[UNICODE]**:
|
|
66873
|
+
* [The Unicode Standard](https://www.unicode.org/versions/).
|
|
66874
|
+
* Unicode Consortium.
|
|
66875
|
+
*
|
|
66876
|
+
* @param code
|
|
66877
|
+
* Code.
|
|
66878
|
+
* @returns
|
|
66879
|
+
* Whether it matches.
|
|
66927
66880
|
*/
|
|
66928
|
-
|
|
66929
|
-
|
|
66930
|
-
|
|
66881
|
+
const mdast_util_to_markdown_node_modules_micromark_util_character_unicodePunctuation = mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(/\p{P}|\p{S}/u);
|
|
66931
66882
|
|
|
66932
66883
|
/**
|
|
66933
|
-
*
|
|
66884
|
+
* Check whether the character code represents Unicode whitespace.
|
|
66934
66885
|
*
|
|
66935
|
-
*
|
|
66936
|
-
*
|
|
66937
|
-
*
|
|
66938
|
-
*
|
|
66939
|
-
*
|
|
66940
|
-
*
|
|
66886
|
+
* Note that this does handle micromark specific markdown whitespace characters.
|
|
66887
|
+
* See `markdownLineEndingOrSpace` to check that.
|
|
66888
|
+
*
|
|
66889
|
+
* A **Unicode whitespace** is a character in the Unicode `Zs` (Separator,
|
|
66890
|
+
* Space) category, or U+0009 CHARACTER TABULATION (HT), U+000A LINE FEED (LF),
|
|
66891
|
+
* U+000C (FF), or U+000D CARRIAGE RETURN (CR) (**\[UNICODE]**).
|
|
66892
|
+
*
|
|
66893
|
+
* See:
|
|
66894
|
+
* **\[UNICODE]**:
|
|
66895
|
+
* [The Unicode Standard](https://www.unicode.org/versions/).
|
|
66896
|
+
* Unicode Consortium.
|
|
66897
|
+
*
|
|
66898
|
+
* @param code
|
|
66899
|
+
* Code.
|
|
66900
|
+
* @returns
|
|
66901
|
+
* Whether it matches.
|
|
66941
66902
|
*/
|
|
66942
|
-
|
|
66943
|
-
let literalWithBreak = false
|
|
66903
|
+
const mdast_util_to_markdown_node_modules_micromark_util_character_unicodeWhitespace = mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(/\s/);
|
|
66944
66904
|
|
|
66945
|
-
|
|
66946
|
-
|
|
66947
|
-
|
|
66948
|
-
|
|
66949
|
-
|
|
66950
|
-
|
|
66951
|
-
|
|
66952
|
-
|
|
66953
|
-
|
|
66954
|
-
|
|
66955
|
-
})
|
|
66905
|
+
/**
|
|
66906
|
+
* Create a code check from a regex.
|
|
66907
|
+
*
|
|
66908
|
+
* @param {RegExp} regex
|
|
66909
|
+
* Expression.
|
|
66910
|
+
* @returns {(code: Code) => boolean}
|
|
66911
|
+
* Check.
|
|
66912
|
+
*/
|
|
66913
|
+
function mdast_util_to_markdown_node_modules_micromark_util_character_regexCheck(regex) {
|
|
66914
|
+
return check;
|
|
66956
66915
|
|
|
66957
|
-
|
|
66958
|
-
|
|
66959
|
-
|
|
66960
|
-
|
|
66961
|
-
|
|
66916
|
+
/**
|
|
66917
|
+
* Check whether a code matches the bound regex.
|
|
66918
|
+
*
|
|
66919
|
+
* @param {Code} code
|
|
66920
|
+
* Character code.
|
|
66921
|
+
* @returns {boolean}
|
|
66922
|
+
* Whether the character code matches the bound regex.
|
|
66923
|
+
*/
|
|
66924
|
+
function check(code) {
|
|
66925
|
+
return code !== null && code > -1 && regex.test(String.fromCharCode(code));
|
|
66926
|
+
}
|
|
66962
66927
|
}
|
|
66963
|
-
|
|
66964
|
-
;// ../node_modules/mdast-util-to-markdown/lib/handle/heading.js
|
|
66928
|
+
;// ../node_modules/mdast-util-to-markdown/node_modules/micromark-util-classify-character/index.js
|
|
66965
66929
|
/**
|
|
66966
|
-
* @import {
|
|
66967
|
-
* @import {Heading, Parents} from 'mdast'
|
|
66930
|
+
* @import {Code} from 'micromark-util-types'
|
|
66968
66931
|
*/
|
|
66969
66932
|
|
|
66970
66933
|
|
|
66971
|
-
|
|
66972
|
-
|
|
66973
66934
|
/**
|
|
66974
|
-
*
|
|
66935
|
+
* Classify whether a code represents whitespace, punctuation, or something
|
|
66936
|
+
* else.
|
|
66975
66937
|
*
|
|
66976
|
-
*
|
|
66977
|
-
*
|
|
66978
|
-
*
|
|
66979
|
-
*
|
|
66980
|
-
*
|
|
66981
|
-
*
|
|
66982
|
-
*
|
|
66983
|
-
*
|
|
66984
|
-
*
|
|
66985
|
-
* Serialized markdown.
|
|
66938
|
+
* Used for attention (emphasis, strong), whose sequences can open or close
|
|
66939
|
+
* based on the class of surrounding characters.
|
|
66940
|
+
*
|
|
66941
|
+
* > 👉 **Note**: eof (`null`) is seen as whitespace.
|
|
66942
|
+
*
|
|
66943
|
+
* @param {Code} code
|
|
66944
|
+
* Code.
|
|
66945
|
+
* @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
|
|
66946
|
+
* Group.
|
|
66986
66947
|
*/
|
|
66987
|
-
function
|
|
66988
|
-
|
|
66989
|
-
|
|
66990
|
-
|
|
66991
|
-
if (formatHeadingAsSetext(node, state)) {
|
|
66992
|
-
const exit = state.enter('headingSetext')
|
|
66993
|
-
const subexit = state.enter('phrasing')
|
|
66994
|
-
const value = state.containerPhrasing(node, {
|
|
66995
|
-
...tracker.current(),
|
|
66996
|
-
before: '\n',
|
|
66997
|
-
after: '\n'
|
|
66998
|
-
})
|
|
66999
|
-
subexit()
|
|
67000
|
-
exit()
|
|
67001
|
-
|
|
67002
|
-
return (
|
|
67003
|
-
value +
|
|
67004
|
-
'\n' +
|
|
67005
|
-
(rank === 1 ? '=' : '-').repeat(
|
|
67006
|
-
// The whole size…
|
|
67007
|
-
value.length -
|
|
67008
|
-
// Minus the position of the character after the last EOL (or
|
|
67009
|
-
// 0 if there is none)…
|
|
67010
|
-
(Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1)
|
|
67011
|
-
)
|
|
67012
|
-
)
|
|
67013
|
-
}
|
|
67014
|
-
|
|
67015
|
-
const sequence = '#'.repeat(rank)
|
|
67016
|
-
const exit = state.enter('headingAtx')
|
|
67017
|
-
const subexit = state.enter('phrasing')
|
|
67018
|
-
|
|
67019
|
-
// Note: for proper tracking, we should reset the output positions when there
|
|
67020
|
-
// is no content returned, because then the space is not output.
|
|
67021
|
-
// Practically, in that case, there is no content, so it doesn’t matter that
|
|
67022
|
-
// we’ve tracked one too many characters.
|
|
67023
|
-
tracker.move(sequence + ' ')
|
|
67024
|
-
|
|
67025
|
-
let value = state.containerPhrasing(node, {
|
|
67026
|
-
before: '# ',
|
|
67027
|
-
after: '\n',
|
|
67028
|
-
...tracker.current()
|
|
67029
|
-
})
|
|
67030
|
-
|
|
67031
|
-
const head = value.charCodeAt(0)
|
|
67032
|
-
|
|
67033
|
-
if (head === 9 /* `\t` */ || head === 32 /* ` ` */) {
|
|
67034
|
-
// To do: what effect has the character reference on tracking?
|
|
67035
|
-
value = encodeCharacterReference(head) + value.slice(1)
|
|
66948
|
+
function micromark_util_classify_character_classifyCharacter(code) {
|
|
66949
|
+
if (code === null || mdast_util_to_markdown_node_modules_micromark_util_character_markdownLineEndingOrSpace(code) || mdast_util_to_markdown_node_modules_micromark_util_character_unicodeWhitespace(code)) {
|
|
66950
|
+
return 1;
|
|
67036
66951
|
}
|
|
67037
|
-
|
|
67038
|
-
|
|
67039
|
-
|
|
67040
|
-
if (state.options.closeAtx) {
|
|
67041
|
-
value += ' ' + sequence
|
|
66952
|
+
if (mdast_util_to_markdown_node_modules_micromark_util_character_unicodePunctuation(code)) {
|
|
66953
|
+
return 2;
|
|
67042
66954
|
}
|
|
67043
|
-
|
|
67044
|
-
subexit()
|
|
67045
|
-
exit()
|
|
67046
|
-
|
|
67047
|
-
return value
|
|
67048
66955
|
}
|
|
67049
|
-
|
|
67050
|
-
;// ../node_modules/mdast-util-to-markdown/lib/handle/html.js
|
|
67051
|
-
/**
|
|
67052
|
-
* @import {Html} from 'mdast'
|
|
67053
|
-
*/
|
|
67054
|
-
|
|
67055
|
-
handle_html_html.peek = htmlPeek
|
|
67056
|
-
|
|
66956
|
+
;// ../node_modules/mdast-util-to-markdown/lib/util/character.js
|
|
67057
66957
|
/**
|
|
67058
|
-
*
|
|
66958
|
+
* Get the first character of a value.
|
|
67059
66959
|
*
|
|
67060
|
-
*
|
|
67061
|
-
*
|
|
66960
|
+
* Is aware of astral characters (such as emoji).
|
|
66961
|
+
*
|
|
66962
|
+
* @param {string} value
|
|
66963
|
+
* Value.
|
|
67062
66964
|
* @returns {string}
|
|
67063
|
-
*
|
|
66965
|
+
* First character; empty if `value` is empty.
|
|
67064
66966
|
*/
|
|
67065
|
-
function
|
|
67066
|
-
|
|
66967
|
+
function firstCharacter(value) {
|
|
66968
|
+
const code = value.codePointAt(0)
|
|
66969
|
+
return code === undefined ? '' : String.fromCodePoint(code)
|
|
67067
66970
|
}
|
|
67068
66971
|
|
|
67069
66972
|
/**
|
|
67070
|
-
*
|
|
66973
|
+
* Get the last character of a value.
|
|
67071
66974
|
*
|
|
66975
|
+
* Is aware of astral characters (such as emoji).
|
|
66976
|
+
*
|
|
66977
|
+
* @param {string} value
|
|
66978
|
+
* Value.
|
|
67072
66979
|
* @returns {string}
|
|
67073
|
-
*
|
|
66980
|
+
* Last character; empty if `value` is empty.
|
|
67074
66981
|
*/
|
|
67075
|
-
function
|
|
67076
|
-
|
|
66982
|
+
function lastCharacter(value) {
|
|
66983
|
+
// Only a surrogate pair gives a code point above the BMP.
|
|
66984
|
+
const code = value.codePointAt(value.length - 2)
|
|
66985
|
+
return code !== undefined && code > 0xff_ff
|
|
66986
|
+
? value.slice(-2)
|
|
66987
|
+
: value.slice(-1)
|
|
67077
66988
|
}
|
|
67078
66989
|
|
|
67079
|
-
;// ../node_modules/mdast-util-to-markdown/lib/
|
|
66990
|
+
;// ../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
|
|
67080
66991
|
/**
|
|
67081
|
-
*
|
|
67082
|
-
*
|
|
66992
|
+
* Encode a code point as a character reference.
|
|
66993
|
+
*
|
|
66994
|
+
* @param {number} code
|
|
66995
|
+
* Code point to encode.
|
|
66996
|
+
* @returns {string}
|
|
66997
|
+
* Encoded character reference.
|
|
67083
66998
|
*/
|
|
66999
|
+
function encodeCharacterReference(code) {
|
|
67000
|
+
return '&#x' + code.toString(16).toUpperCase() + ';'
|
|
67001
|
+
}
|
|
67084
67002
|
|
|
67003
|
+
;// ../node_modules/mdast-util-to-markdown/lib/util/encode-info.js
|
|
67004
|
+
/**
|
|
67005
|
+
* @import {EncodeSides} from '../types.js'
|
|
67006
|
+
*/
|
|
67085
67007
|
|
|
67086
67008
|
|
|
67087
|
-
handle_image_image.peek = imagePeek
|
|
67088
67009
|
|
|
67089
67010
|
/**
|
|
67090
|
-
*
|
|
67011
|
+
* Check whether to encode (as a character reference) the characters
|
|
67012
|
+
* surrounding an attention run.
|
|
67091
67013
|
*
|
|
67092
|
-
*
|
|
67093
|
-
*
|
|
67094
|
-
*
|
|
67095
|
-
*
|
|
67014
|
+
* Which characters are around an attention run influence whether it works or
|
|
67015
|
+
* not.
|
|
67016
|
+
*
|
|
67017
|
+
* See <https://github.com/orgs/syntax-tree/discussions/60> for more info.
|
|
67018
|
+
* See this markdown in a particular renderer to see what works:
|
|
67019
|
+
*
|
|
67020
|
+
* ```markdown
|
|
67021
|
+
* | | A (letter inside) | B (punctuation inside) | C (whitespace inside) | D (nothing inside) |
|
|
67022
|
+
* | ----------------------- | ----------------- | ---------------------- | --------------------- | ------------------ |
|
|
67023
|
+
* | 1 (letter outside) | x*y*z | x*.*z | x* *z | x**z |
|
|
67024
|
+
* | 2 (punctuation outside) | .*y*. | .*.*. | .* *. | .**. |
|
|
67025
|
+
* | 3 (whitespace outside) | x *y* z | x *.* z | x * * z | x ** z |
|
|
67026
|
+
* | 4 (nothing outside) | *x* | *.* | * * | ** |
|
|
67027
|
+
* ```
|
|
67028
|
+
*
|
|
67029
|
+
* @param {number} outside
|
|
67030
|
+
* Code point on the outer side of the run.
|
|
67031
|
+
* @param {number} inside
|
|
67032
|
+
* Code point on the inner side of the run.
|
|
67033
|
+
* @param {string} marker
|
|
67034
|
+
* Marker of the run.
|
|
67035
|
+
* Underscores are handled more strictly (they form less often) than
|
|
67036
|
+
* asterisks.
|
|
67037
|
+
* @returns {EncodeSides}
|
|
67038
|
+
* Whether to encode characters.
|
|
67039
|
+
*/
|
|
67040
|
+
// Important: punctuation must never be encoded.
|
|
67041
|
+
// Punctuation is solely used by markdown constructs.
|
|
67042
|
+
// And by encoding itself.
|
|
67043
|
+
// Encoding them will break constructs or double encode things.
|
|
67044
|
+
function encodeInfo(outside, inside, marker) {
|
|
67045
|
+
const outsideKind = micromark_util_classify_character_classifyCharacter(outside)
|
|
67046
|
+
const insideKind = micromark_util_classify_character_classifyCharacter(inside)
|
|
67047
|
+
|
|
67048
|
+
// Letter outside:
|
|
67049
|
+
if (outsideKind === undefined) {
|
|
67050
|
+
return insideKind === undefined
|
|
67051
|
+
? // Letter inside:
|
|
67052
|
+
// we have to encode *both* letters for `_` as it is looser.
|
|
67053
|
+
// it already forms for `*` (and GFMs `~`).
|
|
67054
|
+
marker === '_'
|
|
67055
|
+
? {inside: true, outside: true}
|
|
67056
|
+
: {inside: false, outside: false}
|
|
67057
|
+
: insideKind === 1
|
|
67058
|
+
? // Whitespace inside: encode both (letter, whitespace).
|
|
67059
|
+
{inside: true, outside: true}
|
|
67060
|
+
: // Punctuation inside: encode outer (letter)
|
|
67061
|
+
{inside: false, outside: true}
|
|
67062
|
+
}
|
|
67063
|
+
|
|
67064
|
+
// Whitespace outside:
|
|
67065
|
+
if (outsideKind === 1) {
|
|
67066
|
+
return insideKind === undefined
|
|
67067
|
+
? // Letter inside: already forms.
|
|
67068
|
+
{inside: false, outside: false}
|
|
67069
|
+
: insideKind === 1
|
|
67070
|
+
? // Whitespace inside: encode both (whitespace).
|
|
67071
|
+
{inside: true, outside: true}
|
|
67072
|
+
: // Punctuation inside: already forms.
|
|
67073
|
+
{inside: false, outside: false}
|
|
67074
|
+
}
|
|
67075
|
+
|
|
67076
|
+
// Punctuation outside:
|
|
67077
|
+
return insideKind === undefined
|
|
67078
|
+
? // Letter inside: already forms.
|
|
67079
|
+
{inside: false, outside: false}
|
|
67080
|
+
: insideKind === 1
|
|
67081
|
+
? // Whitespace inside: encode inner (whitespace).
|
|
67082
|
+
{inside: true, outside: false}
|
|
67083
|
+
: // Punctuation inside: already forms.
|
|
67084
|
+
{inside: false, outside: false}
|
|
67085
|
+
}
|
|
67086
|
+
|
|
67087
|
+
;// ../node_modules/mdast-util-to-markdown/node_modules/micromark-util-html-tag-name/index.js
|
|
67088
|
+
/**
|
|
67089
|
+
* List of lowercase HTML “block” tag names.
|
|
67090
|
+
*
|
|
67091
|
+
* The list, when parsing HTML (flow), results in more relaxed rules (condition
|
|
67092
|
+
* 6).
|
|
67093
|
+
* Because they are known blocks, the HTML-like syntax doesn’t have to be
|
|
67094
|
+
* strictly parsed.
|
|
67095
|
+
* For tag names not in this list, a more strict algorithm (condition 7) is used
|
|
67096
|
+
* to detect whether the HTML-like syntax is seen as HTML (flow) or not.
|
|
67097
|
+
*
|
|
67098
|
+
* This is copied from:
|
|
67099
|
+
* <https://spec.commonmark.org/0.30/#html-blocks>.
|
|
67100
|
+
*
|
|
67101
|
+
* > 👉 **Note**: `search` was added in `CommonMark@0.31`.
|
|
67102
|
+
*/
|
|
67103
|
+
const micromark_util_html_tag_name_htmlBlockNames = [
|
|
67104
|
+
'address',
|
|
67105
|
+
'article',
|
|
67106
|
+
'aside',
|
|
67107
|
+
'base',
|
|
67108
|
+
'basefont',
|
|
67109
|
+
'blockquote',
|
|
67110
|
+
'body',
|
|
67111
|
+
'caption',
|
|
67112
|
+
'center',
|
|
67113
|
+
'col',
|
|
67114
|
+
'colgroup',
|
|
67115
|
+
'dd',
|
|
67116
|
+
'details',
|
|
67117
|
+
'dialog',
|
|
67118
|
+
'dir',
|
|
67119
|
+
'div',
|
|
67120
|
+
'dl',
|
|
67121
|
+
'dt',
|
|
67122
|
+
'fieldset',
|
|
67123
|
+
'figcaption',
|
|
67124
|
+
'figure',
|
|
67125
|
+
'footer',
|
|
67126
|
+
'form',
|
|
67127
|
+
'frame',
|
|
67128
|
+
'frameset',
|
|
67129
|
+
'h1',
|
|
67130
|
+
'h2',
|
|
67131
|
+
'h3',
|
|
67132
|
+
'h4',
|
|
67133
|
+
'h5',
|
|
67134
|
+
'h6',
|
|
67135
|
+
'head',
|
|
67136
|
+
'header',
|
|
67137
|
+
'hr',
|
|
67138
|
+
'html',
|
|
67139
|
+
'iframe',
|
|
67140
|
+
'legend',
|
|
67141
|
+
'li',
|
|
67142
|
+
'link',
|
|
67143
|
+
'main',
|
|
67144
|
+
'menu',
|
|
67145
|
+
'menuitem',
|
|
67146
|
+
'nav',
|
|
67147
|
+
'noframes',
|
|
67148
|
+
'ol',
|
|
67149
|
+
'optgroup',
|
|
67150
|
+
'option',
|
|
67151
|
+
'p',
|
|
67152
|
+
'param',
|
|
67153
|
+
'search',
|
|
67154
|
+
'section',
|
|
67155
|
+
'summary',
|
|
67156
|
+
'table',
|
|
67157
|
+
'tbody',
|
|
67158
|
+
'td',
|
|
67159
|
+
'tfoot',
|
|
67160
|
+
'th',
|
|
67161
|
+
'thead',
|
|
67162
|
+
'title',
|
|
67163
|
+
'tr',
|
|
67164
|
+
'track',
|
|
67165
|
+
'ul'
|
|
67166
|
+
]
|
|
67167
|
+
|
|
67168
|
+
/**
|
|
67169
|
+
* List of lowercase HTML “raw” tag names.
|
|
67170
|
+
*
|
|
67171
|
+
* The list, when parsing HTML (flow), results in HTML that can include lines
|
|
67172
|
+
* without exiting, until a closing tag also in this list is found (condition
|
|
67173
|
+
* 1).
|
|
67174
|
+
*
|
|
67175
|
+
* This module is copied from:
|
|
67176
|
+
* <https://spec.commonmark.org/0.30/#html-blocks>.
|
|
67177
|
+
*
|
|
67178
|
+
* > 👉 **Note**: `textarea` was added in `CommonMark@0.30`.
|
|
67179
|
+
*/
|
|
67180
|
+
const micromark_util_html_tag_name_htmlRawNames = ['pre', 'script', 'style', 'textarea']
|
|
67181
|
+
|
|
67182
|
+
;// ../node_modules/mdast-util-to-markdown/lib/util/html-kind.js
|
|
67183
|
+
|
|
67184
|
+
|
|
67185
|
+
|
|
67186
|
+
/**
|
|
67187
|
+
* @typedef {1 | 2 | 3 | 4 | 5 | 6 | 7} Kind
|
|
67188
|
+
* Kind of HTML (flow) element.
|
|
67189
|
+
*/
|
|
67190
|
+
|
|
67191
|
+
/**
|
|
67192
|
+
* Infer the kind of HTML that `value` is.
|
|
67193
|
+
*
|
|
67194
|
+
* This works on valid trees as produced by `micromark`.
|
|
67195
|
+
* Kinds:
|
|
67196
|
+
*
|
|
67197
|
+
* 1. raw
|
|
67198
|
+
* 2. comment
|
|
67199
|
+
* 3. instruction
|
|
67200
|
+
* 4. declaration
|
|
67201
|
+
* 5. cdata
|
|
67202
|
+
* 6. block
|
|
67203
|
+
* 7. other
|
|
67204
|
+
*
|
|
67205
|
+
* See: <https://spec.commonmark.org/0.31.2/#html-blocks>.
|
|
67206
|
+
*
|
|
67207
|
+
* @param {string} value
|
|
67208
|
+
* HTML.
|
|
67209
|
+
* @returns {Kind | undefined}
|
|
67210
|
+
* Kind; `undefined` if unknown.
|
|
67211
|
+
*/
|
|
67212
|
+
function htmlKind(value) {
|
|
67213
|
+
if (value.charCodeAt(0) !== 60 /* `<` */) return
|
|
67214
|
+
|
|
67215
|
+
const next = value.charCodeAt(1)
|
|
67216
|
+
|
|
67217
|
+
if (next === 33 /* `!` */) {
|
|
67218
|
+
const code = value.charCodeAt(2)
|
|
67219
|
+
if (code === 45 /* `-` */) return 2
|
|
67220
|
+
if (code === 91 /* `[` */) return 5
|
|
67221
|
+
if (mdast_util_to_markdown_node_modules_micromark_util_character_asciiAlpha(code)) return 4
|
|
67222
|
+
return
|
|
67223
|
+
}
|
|
67224
|
+
|
|
67225
|
+
if (next === 63 /* `?` */) return 3
|
|
67226
|
+
|
|
67227
|
+
const closing = next === 47 /* `/` */
|
|
67228
|
+
const start = closing ? 2 : 1
|
|
67229
|
+
let end = start
|
|
67230
|
+
let code = value.charCodeAt(end)
|
|
67231
|
+
|
|
67232
|
+
if (!mdast_util_to_markdown_node_modules_micromark_util_character_asciiAlpha(code)) return
|
|
67233
|
+
|
|
67234
|
+
while (code === 45 /* `-` */ || mdast_util_to_markdown_node_modules_micromark_util_character_asciiAlphanumeric(code)) {
|
|
67235
|
+
code = value.charCodeAt(++end)
|
|
67236
|
+
}
|
|
67237
|
+
|
|
67238
|
+
const name = value.slice(start, end).toLowerCase()
|
|
67239
|
+
|
|
67240
|
+
if (!closing && code !== 47 /* `/` */ && micromark_util_html_tag_name_htmlRawNames.includes(name)) {
|
|
67241
|
+
return 1
|
|
67242
|
+
}
|
|
67243
|
+
|
|
67244
|
+
return micromark_util_html_tag_name_htmlBlockNames.includes(name) ? 6 : 7
|
|
67245
|
+
}
|
|
67246
|
+
|
|
67247
|
+
;// ../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
|
|
67248
|
+
/**
|
|
67249
|
+
* @import {Attention, Handle, Info, State, Tracker} from 'mdast-util-to-markdown'
|
|
67250
|
+
* @import {PhrasingParents} from '../types.js'
|
|
67251
|
+
*/
|
|
67252
|
+
|
|
67253
|
+
|
|
67254
|
+
|
|
67255
|
+
|
|
67256
|
+
|
|
67257
|
+
|
|
67258
|
+
|
|
67259
|
+
|
|
67260
|
+
/**
|
|
67261
|
+
* Markers for builtin attention (emphasis, strong) to whether they are stricter:
|
|
67262
|
+
* whether they cannot open and close inside words.
|
|
67263
|
+
*
|
|
67264
|
+
* Builtin runs pair following CommonMark rules for emphasis and strong:
|
|
67265
|
+
* they are split,
|
|
67266
|
+
* using one or two markers at a time,
|
|
67267
|
+
* with the rule of 3.
|
|
67268
|
+
* Other markers pair like GFM strikethrough:
|
|
67269
|
+
* whole runs pair with a run of the same size.
|
|
67270
|
+
*
|
|
67271
|
+
* @type {Map<string, boolean>}
|
|
67272
|
+
*/
|
|
67273
|
+
const builtins = new Map([
|
|
67274
|
+
['*', false],
|
|
67275
|
+
['_', true]
|
|
67276
|
+
])
|
|
67277
|
+
|
|
67278
|
+
/**
|
|
67279
|
+
* @typedef AttentionResult
|
|
67280
|
+
* Attention, of which the sequence is chosen later.
|
|
67281
|
+
* @property {Array<Item>} children
|
|
67282
|
+
* Serialized children.
|
|
67283
|
+
* @property {Array<string>} sequences
|
|
67284
|
+
* Sequences that can be used, in order of preference.
|
|
67285
|
+
*/
|
|
67286
|
+
|
|
67287
|
+
/**
|
|
67288
|
+
* @typedef Improvement
|
|
67289
|
+
* Improvement of attention sequences.
|
|
67290
|
+
* @property {Map<AttentionResult, string>} chosen
|
|
67291
|
+
* Chosen sequences for each attention.
|
|
67292
|
+
* @property {Array<Token>} tokens
|
|
67293
|
+
* Tokens involved in the improvement.
|
|
67294
|
+
* @property {Mistake | undefined} mistake
|
|
67295
|
+
* Mistake that led to this improvement, if any.
|
|
67296
|
+
*/
|
|
67297
|
+
|
|
67298
|
+
/**
|
|
67299
|
+
* @typedef {AttentionResult | string} Item
|
|
67300
|
+
* Serialized phrasing.
|
|
67301
|
+
*/
|
|
67302
|
+
|
|
67303
|
+
/**
|
|
67304
|
+
* @typedef Mistake
|
|
67305
|
+
* Sequence that does not form its attention.
|
|
67306
|
+
* @property {Array<AttentionResult>} attention
|
|
67307
|
+
* Attention to try other sequences for.
|
|
67308
|
+
* @property {number} index
|
|
67309
|
+
* Index of the token.
|
|
67310
|
+
*/
|
|
67311
|
+
|
|
67312
|
+
/**
|
|
67313
|
+
* @typedef Run
|
|
67314
|
+
* Sequences next to each other with the same marker.
|
|
67315
|
+
* @property {boolean} close
|
|
67316
|
+
* Whether it can close.
|
|
67317
|
+
* @property {number} end
|
|
67318
|
+
* Index after the last marker not used (to open).
|
|
67319
|
+
* @property {Array<Token>} markers
|
|
67320
|
+
* Sequence of each marker.
|
|
67321
|
+
* @property {boolean} open
|
|
67322
|
+
* Whether it can open.
|
|
67323
|
+
* @property {boolean} split
|
|
67324
|
+
* Whether it can be split (built-in attention).
|
|
67325
|
+
* @property {number} start
|
|
67326
|
+
* Index of the first marker not used (to close).
|
|
67327
|
+
* @property {Array<Token>} tokens
|
|
67328
|
+
* Sequences.
|
|
67329
|
+
*/
|
|
67330
|
+
|
|
67331
|
+
/**
|
|
67332
|
+
* @typedef Token
|
|
67333
|
+
* Rendered phrasing.
|
|
67334
|
+
* @property {AttentionResult | undefined} attention
|
|
67335
|
+
* Attention, if this is one of its sequences.
|
|
67336
|
+
* @property {string} value
|
|
67337
|
+
* Value.
|
|
67338
|
+
*/
|
|
67339
|
+
|
|
67340
|
+
/**
|
|
67341
|
+
* Get candidates for a mistake:
|
|
67342
|
+
* attention to try other sequences for,
|
|
67343
|
+
* later first.
|
|
67344
|
+
*
|
|
67345
|
+
* @param {Array<Token>} tokens
|
|
67346
|
+
* Tokens.
|
|
67347
|
+
* @param {Array<Token>} involved
|
|
67348
|
+
* Sequences involved in the mistake.
|
|
67349
|
+
* @param {Map<Token, Run>} runOf
|
|
67350
|
+
* Run of each sequence.
|
|
67351
|
+
* @returns {Array<AttentionResult>}
|
|
67352
|
+
* Candidates.
|
|
67353
|
+
*/
|
|
67354
|
+
function candidates(tokens, involved, runOf) {
|
|
67355
|
+
/** @type {Set<AttentionResult | undefined>} */
|
|
67356
|
+
const related = new Set()
|
|
67357
|
+
|
|
67358
|
+
// The attention involved, and attention in runs with its sequences.
|
|
67359
|
+
for (const token of tokens) {
|
|
67360
|
+
const siblings = runOf.get(token)
|
|
67361
|
+
if (
|
|
67362
|
+
siblings &&
|
|
67363
|
+
token.attention &&
|
|
67364
|
+
involved.some((d) => d.attention === token.attention)
|
|
67365
|
+
) {
|
|
67366
|
+
for (const sibling of siblings.tokens) {
|
|
67367
|
+
related.add(sibling.attention)
|
|
67368
|
+
}
|
|
67369
|
+
}
|
|
67370
|
+
}
|
|
67371
|
+
|
|
67372
|
+
/** @type {Array<AttentionResult>} */
|
|
67373
|
+
const ordered = []
|
|
67374
|
+
|
|
67375
|
+
for (const token of tokens) {
|
|
67376
|
+
if (token.attention && related.delete(token.attention)) {
|
|
67377
|
+
ordered.push(token.attention)
|
|
67378
|
+
}
|
|
67379
|
+
}
|
|
67380
|
+
|
|
67381
|
+
// Later first: attention that opens later is inner or next.
|
|
67382
|
+
ordered.reverse()
|
|
67383
|
+
return ordered
|
|
67384
|
+
}
|
|
67385
|
+
|
|
67386
|
+
/**
|
|
67387
|
+
* Check whether sequences form their attention, like `micromark`.
|
|
67388
|
+
*
|
|
67389
|
+
* Sequences of `*` and `_` pair like emphasis and strong in CommonMark,
|
|
67390
|
+
* others like strikethrough in GFM.
|
|
67391
|
+
*
|
|
67392
|
+
* @param {Array<Token>} tokens
|
|
67393
|
+
* Tokens.
|
|
67394
|
+
* @param {string} before
|
|
67395
|
+
* Characters before.
|
|
67396
|
+
* @param {string} after
|
|
67397
|
+
* Characters after.
|
|
67398
|
+
* @returns {Mistake | undefined}
|
|
67399
|
+
* First mistake, if any.
|
|
67400
|
+
*/
|
|
67401
|
+
function check(tokens, before, after) {
|
|
67402
|
+
/** @type {Array<Run>} */
|
|
67403
|
+
const runs = []
|
|
67404
|
+
/** @type {Map<Token, Array<Token>>} */
|
|
67405
|
+
const wrong = new Map()
|
|
67406
|
+
/** @type {Map<Token, Run>} */
|
|
67407
|
+
const runOf = new Map()
|
|
67408
|
+
let index = 0
|
|
67409
|
+
|
|
67410
|
+
while (index < tokens.length) {
|
|
67411
|
+
if (!tokens[index].attention) {
|
|
67412
|
+
index++
|
|
67413
|
+
continue
|
|
67414
|
+
}
|
|
67415
|
+
|
|
67416
|
+
const marker = tokens[index].value.charAt(0)
|
|
67417
|
+
const strict = builtins.get(marker)
|
|
67418
|
+
let end = index + 1
|
|
67419
|
+
|
|
67420
|
+
while (
|
|
67421
|
+
end < tokens.length &&
|
|
67422
|
+
tokens[end].attention &&
|
|
67423
|
+
tokens[end].value.charAt(0) === marker
|
|
67424
|
+
) {
|
|
67425
|
+
end++
|
|
67426
|
+
}
|
|
67427
|
+
|
|
67428
|
+
const head = index ? tokens[index - 1].value : before
|
|
67429
|
+
const previous = micromark_util_classify_character_classifyCharacter(head.charCodeAt(head.length - 1))
|
|
67430
|
+
const next = micromark_util_classify_character_classifyCharacter(
|
|
67431
|
+
(end < tokens.length ? tokens[end].value : after).charCodeAt(0)
|
|
67432
|
+
)
|
|
67433
|
+
const open = !next || (next === 2 && Boolean(previous))
|
|
67434
|
+
const close = !previous || (previous === 2 && Boolean(next))
|
|
67435
|
+
/** @type {Run} */
|
|
67436
|
+
const run = {
|
|
67437
|
+
tokens: tokens.slice(index, end),
|
|
67438
|
+
markers: [],
|
|
67439
|
+
start: 0,
|
|
67440
|
+
end: 0,
|
|
67441
|
+
// Underscores are strict, they cannot open or close inside words.
|
|
67442
|
+
open: strict ? open && (Boolean(previous) || !close) : open,
|
|
67443
|
+
close: strict ? close && (Boolean(next) || !open) : close,
|
|
67444
|
+
// All builtins can split runs.
|
|
67445
|
+
split: strict !== undefined
|
|
67446
|
+
}
|
|
67447
|
+
|
|
67448
|
+
for (const token of run.tokens) {
|
|
67449
|
+
// Every sequence is wrong until it pairs with its other sequence.
|
|
67450
|
+
wrong.set(token, [...run.tokens])
|
|
67451
|
+
runOf.set(token, run)
|
|
67452
|
+
let size = token.value.length
|
|
67453
|
+
while (size--) run.markers.push(token)
|
|
67454
|
+
}
|
|
67455
|
+
|
|
67456
|
+
run.end = run.markers.length
|
|
67457
|
+
runs.push(run)
|
|
67458
|
+
index = end
|
|
67459
|
+
}
|
|
67460
|
+
|
|
67461
|
+
pair(runs, wrong)
|
|
67462
|
+
|
|
67463
|
+
index = -1
|
|
67464
|
+
|
|
67465
|
+
while (++index < tokens.length) {
|
|
67466
|
+
const involved = wrong.get(tokens[index])
|
|
67467
|
+
if (involved) return {attention: candidates(tokens, involved, runOf), index}
|
|
67468
|
+
}
|
|
67469
|
+
}
|
|
67470
|
+
|
|
67471
|
+
/**
|
|
67472
|
+
* Serialize the children of a parent that contains phrasing children.
|
|
67473
|
+
*
|
|
67474
|
+
* @param {PhrasingParents} parent
|
|
67475
|
+
* Parent of phrasing nodes.
|
|
67096
67476
|
* @param {State} state
|
|
67097
|
-
* Info passed around.
|
|
67477
|
+
* Info passed around about the current state.
|
|
67098
67478
|
* @param {Info} info
|
|
67099
|
-
* Info on
|
|
67479
|
+
* Info on where we are in the document we are generating.
|
|
67100
67480
|
* @returns {string}
|
|
67101
|
-
* Serialized
|
|
67481
|
+
* Serialized result.
|
|
67102
67482
|
*/
|
|
67103
|
-
function
|
|
67104
|
-
|
|
67105
|
-
|
|
67106
|
-
|
|
67107
|
-
|
|
67108
|
-
|
|
67109
|
-
|
|
67110
|
-
|
|
67111
|
-
|
|
67483
|
+
function containerPhrasing(parent, state, info) {
|
|
67484
|
+
return container_phrasing_serialize(phrasing(parent, state, info), info.before, info.after)
|
|
67485
|
+
}
|
|
67486
|
+
|
|
67487
|
+
/**
|
|
67488
|
+
* Encode the first or last character of tokens as a character reference,
|
|
67489
|
+
* if it is text.
|
|
67490
|
+
*
|
|
67491
|
+
* @param {Array<Token>} tokens
|
|
67492
|
+
* Tokens.
|
|
67493
|
+
* @param {boolean} start
|
|
67494
|
+
* Whether to encode the first or last character.
|
|
67495
|
+
* @returns {undefined}
|
|
67496
|
+
* Nothing.
|
|
67497
|
+
*/
|
|
67498
|
+
function container_phrasing_encode(tokens, start) {
|
|
67499
|
+
const token = tokens[start ? 0 : tokens.length - 1]
|
|
67500
|
+
|
|
67501
|
+
if (!token || token.attention) return
|
|
67502
|
+
|
|
67503
|
+
const character = start
|
|
67504
|
+
? firstCharacter(token.value)
|
|
67505
|
+
: lastCharacter(token.value)
|
|
67506
|
+
const reference = encodeCharacterReference(
|
|
67507
|
+
/** @type {number} */ (character.codePointAt(0))
|
|
67112
67508
|
)
|
|
67113
|
-
value += tracker.move('](')
|
|
67114
67509
|
|
|
67115
|
-
|
|
67510
|
+
if (start) {
|
|
67511
|
+
token.value = reference + token.value.slice(character.length)
|
|
67512
|
+
} else {
|
|
67513
|
+
let value = token.value.slice(0, token.value.length - character.length)
|
|
67514
|
+
let escapes = 0
|
|
67116
67515
|
|
|
67117
|
-
|
|
67118
|
-
|
|
67119
|
-
|
|
67120
|
-
|
|
67121
|
-
|
|
67122
|
-
|
|
67123
|
-
|
|
67124
|
-
|
|
67125
|
-
|
|
67126
|
-
|
|
67516
|
+
while (value.charCodeAt(value.length - 1 - escapes) === 92 /* `\` */) {
|
|
67517
|
+
escapes++
|
|
67518
|
+
}
|
|
67519
|
+
|
|
67520
|
+
// Odd number would escape the `&` again.
|
|
67521
|
+
if (escapes % 2) value += '\\'
|
|
67522
|
+
token.value = value + reference
|
|
67523
|
+
}
|
|
67524
|
+
}
|
|
67525
|
+
|
|
67526
|
+
/**
|
|
67527
|
+
* Try other sequences for the candidates of a mistake and use the first that
|
|
67528
|
+
* moves the mistake further.
|
|
67529
|
+
*
|
|
67530
|
+
* @param {Array<Item>} items
|
|
67531
|
+
* Items.
|
|
67532
|
+
* @param {Map<AttentionResult, string>} chosen
|
|
67533
|
+
* Sequences to use instead of preferred sequences.
|
|
67534
|
+
* @param {Mistake} mistake
|
|
67535
|
+
* Mistake.
|
|
67536
|
+
* @param {string} before
|
|
67537
|
+
* Characters before.
|
|
67538
|
+
* @param {string} after
|
|
67539
|
+
* Characters after.
|
|
67540
|
+
* @returns {Improvement | undefined}
|
|
67541
|
+
* Result if better.
|
|
67542
|
+
*/
|
|
67543
|
+
function improve(items, chosen, mistake, before, after) {
|
|
67544
|
+
for (const attention of mistake.attention) {
|
|
67545
|
+
const current = chosen.get(attention) || attention.sequences[0]
|
|
67546
|
+
|
|
67547
|
+
for (const sequence of attention.sequences) {
|
|
67548
|
+
if (sequence === current) continue
|
|
67549
|
+
const trial = new Map(chosen)
|
|
67550
|
+
trial.set(attention, sequence)
|
|
67551
|
+
const tokens = render(items, trial, before, after)
|
|
67552
|
+
const next = check(tokens, before, after)
|
|
67553
|
+
|
|
67554
|
+
if (!next || next.index > mistake.index) {
|
|
67555
|
+
return {chosen: trial, mistake: next, tokens}
|
|
67556
|
+
}
|
|
67557
|
+
}
|
|
67558
|
+
}
|
|
67559
|
+
}
|
|
67560
|
+
|
|
67561
|
+
/**
|
|
67562
|
+
* Pair runs like `micromark` and mark sequences that do form their attention
|
|
67563
|
+
* as fine.
|
|
67564
|
+
*
|
|
67565
|
+
* Each pair uses markers from the end of an opener and the start of a closer.
|
|
67566
|
+
* It forms the intended attention if those markers are exactly the whole
|
|
67567
|
+
* opening and closing sequence of one attention.
|
|
67568
|
+
* Otherwise attention is mixed up:
|
|
67569
|
+
* either sequences of different attention pair,
|
|
67570
|
+
* part of a sequence is used (such as `**` of strong as `*`),
|
|
67571
|
+
* or several sequences are used together (such as `*` and `*` as `**`).
|
|
67572
|
+
* Then the sequences involved are recorded with each other.
|
|
67573
|
+
*
|
|
67574
|
+
* @param {Array<Run>} runs
|
|
67575
|
+
* Runs.
|
|
67576
|
+
* @param {Map<Token, Array<Token>>} wrong
|
|
67577
|
+
* Sequences that are wrong, with the sequences involved.
|
|
67578
|
+
* @returns {undefined}
|
|
67579
|
+
* Nothing, `wrong` is changed.
|
|
67580
|
+
*/
|
|
67581
|
+
function pair(runs, wrong) {
|
|
67582
|
+
/** @type {Map<string, Array<Run>>} */
|
|
67583
|
+
const openersByMarker = new Map()
|
|
67584
|
+
|
|
67585
|
+
for (const closer of runs) {
|
|
67586
|
+
const marker = closer.tokens[0].value.charAt(0)
|
|
67587
|
+
let openers = openersByMarker.get(marker)
|
|
67588
|
+
|
|
67589
|
+
if (!openers) {
|
|
67590
|
+
openers = []
|
|
67591
|
+
openersByMarker.set(marker, openers)
|
|
67592
|
+
}
|
|
67593
|
+
|
|
67594
|
+
let open = closer.close ? openers.length : 0
|
|
67595
|
+
|
|
67596
|
+
while (open-- && closer.start < closer.end) {
|
|
67597
|
+
const opener = openers[open]
|
|
67598
|
+
const openerSize = opener.end - opener.start
|
|
67599
|
+
const closerSize = closer.end - closer.start
|
|
67600
|
+
|
|
67601
|
+
if (
|
|
67602
|
+
closer.split
|
|
67603
|
+
? // The rule of 3, on the sizes that are left.
|
|
67604
|
+
(opener.close || closer.open) &&
|
|
67605
|
+
closerSize % 3 &&
|
|
67606
|
+
!((openerSize + closerSize) % 3)
|
|
67607
|
+
: // Others pair whole runs of the same size.
|
|
67608
|
+
openerSize !== opener.markers.length || openerSize !== closerSize
|
|
67609
|
+
) {
|
|
67610
|
+
continue
|
|
67611
|
+
}
|
|
67612
|
+
|
|
67613
|
+
const size = closer.split
|
|
67614
|
+
? openerSize > 1 && closerSize > 1
|
|
67615
|
+
? 2
|
|
67616
|
+
: 1
|
|
67617
|
+
: closerSize
|
|
67618
|
+
const opening = opener.markers.slice(opener.end - size, opener.end)
|
|
67619
|
+
const closing = closer.markers.slice(closer.start, closer.start + size)
|
|
67620
|
+
const openToken = opening[0]
|
|
67621
|
+
const closeToken = closing[0]
|
|
67622
|
+
|
|
67623
|
+
if (
|
|
67624
|
+
// Whole sequences:
|
|
67625
|
+
// the markers of a sequence are next to each other,
|
|
67626
|
+
// so if the first and last marker are of one sequence of that size,
|
|
67627
|
+
// all markers are exactly that sequence.
|
|
67628
|
+
openToken === opening[size - 1] &&
|
|
67629
|
+
openToken.value.length === size &&
|
|
67630
|
+
closeToken === closing[size - 1] &&
|
|
67631
|
+
closeToken.value.length === size &&
|
|
67632
|
+
// Of the same attention, so its opening and closing sequence.
|
|
67633
|
+
openToken.attention === closeToken.attention
|
|
67634
|
+
) {
|
|
67635
|
+
wrong.delete(openToken)
|
|
67636
|
+
wrong.delete(closeToken)
|
|
67637
|
+
} else {
|
|
67638
|
+
const involved = [...new Set([...opening, ...closing])]
|
|
67639
|
+
// Add to what is involved already: a sequence can be in several pairs.
|
|
67640
|
+
for (const token of involved) {
|
|
67641
|
+
const list = wrong.get(token)
|
|
67642
|
+
if (list) list.push(...involved)
|
|
67643
|
+
}
|
|
67644
|
+
}
|
|
67645
|
+
|
|
67646
|
+
opener.end -= size
|
|
67647
|
+
closer.start += size
|
|
67648
|
+
|
|
67649
|
+
if (opener.start === opener.end) openers.splice(open, 1)
|
|
67650
|
+
|
|
67651
|
+
// Search again from the start, as this run may close more.
|
|
67652
|
+
open = openers.length
|
|
67653
|
+
}
|
|
67654
|
+
|
|
67655
|
+
if (closer.open && closer.start < closer.end) openers.push(closer)
|
|
67656
|
+
}
|
|
67657
|
+
}
|
|
67658
|
+
|
|
67659
|
+
/**
|
|
67660
|
+
* Get the sequences that can be used for attention, in order of preference.
|
|
67661
|
+
*
|
|
67662
|
+
* @param {string} type
|
|
67663
|
+
* Node type.
|
|
67664
|
+
* @param {Array<string>} markers
|
|
67665
|
+
* Markers.
|
|
67666
|
+
* @param {Array<number>} sizes
|
|
67667
|
+
* Sizes.
|
|
67668
|
+
* @returns {Array<string>}
|
|
67669
|
+
* Sequences.
|
|
67670
|
+
*/
|
|
67671
|
+
function attentionSequences(type, markers, sizes) {
|
|
67672
|
+
if (markers.length === 0) {
|
|
67673
|
+
throw new Error(
|
|
67674
|
+
'Cannot serialize `' +
|
|
67675
|
+
type +
|
|
67676
|
+
'` as attention without markers, expected one or more markers'
|
|
67127
67677
|
)
|
|
67128
|
-
|
|
67129
|
-
|
|
67130
|
-
|
|
67131
|
-
|
|
67132
|
-
|
|
67133
|
-
|
|
67134
|
-
|
|
67135
|
-
after: node.title ? ' ' : ')',
|
|
67136
|
-
...tracker.current()
|
|
67137
|
-
})
|
|
67678
|
+
}
|
|
67679
|
+
|
|
67680
|
+
if (sizes.length === 0) {
|
|
67681
|
+
throw new Error(
|
|
67682
|
+
'Cannot serialize `' +
|
|
67683
|
+
type +
|
|
67684
|
+
'` as attention without sizes, expected one or more sizes'
|
|
67138
67685
|
)
|
|
67139
67686
|
}
|
|
67140
67687
|
|
|
67141
|
-
|
|
67688
|
+
for (const size of sizes) {
|
|
67689
|
+
if (!Number.isSafeInteger(size) || size < 1) {
|
|
67690
|
+
throw new Error(
|
|
67691
|
+
'Cannot serialize `' +
|
|
67692
|
+
type +
|
|
67693
|
+
'` as attention with `' +
|
|
67694
|
+
size +
|
|
67695
|
+
'` as size, expected positive integer'
|
|
67696
|
+
)
|
|
67697
|
+
}
|
|
67698
|
+
}
|
|
67142
67699
|
|
|
67143
|
-
|
|
67144
|
-
|
|
67145
|
-
|
|
67146
|
-
|
|
67147
|
-
|
|
67148
|
-
|
|
67149
|
-
|
|
67150
|
-
|
|
67700
|
+
/** @type {Array<string>} */
|
|
67701
|
+
const sequences = []
|
|
67702
|
+
|
|
67703
|
+
for (const marker of markers) {
|
|
67704
|
+
if (marker.length !== 1) {
|
|
67705
|
+
throw new Error(
|
|
67706
|
+
'Cannot serialize `' +
|
|
67707
|
+
type +
|
|
67708
|
+
'` as attention with `' +
|
|
67709
|
+
marker +
|
|
67710
|
+
'` as marker, expected a single ascii character'
|
|
67711
|
+
)
|
|
67712
|
+
}
|
|
67713
|
+
|
|
67714
|
+
if (!mdast_util_to_markdown_node_modules_micromark_util_character_asciiPunctuation(marker.charCodeAt(0))) {
|
|
67715
|
+
throw new Error(
|
|
67716
|
+
'Cannot serialize `' +
|
|
67717
|
+
type +
|
|
67718
|
+
'` as attention with `' +
|
|
67719
|
+
marker +
|
|
67720
|
+
'` as marker, expected ascii punctuation'
|
|
67721
|
+
)
|
|
67722
|
+
}
|
|
67723
|
+
|
|
67724
|
+
for (const size of sizes) {
|
|
67725
|
+
sequences.push(marker.repeat(size))
|
|
67726
|
+
}
|
|
67727
|
+
}
|
|
67728
|
+
|
|
67729
|
+
return sequences
|
|
67730
|
+
}
|
|
67731
|
+
|
|
67732
|
+
/**
|
|
67733
|
+
* Serialize the children of a parent that contains phrasing children,
|
|
67734
|
+
* keeping attention separate,
|
|
67735
|
+
* so that its markers can be chosen later.
|
|
67736
|
+
*
|
|
67737
|
+
* @param {PhrasingParents} parent
|
|
67738
|
+
* Parent of phrasing nodes.
|
|
67739
|
+
* @param {State} state
|
|
67740
|
+
* Info passed around about the current state.
|
|
67741
|
+
* @param {Info} info
|
|
67742
|
+
* Info on where we are in the document we are generating.
|
|
67743
|
+
* @returns {Array<Item>}
|
|
67744
|
+
* Items.
|
|
67745
|
+
*/
|
|
67746
|
+
function phrasing(parent, state, info) {
|
|
67747
|
+
const indexStack = state.indexStack
|
|
67748
|
+
const children = parent.children || []
|
|
67749
|
+
/** @type {Array<Item>} */
|
|
67750
|
+
const results = []
|
|
67751
|
+
let index = -1
|
|
67752
|
+
let before = info.before
|
|
67753
|
+
|
|
67754
|
+
indexStack.push(-1)
|
|
67755
|
+
let tracker = state.createTracker(info)
|
|
67756
|
+
|
|
67757
|
+
while (++index < children.length) {
|
|
67758
|
+
const child = children[index]
|
|
67759
|
+
/** @type {string} */
|
|
67760
|
+
let after
|
|
67761
|
+
|
|
67762
|
+
indexStack[indexStack.length - 1] = index
|
|
67763
|
+
|
|
67764
|
+
if (index + 1 < children.length) {
|
|
67765
|
+
/** @type {Handle} */
|
|
67766
|
+
// @ts-expect-error: hush, it’s actually a `zwitch`.
|
|
67767
|
+
let handle = state.handle.handlers[children[index + 1].type]
|
|
67768
|
+
// @ts-expect-error: hush, it’s actually a `zwitch`.
|
|
67769
|
+
if (handle && handle.peek) handle = handle.peek
|
|
67770
|
+
after = handle
|
|
67771
|
+
? firstCharacter(
|
|
67772
|
+
handle(children[index + 1], parent, state, {
|
|
67773
|
+
before: '',
|
|
67774
|
+
after: '',
|
|
67775
|
+
...tracker.current()
|
|
67776
|
+
})
|
|
67777
|
+
)
|
|
67778
|
+
: ''
|
|
67779
|
+
} else {
|
|
67780
|
+
after = info.after
|
|
67781
|
+
}
|
|
67782
|
+
|
|
67783
|
+
// In some cases, html (text) can be found in phrasing right after an eol.
|
|
67784
|
+
// When we’d serialize that, it could be seen as html (flow): all its kinds
|
|
67785
|
+
// except 7 can interrupt a paragraph.
|
|
67786
|
+
// As we can’t escape or so to prevent it from happening,
|
|
67787
|
+
// we take a somewhat reasonable approach:
|
|
67788
|
+
// replace that eol with a space.
|
|
67789
|
+
// See: <https://github.com/syntax-tree/mdast-util-to-markdown/issues/15>
|
|
67790
|
+
const previous = results[results.length - 1]
|
|
67791
|
+
|
|
67792
|
+
if (
|
|
67793
|
+
typeof previous === 'string' &&
|
|
67794
|
+
(before === '\r' || before === '\n') &&
|
|
67795
|
+
child.type === 'html' &&
|
|
67796
|
+
htmlKind(child.value) !== 7
|
|
67797
|
+
) {
|
|
67798
|
+
results[results.length - 1] = previous.replace(/(\r?\n|\r)$/, ' ')
|
|
67799
|
+
before = ' '
|
|
67800
|
+
|
|
67801
|
+
// To do: does this work to reset tracker?
|
|
67802
|
+
tracker = state.createTracker(info)
|
|
67803
|
+
tracker.move(container_phrasing_serialize(results, info.before, info.after))
|
|
67804
|
+
}
|
|
67805
|
+
|
|
67806
|
+
/** @type {(Handle & {attention?: Attention | undefined}) | undefined} */
|
|
67807
|
+
// @ts-expect-error: hush, it’s actually a `zwitch`.
|
|
67808
|
+
const handle = state.handle.handlers[child.type]
|
|
67809
|
+
|
|
67810
|
+
if (handle && handle.attention) {
|
|
67811
|
+
const item = attentionItem(
|
|
67812
|
+
/** @type {PhrasingParents} */ (child),
|
|
67813
|
+
handle.attention,
|
|
67814
|
+
state,
|
|
67815
|
+
tracker
|
|
67816
|
+
)
|
|
67817
|
+
results.push(item)
|
|
67818
|
+
before = lastCharacter(item.sequences[0])
|
|
67819
|
+
} else {
|
|
67820
|
+
const value = state.handle(child, parent, state, {
|
|
67821
|
+
...tracker.current(),
|
|
67822
|
+
after,
|
|
67823
|
+
before
|
|
67151
67824
|
})
|
|
67152
|
-
|
|
67153
|
-
|
|
67154
|
-
|
|
67825
|
+
|
|
67826
|
+
if (!value) continue
|
|
67827
|
+
tracker.move(value)
|
|
67828
|
+
results.push(value)
|
|
67829
|
+
before = lastCharacter(value)
|
|
67830
|
+
}
|
|
67155
67831
|
}
|
|
67156
67832
|
|
|
67157
|
-
|
|
67833
|
+
indexStack.pop()
|
|
67834
|
+
|
|
67835
|
+
return results
|
|
67836
|
+
}
|
|
67837
|
+
|
|
67838
|
+
/**
|
|
67839
|
+
* Serialize a node as attention,
|
|
67840
|
+
* with its sequence chosen later.
|
|
67841
|
+
*
|
|
67842
|
+
* @param {PhrasingParents} node
|
|
67843
|
+
* Node.
|
|
67844
|
+
* @param {Attention} attention
|
|
67845
|
+
* Attention of the node.
|
|
67846
|
+
* @param {State} state
|
|
67847
|
+
* Info passed around about the current state.
|
|
67848
|
+
* @param {Tracker} tracker
|
|
67849
|
+
* Tracker.
|
|
67850
|
+
* @returns {AttentionResult}
|
|
67851
|
+
* Attention.
|
|
67852
|
+
*/
|
|
67853
|
+
function attentionItem(node, attention, state, tracker) {
|
|
67854
|
+
const {construct, markers, sizes} = attention(node, state)
|
|
67855
|
+
const sequences = attentionSequences(node.type, markers, sizes)
|
|
67856
|
+
const sequence = sequences[0]
|
|
67857
|
+
const exit = state.enter(construct)
|
|
67858
|
+
tracker.move(sequence)
|
|
67859
|
+
const children = phrasing(node, state, {
|
|
67860
|
+
...tracker.current(),
|
|
67861
|
+
before: sequence,
|
|
67862
|
+
after: sequence
|
|
67863
|
+
})
|
|
67864
|
+
tracker.move(container_phrasing_serialize(children, sequence, sequence))
|
|
67865
|
+
tracker.move(sequence)
|
|
67158
67866
|
exit()
|
|
67867
|
+
return {children, sequences}
|
|
67868
|
+
}
|
|
67159
67869
|
|
|
67160
|
-
|
|
67870
|
+
/**
|
|
67871
|
+
* Render items with sequences;
|
|
67872
|
+
* encoding characters around attention where needed.
|
|
67873
|
+
*
|
|
67874
|
+
* @param {Array<Item>} items
|
|
67875
|
+
* Serialized phrasing.
|
|
67876
|
+
* @param {Map<AttentionResult, string>} chosen
|
|
67877
|
+
* Sequences to use instead of preferred sequences.
|
|
67878
|
+
* @param {string} before
|
|
67879
|
+
* Characters before.
|
|
67880
|
+
* @param {string} after
|
|
67881
|
+
* Characters after.
|
|
67882
|
+
* @returns {Array<Token>}
|
|
67883
|
+
* Tokens.
|
|
67884
|
+
*/
|
|
67885
|
+
function render(items, chosen, before, after) {
|
|
67886
|
+
/** @type {Array<Token>} */
|
|
67887
|
+
const tokens = []
|
|
67888
|
+
/** @type {string | undefined} */
|
|
67889
|
+
let encodeAfter
|
|
67890
|
+
let previous = lastCharacter(before)
|
|
67891
|
+
let index = -1
|
|
67892
|
+
|
|
67893
|
+
while (++index < items.length) {
|
|
67894
|
+
const item = items[index]
|
|
67895
|
+
|
|
67896
|
+
if (typeof item === 'string') {
|
|
67897
|
+
/** @type {Token} */
|
|
67898
|
+
const token = {value: item, attention: undefined}
|
|
67899
|
+
|
|
67900
|
+
// If attention before had to encode the character after it, encode it.
|
|
67901
|
+
if (encodeAfter && encodeAfter === firstCharacter(item)) {
|
|
67902
|
+
container_phrasing_encode([token], true)
|
|
67903
|
+
}
|
|
67904
|
+
|
|
67905
|
+
encodeAfter = undefined
|
|
67906
|
+
tokens.push(token)
|
|
67907
|
+
if (token.value) previous = lastCharacter(token.value)
|
|
67908
|
+
continue
|
|
67909
|
+
}
|
|
67910
|
+
|
|
67911
|
+
const sequence = chosen.get(item) || item.sequences[0]
|
|
67912
|
+
const marker = sequence.charAt(0)
|
|
67913
|
+
const next = items[index + 1]
|
|
67914
|
+
const outsideBefore = previous
|
|
67915
|
+
const outsideAfter = firstCharacter(
|
|
67916
|
+
next === undefined
|
|
67917
|
+
? after
|
|
67918
|
+
: typeof next === 'string'
|
|
67919
|
+
? next
|
|
67920
|
+
: chosen.get(next) || next.sequences[0]
|
|
67921
|
+
)
|
|
67922
|
+
const inside = render(item.children, chosen, sequence, sequence)
|
|
67923
|
+
const head = inside.length > 0 ? inside[0].value : ''
|
|
67924
|
+
const open = encodeInfo(
|
|
67925
|
+
outsideBefore.charCodeAt(outsideBefore.length - 1),
|
|
67926
|
+
head.charCodeAt(0),
|
|
67927
|
+
marker
|
|
67928
|
+
)
|
|
67929
|
+
|
|
67930
|
+
if (open.inside) container_phrasing_encode(inside, true)
|
|
67931
|
+
|
|
67932
|
+
const tail =
|
|
67933
|
+
inside.length > 0 ? lastCharacter(inside[inside.length - 1].value) : ''
|
|
67934
|
+
const close = encodeInfo(
|
|
67935
|
+
outsideAfter.charCodeAt(0),
|
|
67936
|
+
tail.charCodeAt(tail.length - 1),
|
|
67937
|
+
marker
|
|
67938
|
+
)
|
|
67939
|
+
|
|
67940
|
+
if (close.inside) container_phrasing_encode(inside, false)
|
|
67941
|
+
|
|
67942
|
+
if (open.outside && outsideBefore !== '\n' && outsideBefore !== '\r') {
|
|
67943
|
+
container_phrasing_encode(tokens, false)
|
|
67944
|
+
}
|
|
67945
|
+
|
|
67946
|
+
if (close.outside) encodeAfter = outsideAfter
|
|
67947
|
+
|
|
67948
|
+
tokens.push({value: sequence, attention: item}, ...inside, {
|
|
67949
|
+
value: sequence,
|
|
67950
|
+
attention: item
|
|
67951
|
+
})
|
|
67952
|
+
previous = sequence.charAt(sequence.length - 1)
|
|
67953
|
+
}
|
|
67954
|
+
|
|
67955
|
+
return tokens
|
|
67161
67956
|
}
|
|
67162
67957
|
|
|
67163
67958
|
/**
|
|
67164
|
-
*
|
|
67959
|
+
* Serialize phrasing with attention.
|
|
67960
|
+
*
|
|
67961
|
+
* Whether attention forms depends on everything around it.
|
|
67962
|
+
* This checks that it does and tries other sequences if not.
|
|
67165
67963
|
*
|
|
67964
|
+
* @param {Array<Item>} items
|
|
67965
|
+
* Phrasing items.
|
|
67966
|
+
* @param {string} before
|
|
67967
|
+
* Characters before.
|
|
67968
|
+
* @param {string} after
|
|
67969
|
+
* Characters after.
|
|
67166
67970
|
* @returns {string}
|
|
67167
|
-
*
|
|
67971
|
+
* Serialized markdown.
|
|
67168
67972
|
*/
|
|
67169
|
-
function
|
|
67170
|
-
|
|
67973
|
+
function container_phrasing_serialize(items, before, after) {
|
|
67974
|
+
/** @type {Map<AttentionResult, string>} */
|
|
67975
|
+
let chosen = new Map()
|
|
67976
|
+
const initial = render(items, chosen, before, after)
|
|
67977
|
+
let tokens = initial
|
|
67978
|
+
let mistake = check(tokens, before, after)
|
|
67979
|
+
|
|
67980
|
+
while (mistake) {
|
|
67981
|
+
const next = improve(items, chosen, mistake, before, after)
|
|
67982
|
+
|
|
67983
|
+
if (!next) {
|
|
67984
|
+
tokens = initial
|
|
67985
|
+
break
|
|
67986
|
+
}
|
|
67987
|
+
|
|
67988
|
+
chosen = next.chosen
|
|
67989
|
+
tokens = next.tokens
|
|
67990
|
+
mistake = next.mistake
|
|
67991
|
+
}
|
|
67992
|
+
|
|
67993
|
+
// Join the tokens.
|
|
67994
|
+
let result = ''
|
|
67995
|
+
for (const token of tokens) result += token.value
|
|
67996
|
+
return result
|
|
67171
67997
|
}
|
|
67172
67998
|
|
|
67173
|
-
;// ../node_modules/mdast-util-to-markdown/lib/handle/
|
|
67999
|
+
;// ../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
|
|
67174
68000
|
/**
|
|
67175
|
-
* @import {Info, State} from 'mdast-util-to-markdown'
|
|
67176
|
-
* @import {
|
|
68001
|
+
* @import {AttentionInfo, Info, State} from 'mdast-util-to-markdown'
|
|
68002
|
+
* @import {Emphasis, Parents} from 'mdast'
|
|
67177
68003
|
*/
|
|
67178
68004
|
|
|
67179
|
-
|
|
68005
|
+
|
|
68006
|
+
|
|
68007
|
+
|
|
68008
|
+
emphasis_emphasis.attention = emphasis_attention
|
|
68009
|
+
emphasis_emphasis.peek = peek
|
|
67180
68010
|
|
|
67181
68011
|
/**
|
|
67182
|
-
* Serialize an
|
|
68012
|
+
* Serialize an emphasis node.
|
|
67183
68013
|
*
|
|
67184
|
-
*
|
|
68014
|
+
* Attention is properly handled by `containerPhrasing`.
|
|
68015
|
+
*
|
|
68016
|
+
* @param {Emphasis} node
|
|
67185
68017
|
* Node to serialize.
|
|
67186
68018
|
* @param {Parents | undefined} _
|
|
67187
68019
|
* Parent node.
|
|
@@ -67192,209 +68024,213 @@ image_reference_imageReference.peek = imageReferencePeek
|
|
|
67192
68024
|
* @returns {string}
|
|
67193
68025
|
* Serialized markdown.
|
|
67194
68026
|
*/
|
|
67195
|
-
function
|
|
67196
|
-
const
|
|
67197
|
-
const
|
|
67198
|
-
|
|
67199
|
-
const tracker = state.createTracker(info)
|
|
67200
|
-
let value = tracker.move('![')
|
|
67201
|
-
const alt = state.safe(node.alt, {
|
|
67202
|
-
before: value,
|
|
67203
|
-
after: ']',
|
|
67204
|
-
...tracker.current()
|
|
67205
|
-
})
|
|
67206
|
-
value += tracker.move(alt + '][')
|
|
67207
|
-
|
|
67208
|
-
subexit()
|
|
67209
|
-
// Hide that we’re in phrasing as things like attention or code cannot form
|
|
67210
|
-
// in references.
|
|
67211
|
-
// Character escapes and references *do* work.
|
|
67212
|
-
// It is important to know about other constructs, such as table cells.
|
|
67213
|
-
const stack = state.stack
|
|
67214
|
-
state.stack = stack.filter(function (d) {
|
|
67215
|
-
return d !== 'phrasing'
|
|
67216
|
-
})
|
|
67217
|
-
subexit = state.enter('reference')
|
|
67218
|
-
// Note: for proper tracking, we should reset the output positions when we end
|
|
67219
|
-
// up making a `shortcut` reference, because then there is no brace output.
|
|
67220
|
-
// Practically, in that case, there is no content, so it doesn’t matter that
|
|
67221
|
-
// we’ve tracked one too many characters.
|
|
67222
|
-
const reference = state.safe(state.associationId(node), {
|
|
67223
|
-
before: value,
|
|
67224
|
-
after: ']',
|
|
67225
|
-
...tracker.current()
|
|
67226
|
-
})
|
|
67227
|
-
subexit()
|
|
67228
|
-
state.stack = stack
|
|
68027
|
+
function emphasis_emphasis(node, _, state, info) {
|
|
68028
|
+
const exit = state.enter('phrasing')
|
|
68029
|
+
const item = attentionItem(node, emphasis_attention, state, state.createTracker(info))
|
|
68030
|
+
const value = container_phrasing_serialize([item], info.before, info.after)
|
|
67229
68031
|
exit()
|
|
68032
|
+
return value
|
|
68033
|
+
}
|
|
67230
68034
|
|
|
67231
|
-
|
|
67232
|
-
|
|
67233
|
-
|
|
67234
|
-
|
|
67235
|
-
|
|
67236
|
-
|
|
67237
|
-
|
|
68035
|
+
/**
|
|
68036
|
+
* Serialize an emphasis node as attention.
|
|
68037
|
+
*
|
|
68038
|
+
* @param {Emphasis} _
|
|
68039
|
+
* Node to serialize.
|
|
68040
|
+
* @param {State} state
|
|
68041
|
+
* Info passed around.
|
|
68042
|
+
* @returns {AttentionInfo}
|
|
68043
|
+
* Info on how to serialize the node.
|
|
68044
|
+
*/
|
|
68045
|
+
function emphasis_attention(_, state) {
|
|
68046
|
+
const marker = checkEmphasis(state)
|
|
68047
|
+
return {
|
|
68048
|
+
construct: 'emphasis',
|
|
68049
|
+
markers: marker === '*' ? ['*', '_'] : ['_', '*'],
|
|
68050
|
+
sizes: [1]
|
|
67238
68051
|
}
|
|
67239
|
-
|
|
67240
|
-
return value
|
|
67241
68052
|
}
|
|
67242
68053
|
|
|
67243
68054
|
/**
|
|
67244
68055
|
* Peek at this node.
|
|
67245
68056
|
*
|
|
68057
|
+
* @param {Emphasis} _
|
|
68058
|
+
* Node to serialize.
|
|
68059
|
+
* @param {Parents | undefined} _1
|
|
68060
|
+
* Parent node.
|
|
68061
|
+
* @param {State} state
|
|
68062
|
+
* Info passed around.
|
|
67246
68063
|
* @returns {string}
|
|
67247
68064
|
* Start of the serialized markdown.
|
|
67248
68065
|
*/
|
|
67249
|
-
function
|
|
67250
|
-
return '
|
|
68066
|
+
function peek(_, _1, state) {
|
|
68067
|
+
return state.options.emphasis || '*'
|
|
67251
68068
|
}
|
|
67252
68069
|
|
|
67253
|
-
;// ../node_modules/mdast-util-to-markdown/lib/
|
|
68070
|
+
;// ../node_modules/mdast-util-to-markdown/node_modules/mdast-util-to-string/lib/index.js
|
|
67254
68071
|
/**
|
|
67255
|
-
* @
|
|
67256
|
-
*
|
|
68072
|
+
* @typedef {import('mdast').Nodes} Nodes
|
|
68073
|
+
*
|
|
68074
|
+
* @typedef Options
|
|
68075
|
+
* Configuration (optional).
|
|
68076
|
+
* @property {boolean | null | undefined} [includeImageAlt=true]
|
|
68077
|
+
* Whether to use `alt` for `image`s (default: `true`).
|
|
68078
|
+
* @property {boolean | null | undefined} [includeHtml=true]
|
|
68079
|
+
* Whether to use `value` of HTML (default: `true`).
|
|
67257
68080
|
*/
|
|
67258
68081
|
|
|
67259
|
-
|
|
68082
|
+
/** @type {Options} */
|
|
68083
|
+
const node_modules_mdast_util_to_string_lib_emptyOptions = {}
|
|
67260
68084
|
|
|
67261
68085
|
/**
|
|
67262
|
-
*
|
|
68086
|
+
* Get the text content of a node or list of nodes.
|
|
67263
68087
|
*
|
|
67264
|
-
*
|
|
67265
|
-
*
|
|
67266
|
-
*
|
|
67267
|
-
*
|
|
67268
|
-
*
|
|
67269
|
-
*
|
|
68088
|
+
* Prefers the node’s plain-text fields, otherwise serializes its children,
|
|
68089
|
+
* and if the given value is an array, serialize the nodes in it.
|
|
68090
|
+
*
|
|
68091
|
+
* @param {unknown} [value]
|
|
68092
|
+
* Thing to serialize, typically `Node`.
|
|
68093
|
+
* @param {Options | null | undefined} [options]
|
|
68094
|
+
* Configuration (optional).
|
|
67270
68095
|
* @returns {string}
|
|
67271
|
-
* Serialized
|
|
68096
|
+
* Serialized `value`.
|
|
67272
68097
|
*/
|
|
67273
|
-
function
|
|
67274
|
-
|
|
67275
|
-
|
|
67276
|
-
|
|
68098
|
+
function node_modules_mdast_util_to_string_lib_toString(value, options) {
|
|
68099
|
+
const settings = options || node_modules_mdast_util_to_string_lib_emptyOptions
|
|
68100
|
+
const includeImageAlt =
|
|
68101
|
+
typeof settings.includeImageAlt === 'boolean'
|
|
68102
|
+
? settings.includeImageAlt
|
|
68103
|
+
: true
|
|
68104
|
+
const includeHtml =
|
|
68105
|
+
typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true
|
|
67277
68106
|
|
|
67278
|
-
|
|
67279
|
-
|
|
67280
|
-
// If there are two in a row, use one.
|
|
67281
|
-
while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {
|
|
67282
|
-
sequence += '`'
|
|
67283
|
-
}
|
|
68107
|
+
return node_modules_mdast_util_to_string_lib_one(value, includeImageAlt, includeHtml)
|
|
68108
|
+
}
|
|
67284
68109
|
|
|
67285
|
-
|
|
67286
|
-
|
|
67287
|
-
|
|
67288
|
-
|
|
67289
|
-
|
|
67290
|
-
|
|
67291
|
-
|
|
67292
|
-
|
|
68110
|
+
/**
|
|
68111
|
+
* One node or several nodes.
|
|
68112
|
+
*
|
|
68113
|
+
* @param {unknown} value
|
|
68114
|
+
* Thing to serialize.
|
|
68115
|
+
* @param {boolean} includeImageAlt
|
|
68116
|
+
* Include image `alt`s.
|
|
68117
|
+
* @param {boolean} includeHtml
|
|
68118
|
+
* Include HTML.
|
|
68119
|
+
* @returns {string}
|
|
68120
|
+
* Serialized node.
|
|
68121
|
+
*/
|
|
68122
|
+
function node_modules_mdast_util_to_string_lib_one(value, includeImageAlt, includeHtml) {
|
|
68123
|
+
if (mdast_util_to_string_lib_node(value)) {
|
|
68124
|
+
if ('value' in value) {
|
|
68125
|
+
return value.type === 'html' && !includeHtml ? '' : value.value
|
|
68126
|
+
}
|
|
67293
68127
|
|
|
67294
|
-
|
|
67295
|
-
|
|
67296
|
-
|
|
67297
|
-
// result in an ATX heading.
|
|
67298
|
-
// We can’t escape characters in `inlineCode`, but because eols are
|
|
67299
|
-
// transformed to spaces when going from markdown to HTML anyway, we can swap
|
|
67300
|
-
// them out.
|
|
67301
|
-
while (++index < state.unsafe.length) {
|
|
67302
|
-
const pattern = state.unsafe[index]
|
|
67303
|
-
const expression = state.compilePattern(pattern)
|
|
68128
|
+
if (includeImageAlt && 'alt' in value && value.alt) {
|
|
68129
|
+
return value.alt
|
|
68130
|
+
}
|
|
67304
68131
|
|
|
67305
|
-
|
|
67306
|
-
|
|
67307
|
-
|
|
67308
|
-
|
|
68132
|
+
if ('children' in value) {
|
|
68133
|
+
return node_modules_mdast_util_to_string_lib_all(value.children, includeImageAlt, includeHtml)
|
|
68134
|
+
}
|
|
68135
|
+
}
|
|
67309
68136
|
|
|
67310
|
-
|
|
67311
|
-
|
|
68137
|
+
if (Array.isArray(value)) {
|
|
68138
|
+
return node_modules_mdast_util_to_string_lib_all(value, includeImageAlt, includeHtml)
|
|
68139
|
+
}
|
|
67312
68140
|
|
|
67313
|
-
|
|
67314
|
-
|
|
68141
|
+
return ''
|
|
68142
|
+
}
|
|
67315
68143
|
|
|
67316
|
-
|
|
67317
|
-
|
|
67318
|
-
|
|
67319
|
-
|
|
67320
|
-
|
|
67321
|
-
|
|
67322
|
-
|
|
68144
|
+
/**
|
|
68145
|
+
* Serialize a list of nodes.
|
|
68146
|
+
*
|
|
68147
|
+
* @param {Array<unknown>} values
|
|
68148
|
+
* Thing to serialize.
|
|
68149
|
+
* @param {boolean} includeImageAlt
|
|
68150
|
+
* Include image `alt`s.
|
|
68151
|
+
* @param {boolean} includeHtml
|
|
68152
|
+
* Include HTML.
|
|
68153
|
+
* @returns {string}
|
|
68154
|
+
* Serialized nodes.
|
|
68155
|
+
*/
|
|
68156
|
+
function node_modules_mdast_util_to_string_lib_all(values, includeImageAlt, includeHtml) {
|
|
68157
|
+
/** @type {Array<string>} */
|
|
68158
|
+
const result = []
|
|
68159
|
+
let index = -1
|
|
67323
68160
|
|
|
67324
|
-
|
|
67325
|
-
|
|
68161
|
+
while (++index < values.length) {
|
|
68162
|
+
result[index] = node_modules_mdast_util_to_string_lib_one(values[index], includeImageAlt, includeHtml)
|
|
67326
68163
|
}
|
|
67327
68164
|
|
|
67328
|
-
return
|
|
68165
|
+
return result.join('')
|
|
67329
68166
|
}
|
|
67330
68167
|
|
|
67331
68168
|
/**
|
|
67332
|
-
*
|
|
68169
|
+
* Check if `value` looks like a node.
|
|
67333
68170
|
*
|
|
67334
|
-
* @
|
|
67335
|
-
*
|
|
68171
|
+
* @param {unknown} value
|
|
68172
|
+
* Thing.
|
|
68173
|
+
* @returns {value is Nodes}
|
|
68174
|
+
* Whether `value` is a node.
|
|
67336
68175
|
*/
|
|
67337
|
-
function
|
|
67338
|
-
return '
|
|
68176
|
+
function mdast_util_to_string_lib_node(value) {
|
|
68177
|
+
return Boolean(value && typeof value === 'object')
|
|
67339
68178
|
}
|
|
67340
68179
|
|
|
67341
|
-
;// ../node_modules/mdast-util-to-markdown/lib/util/format-
|
|
68180
|
+
;// ../node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
|
|
67342
68181
|
/**
|
|
67343
68182
|
* @import {State} from 'mdast-util-to-markdown'
|
|
67344
|
-
* @import {
|
|
68183
|
+
* @import {Heading} from 'mdast'
|
|
67345
68184
|
*/
|
|
67346
68185
|
|
|
67347
68186
|
|
|
67348
68187
|
|
|
68188
|
+
|
|
67349
68189
|
/**
|
|
67350
|
-
* Checks if a
|
|
68190
|
+
* Checks if a heading can be formatted as a setext heading.
|
|
67351
68191
|
*
|
|
67352
|
-
* @param {
|
|
68192
|
+
* @param {Heading} node
|
|
67353
68193
|
* Node to check.
|
|
67354
68194
|
* @param {State} state
|
|
67355
68195
|
* Info passed around.
|
|
67356
68196
|
* @returns {boolean}
|
|
67357
|
-
* Whether the
|
|
68197
|
+
* Whether the heading can be formatted as a setext heading.
|
|
67358
68198
|
*/
|
|
67359
|
-
function
|
|
67360
|
-
|
|
68199
|
+
function formatHeadingAsSetext(node, state) {
|
|
68200
|
+
let literalWithBreak = false
|
|
68201
|
+
|
|
68202
|
+
// Look for literals with a line break.
|
|
68203
|
+
// Note that this also
|
|
68204
|
+
visit(node, function (node) {
|
|
68205
|
+
if (
|
|
68206
|
+
('value' in node && /\r?\n|\r/.test(node.value)) ||
|
|
68207
|
+
node.type === 'break'
|
|
68208
|
+
) {
|
|
68209
|
+
literalWithBreak = true
|
|
68210
|
+
return (/* inlined export .EXIT */false)
|
|
68211
|
+
}
|
|
68212
|
+
})
|
|
67361
68213
|
|
|
67362
68214
|
return Boolean(
|
|
67363
|
-
!
|
|
67364
|
-
|
|
67365
|
-
|
|
67366
|
-
// And there’s no title…
|
|
67367
|
-
!node.title &&
|
|
67368
|
-
// And the content of `node` is a single text node…
|
|
67369
|
-
node.children &&
|
|
67370
|
-
node.children.length === 1 &&
|
|
67371
|
-
node.children[0].type === 'text' &&
|
|
67372
|
-
// And if the url is the same as the content…
|
|
67373
|
-
(raw === node.url || 'mailto:' + raw === node.url) &&
|
|
67374
|
-
// And that starts w/ a protocol…
|
|
67375
|
-
/^[a-z][+\-.a-z]+:/i.test(node.url) &&
|
|
67376
|
-
// And that doesn’t contain ASCII control codes (character escapes and
|
|
67377
|
-
// references don’t work), space, or angle brackets…
|
|
67378
|
-
!/[\0- <>\u007F]/.test(node.url)
|
|
68215
|
+
(!node.depth || node.depth < 3) &&
|
|
68216
|
+
node_modules_mdast_util_to_string_lib_toString(node) &&
|
|
68217
|
+
(state.options.setext || literalWithBreak)
|
|
67379
68218
|
)
|
|
67380
68219
|
}
|
|
67381
68220
|
|
|
67382
|
-
;// ../node_modules/mdast-util-to-markdown/lib/handle/
|
|
68221
|
+
;// ../node_modules/mdast-util-to-markdown/lib/handle/heading.js
|
|
67383
68222
|
/**
|
|
67384
68223
|
* @import {Info, State} from 'mdast-util-to-markdown'
|
|
67385
|
-
* @import {
|
|
67386
|
-
* @import {Exit} from '../types.js'
|
|
68224
|
+
* @import {Heading, Parents} from 'mdast'
|
|
67387
68225
|
*/
|
|
67388
68226
|
|
|
67389
68227
|
|
|
67390
68228
|
|
|
67391
68229
|
|
|
67392
|
-
handle_link_link.peek = linkPeek
|
|
67393
|
-
|
|
67394
68230
|
/**
|
|
67395
|
-
* Serialize a
|
|
68231
|
+
* Serialize a heading node.
|
|
67396
68232
|
*
|
|
67397
|
-
* @param {
|
|
68233
|
+
* @param {Heading} node
|
|
67398
68234
|
* Node to serialize.
|
|
67399
68235
|
* @param {Parents | undefined} _
|
|
67400
68236
|
* Parent node.
|
|
@@ -67405,47 +68241,134 @@ handle_link_link.peek = linkPeek
|
|
|
67405
68241
|
* @returns {string}
|
|
67406
68242
|
* Serialized markdown.
|
|
67407
68243
|
*/
|
|
67408
|
-
function
|
|
67409
|
-
const
|
|
67410
|
-
const suffix = quote === '"' ? 'Quote' : 'Apostrophe'
|
|
68244
|
+
function heading_heading(node, _, state, info) {
|
|
68245
|
+
const rank = Math.max(Math.min(6, node.depth || 1), 1)
|
|
67411
68246
|
const tracker = state.createTracker(info)
|
|
67412
68247
|
|
|
67413
|
-
if (
|
|
67414
|
-
|
|
67415
|
-
|
|
67416
|
-
|
|
67417
|
-
|
|
67418
|
-
|
|
67419
|
-
|
|
67420
|
-
state.stack = stack.filter(function (d) {
|
|
67421
|
-
return d !== 'phrasing'
|
|
68248
|
+
if (formatHeadingAsSetext(node, state)) {
|
|
68249
|
+
const exit = state.enter('headingSetext')
|
|
68250
|
+
const subexit = state.enter('phrasing')
|
|
68251
|
+
const value = state.containerPhrasing(node, {
|
|
68252
|
+
...tracker.current(),
|
|
68253
|
+
before: '\n',
|
|
68254
|
+
after: '\n'
|
|
67422
68255
|
})
|
|
67423
|
-
|
|
67424
|
-
let value = tracker.move('<')
|
|
67425
|
-
value += tracker.move(
|
|
67426
|
-
state.containerPhrasing(node, {
|
|
67427
|
-
before: value,
|
|
67428
|
-
after: '>',
|
|
67429
|
-
...tracker.current()
|
|
67430
|
-
})
|
|
67431
|
-
)
|
|
67432
|
-
value += tracker.move('>')
|
|
68256
|
+
subexit()
|
|
67433
68257
|
exit()
|
|
67434
|
-
|
|
67435
|
-
return
|
|
68258
|
+
|
|
68259
|
+
return (
|
|
68260
|
+
value +
|
|
68261
|
+
'\n' +
|
|
68262
|
+
(rank === 1 ? '=' : '-').repeat(
|
|
68263
|
+
// The whole size…
|
|
68264
|
+
value.length -
|
|
68265
|
+
// Minus the position of the character after the last EOL (or
|
|
68266
|
+
// 0 if there is none)…
|
|
68267
|
+
(Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1)
|
|
68268
|
+
)
|
|
68269
|
+
)
|
|
67436
68270
|
}
|
|
67437
68271
|
|
|
67438
|
-
const
|
|
68272
|
+
const sequence = '#'.repeat(rank)
|
|
68273
|
+
const exit = state.enter('headingAtx')
|
|
68274
|
+
const subexit = state.enter('phrasing')
|
|
68275
|
+
|
|
68276
|
+
// Note: for proper tracking, we should reset the output positions when there
|
|
68277
|
+
// is no content returned, because then the space is not output.
|
|
68278
|
+
// Practically, in that case, there is no content, so it doesn’t matter that
|
|
68279
|
+
// we’ve tracked one too many characters.
|
|
68280
|
+
tracker.move(sequence + ' ')
|
|
68281
|
+
|
|
68282
|
+
let value = state.containerPhrasing(node, {
|
|
68283
|
+
before: '# ',
|
|
68284
|
+
after: '\n',
|
|
68285
|
+
...tracker.current()
|
|
68286
|
+
})
|
|
68287
|
+
|
|
68288
|
+
const head = value.charCodeAt(0)
|
|
68289
|
+
|
|
68290
|
+
if (head === 9 /* `\t` */ || head === 32 /* ` ` */) {
|
|
68291
|
+
// To do: what effect has the character reference on tracking?
|
|
68292
|
+
value = encodeCharacterReference(head) + value.slice(1)
|
|
68293
|
+
}
|
|
68294
|
+
|
|
68295
|
+
value = value ? sequence + ' ' + value : sequence
|
|
68296
|
+
|
|
68297
|
+
if (state.options.closeAtx) {
|
|
68298
|
+
value += ' ' + sequence
|
|
68299
|
+
}
|
|
68300
|
+
|
|
68301
|
+
subexit()
|
|
68302
|
+
exit()
|
|
68303
|
+
|
|
68304
|
+
return value
|
|
68305
|
+
}
|
|
68306
|
+
|
|
68307
|
+
;// ../node_modules/mdast-util-to-markdown/lib/handle/html.js
|
|
68308
|
+
/**
|
|
68309
|
+
* @import {Html} from 'mdast'
|
|
68310
|
+
*/
|
|
68311
|
+
|
|
68312
|
+
handle_html_html.peek = htmlPeek
|
|
68313
|
+
|
|
68314
|
+
/**
|
|
68315
|
+
* Serialize an HTML node.
|
|
68316
|
+
*
|
|
68317
|
+
* @param {Html} node
|
|
68318
|
+
* Node to serialize.
|
|
68319
|
+
* @returns {string}
|
|
68320
|
+
* Serialized markdown.
|
|
68321
|
+
*/
|
|
68322
|
+
function handle_html_html(node) {
|
|
68323
|
+
return node.value || ''
|
|
68324
|
+
}
|
|
68325
|
+
|
|
68326
|
+
/**
|
|
68327
|
+
* Peek at this node.
|
|
68328
|
+
*
|
|
68329
|
+
* @returns {string}
|
|
68330
|
+
* Start of the serialized markdown.
|
|
68331
|
+
*/
|
|
68332
|
+
function htmlPeek() {
|
|
68333
|
+
return '<'
|
|
68334
|
+
}
|
|
68335
|
+
|
|
68336
|
+
;// ../node_modules/mdast-util-to-markdown/lib/handle/image.js
|
|
68337
|
+
/**
|
|
68338
|
+
* @import {Info, State} from 'mdast-util-to-markdown'
|
|
68339
|
+
* @import {Image, Parents} from 'mdast'
|
|
68340
|
+
*/
|
|
68341
|
+
|
|
68342
|
+
|
|
68343
|
+
|
|
68344
|
+
handle_image_image.peek = imagePeek
|
|
68345
|
+
|
|
68346
|
+
/**
|
|
68347
|
+
* Serialize an image node.
|
|
68348
|
+
*
|
|
68349
|
+
* @param {Image} node
|
|
68350
|
+
* Node to serialize.
|
|
68351
|
+
* @param {Parents | undefined} _
|
|
68352
|
+
* Parent node.
|
|
68353
|
+
* @param {State} state
|
|
68354
|
+
* Info passed around.
|
|
68355
|
+
* @param {Info} info
|
|
68356
|
+
* Info on surrounding context.
|
|
68357
|
+
* @returns {string}
|
|
68358
|
+
* Serialized markdown.
|
|
68359
|
+
*/
|
|
68360
|
+
function handle_image_image(node, _, state, info) {
|
|
68361
|
+
const quote = checkQuote(state)
|
|
68362
|
+
const suffix = quote === '"' ? 'Quote' : 'Apostrophe'
|
|
68363
|
+
const exit = state.enter('image')
|
|
67439
68364
|
let subexit = state.enter('label')
|
|
67440
|
-
|
|
68365
|
+
const tracker = state.createTracker(info)
|
|
68366
|
+
let value = tracker.move('
|
|
67446
|
-
})
|
|
68368
|
+
state.safe(node.alt, {before: value, after: ']', ...tracker.current()})
|
|
67447
68369
|
)
|
|
67448
68370
|
value += tracker.move('](')
|
|
68371
|
+
|
|
67449
68372
|
subexit()
|
|
67450
68373
|
|
|
67451
68374
|
if (
|
|
@@ -67488,6 +68411,375 @@ function handle_link_link(node, _, state, info) {
|
|
|
67488
68411
|
subexit()
|
|
67489
68412
|
}
|
|
67490
68413
|
|
|
68414
|
+
value += tracker.move(')')
|
|
68415
|
+
exit()
|
|
68416
|
+
|
|
68417
|
+
return value
|
|
68418
|
+
}
|
|
68419
|
+
|
|
68420
|
+
/**
|
|
68421
|
+
* Peek at this node.
|
|
68422
|
+
*
|
|
68423
|
+
* @returns {string}
|
|
68424
|
+
* Start of the serialized markdown.
|
|
68425
|
+
*/
|
|
68426
|
+
function imagePeek() {
|
|
68427
|
+
return '!'
|
|
68428
|
+
}
|
|
68429
|
+
|
|
68430
|
+
;// ../node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
|
|
68431
|
+
/**
|
|
68432
|
+
* @import {Info, State} from 'mdast-util-to-markdown'
|
|
68433
|
+
* @import {ImageReference, Parents} from 'mdast'
|
|
68434
|
+
*/
|
|
68435
|
+
|
|
68436
|
+
image_reference_imageReference.peek = imageReferencePeek
|
|
68437
|
+
|
|
68438
|
+
/**
|
|
68439
|
+
* Serialize an image reference node.
|
|
68440
|
+
*
|
|
68441
|
+
* @param {ImageReference} node
|
|
68442
|
+
* Node to serialize.
|
|
68443
|
+
* @param {Parents | undefined} _
|
|
68444
|
+
* Parent node.
|
|
68445
|
+
* @param {State} state
|
|
68446
|
+
* Info passed around.
|
|
68447
|
+
* @param {Info} info
|
|
68448
|
+
* Info on surrounding context.
|
|
68449
|
+
* @returns {string}
|
|
68450
|
+
* Serialized markdown.
|
|
68451
|
+
*/
|
|
68452
|
+
function image_reference_imageReference(node, _, state, info) {
|
|
68453
|
+
const type = node.referenceType
|
|
68454
|
+
const exit = state.enter('imageReference')
|
|
68455
|
+
let subexit = state.enter('label')
|
|
68456
|
+
const tracker = state.createTracker(info)
|
|
68457
|
+
let value = tracker.move('![')
|
|
68458
|
+
const alt = state.safe(node.alt, {
|
|
68459
|
+
before: value,
|
|
68460
|
+
after: ']',
|
|
68461
|
+
...tracker.current()
|
|
68462
|
+
})
|
|
68463
|
+
value += tracker.move(alt + '][')
|
|
68464
|
+
|
|
68465
|
+
subexit()
|
|
68466
|
+
// Hide that we’re in phrasing as things like attention or code cannot form
|
|
68467
|
+
// in references.
|
|
68468
|
+
// Character escapes and references *do* work.
|
|
68469
|
+
// It is important to know about other constructs, such as table cells.
|
|
68470
|
+
const stack = state.stack
|
|
68471
|
+
state.stack = stack.filter(function (d) {
|
|
68472
|
+
return d !== 'phrasing'
|
|
68473
|
+
})
|
|
68474
|
+
subexit = state.enter('reference')
|
|
68475
|
+
// Note: for proper tracking, we should reset the output positions when we end
|
|
68476
|
+
// up making a `shortcut` reference, because then there is no brace output.
|
|
68477
|
+
// Practically, in that case, there is no content, so it doesn’t matter that
|
|
68478
|
+
// we’ve tracked one too many characters.
|
|
68479
|
+
const reference = state.safe(state.associationId(node), {
|
|
68480
|
+
before: value,
|
|
68481
|
+
after: ']',
|
|
68482
|
+
...tracker.current()
|
|
68483
|
+
})
|
|
68484
|
+
subexit()
|
|
68485
|
+
state.stack = stack
|
|
68486
|
+
exit()
|
|
68487
|
+
|
|
68488
|
+
if (type === 'full' || !alt || alt !== reference) {
|
|
68489
|
+
value += tracker.move(reference + ']')
|
|
68490
|
+
} else if (type === 'shortcut') {
|
|
68491
|
+
// Remove the unwanted `[`.
|
|
68492
|
+
value = value.slice(0, -1)
|
|
68493
|
+
} else {
|
|
68494
|
+
value += tracker.move(']')
|
|
68495
|
+
}
|
|
68496
|
+
|
|
68497
|
+
return value
|
|
68498
|
+
}
|
|
68499
|
+
|
|
68500
|
+
/**
|
|
68501
|
+
* Peek at this node.
|
|
68502
|
+
*
|
|
68503
|
+
* @returns {string}
|
|
68504
|
+
* Start of the serialized markdown.
|
|
68505
|
+
*/
|
|
68506
|
+
function imageReferencePeek() {
|
|
68507
|
+
return '!'
|
|
68508
|
+
}
|
|
68509
|
+
|
|
68510
|
+
;// ../node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
|
|
68511
|
+
/**
|
|
68512
|
+
* @import {State} from 'mdast-util-to-markdown'
|
|
68513
|
+
* @import {InlineCode, Parents} from 'mdast'
|
|
68514
|
+
*/
|
|
68515
|
+
|
|
68516
|
+
inline_code_inlineCode.peek = inlineCodePeek
|
|
68517
|
+
|
|
68518
|
+
/**
|
|
68519
|
+
* Serialize an inline code node.
|
|
68520
|
+
*
|
|
68521
|
+
* @param {InlineCode} node
|
|
68522
|
+
* Node to serialize.
|
|
68523
|
+
* @param {Parents | undefined} _
|
|
68524
|
+
* Parent node.
|
|
68525
|
+
* @param {State} state
|
|
68526
|
+
* Info passed around.
|
|
68527
|
+
* @returns {string}
|
|
68528
|
+
* Serialized markdown.
|
|
68529
|
+
*/
|
|
68530
|
+
function inline_code_inlineCode(node, _, state) {
|
|
68531
|
+
let value = node.value || ''
|
|
68532
|
+
let sequence = '`'
|
|
68533
|
+
let index = -1
|
|
68534
|
+
|
|
68535
|
+
// If there is a single grave accent on its own in the code, use a fence of
|
|
68536
|
+
// two.
|
|
68537
|
+
// If there are two in a row, use one.
|
|
68538
|
+
while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {
|
|
68539
|
+
sequence += '`'
|
|
68540
|
+
}
|
|
68541
|
+
|
|
68542
|
+
// If this is not just spaces or eols (tabs don’t count), and either the
|
|
68543
|
+
// first or last character are a space, eol, or tick, then pad with spaces.
|
|
68544
|
+
if (
|
|
68545
|
+
/[^\n\r ]/.test(value) &&
|
|
68546
|
+
((/^[\n\r ]/.test(value) && /[\n\r ]$/.test(value)) || /^`|`$/.test(value))
|
|
68547
|
+
) {
|
|
68548
|
+
value = ' ' + value + ' '
|
|
68549
|
+
}
|
|
68550
|
+
|
|
68551
|
+
// We have a potential problem: certain characters after eols could result in
|
|
68552
|
+
// blocks being seen.
|
|
68553
|
+
// For example, if someone injected the string `'\n# b'`, then that would
|
|
68554
|
+
// result in an ATX heading.
|
|
68555
|
+
// We can’t escape characters in `inlineCode`, but because eols are
|
|
68556
|
+
// transformed to spaces when going from markdown to HTML anyway, we can swap
|
|
68557
|
+
// them out.
|
|
68558
|
+
while (++index < state.unsafe.length) {
|
|
68559
|
+
const pattern = state.unsafe[index]
|
|
68560
|
+
const expression = state.compilePattern(pattern)
|
|
68561
|
+
|
|
68562
|
+
// Only look for `atBreak`s.
|
|
68563
|
+
// Btw: note that `atBreak` patterns will always start the regex at LF or
|
|
68564
|
+
// CR.
|
|
68565
|
+
if (!pattern.atBreak) continue
|
|
68566
|
+
|
|
68567
|
+
/** @type {RegExpExecArray | null} */
|
|
68568
|
+
let match
|
|
68569
|
+
|
|
68570
|
+
while ((match = expression.exec(value))) {
|
|
68571
|
+
let position = match.index
|
|
68572
|
+
|
|
68573
|
+
// Support CRLF (patterns only look for one of the characters).
|
|
68574
|
+
if (
|
|
68575
|
+
value.charCodeAt(position) === 10 /* `\n` */ &&
|
|
68576
|
+
value.charCodeAt(position - 1) === 13 /* `\r` */
|
|
68577
|
+
) {
|
|
68578
|
+
position--
|
|
68579
|
+
}
|
|
68580
|
+
|
|
68581
|
+
value = value.slice(0, position) + ' ' + value.slice(match.index + 1)
|
|
68582
|
+
}
|
|
68583
|
+
}
|
|
68584
|
+
|
|
68585
|
+
return sequence + value + sequence
|
|
68586
|
+
}
|
|
68587
|
+
|
|
68588
|
+
/**
|
|
68589
|
+
* Peek at this node.
|
|
68590
|
+
*
|
|
68591
|
+
* @returns {string}
|
|
68592
|
+
* Start of the serialized markdown.
|
|
68593
|
+
*/
|
|
68594
|
+
function inlineCodePeek() {
|
|
68595
|
+
return '`'
|
|
68596
|
+
}
|
|
68597
|
+
|
|
68598
|
+
;// ../node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
|
|
68599
|
+
/**
|
|
68600
|
+
* @import {State} from 'mdast-util-to-markdown'
|
|
68601
|
+
* @import {Link} from 'mdast'
|
|
68602
|
+
*/
|
|
68603
|
+
|
|
68604
|
+
|
|
68605
|
+
|
|
68606
|
+
/**
|
|
68607
|
+
* Checks if a link can be formatted as an autolink.
|
|
68608
|
+
*
|
|
68609
|
+
* @param {Link} node
|
|
68610
|
+
* Node to check.
|
|
68611
|
+
* @param {State} state
|
|
68612
|
+
* Info passed around.
|
|
68613
|
+
* @returns {boolean}
|
|
68614
|
+
* Whether the link can be formatted as an autolink.
|
|
68615
|
+
*/
|
|
68616
|
+
function formatLinkAsAutolink(node, state) {
|
|
68617
|
+
const raw = node_modules_mdast_util_to_string_lib_toString(node)
|
|
68618
|
+
|
|
68619
|
+
return Boolean(
|
|
68620
|
+
!state.options.resourceLink &&
|
|
68621
|
+
// If there’s a url…
|
|
68622
|
+
node.url &&
|
|
68623
|
+
// And there’s no title…
|
|
68624
|
+
!node.title &&
|
|
68625
|
+
// And the content of `node` is a single text node…
|
|
68626
|
+
node.children &&
|
|
68627
|
+
node.children.length === 1 &&
|
|
68628
|
+
node.children[0].type === 'text' &&
|
|
68629
|
+
// And if the url is the same as the content…
|
|
68630
|
+
(raw === node.url || 'mailto:' + raw === node.url) &&
|
|
68631
|
+
// And that starts w/ a protocol…
|
|
68632
|
+
/^[a-z][+\-.a-z]+:/i.test(node.url) &&
|
|
68633
|
+
// And that doesn’t contain ASCII control codes (character escapes and
|
|
68634
|
+
// references don’t work), space, or angle brackets…
|
|
68635
|
+
!/[\0- <>\u007F]/.test(node.url)
|
|
68636
|
+
)
|
|
68637
|
+
}
|
|
68638
|
+
|
|
68639
|
+
;// ../node_modules/mdast-util-to-markdown/lib/handle/link.js
|
|
68640
|
+
/**
|
|
68641
|
+
* @import {Info, State} from 'mdast-util-to-markdown'
|
|
68642
|
+
* @import {Link, Parents} from 'mdast'
|
|
68643
|
+
* @import {Exit} from '../types.js'
|
|
68644
|
+
*/
|
|
68645
|
+
|
|
68646
|
+
|
|
68647
|
+
|
|
68648
|
+
|
|
68649
|
+
handle_link_link.peek = linkPeek
|
|
68650
|
+
|
|
68651
|
+
/**
|
|
68652
|
+
* Serialize a link node.
|
|
68653
|
+
*
|
|
68654
|
+
* @param {Link} node
|
|
68655
|
+
* Node to serialize.
|
|
68656
|
+
* @param {Parents | undefined} _
|
|
68657
|
+
* Parent node.
|
|
68658
|
+
* @param {State} state
|
|
68659
|
+
* Info passed around.
|
|
68660
|
+
* @param {Info} info
|
|
68661
|
+
* Info on surrounding context.
|
|
68662
|
+
* @returns {string}
|
|
68663
|
+
* Serialized markdown.
|
|
68664
|
+
*/
|
|
68665
|
+
function handle_link_link(node, _, state, info) {
|
|
68666
|
+
const quote = checkQuote(state)
|
|
68667
|
+
const suffix = quote === '"' ? 'Quote' : 'Apostrophe'
|
|
68668
|
+
const tracker = state.createTracker(info)
|
|
68669
|
+
|
|
68670
|
+
if (formatLinkAsAutolink(node, state)) {
|
|
68671
|
+
// Hide that we’re in phrasing as things like attention or code cannot form
|
|
68672
|
+
// in autolinks.
|
|
68673
|
+
// Character escapes also don’t work (nor character references),
|
|
68674
|
+
// but that is a different matter, which `safe.js` handles for `autolink`.
|
|
68675
|
+
// It is important to know about other constructs, such as table cells.
|
|
68676
|
+
const stack = state.stack
|
|
68677
|
+
state.stack = stack.filter(function (d) {
|
|
68678
|
+
return d !== 'phrasing'
|
|
68679
|
+
})
|
|
68680
|
+
const exit = state.enter('autolink')
|
|
68681
|
+
let value = tracker.move('<')
|
|
68682
|
+
value += tracker.move(
|
|
68683
|
+
state.containerPhrasing(node, {
|
|
68684
|
+
before: value,
|
|
68685
|
+
after: '>',
|
|
68686
|
+
...tracker.current()
|
|
68687
|
+
})
|
|
68688
|
+
)
|
|
68689
|
+
value += tracker.move('>')
|
|
68690
|
+
exit()
|
|
68691
|
+
state.stack = stack
|
|
68692
|
+
return value
|
|
68693
|
+
}
|
|
68694
|
+
|
|
68695
|
+
const exit = state.enter('link')
|
|
68696
|
+
let subexit = state.enter('label')
|
|
68697
|
+
let value = tracker.move('[')
|
|
68698
|
+
const text = state.containerPhrasing(node, {
|
|
68699
|
+
before: value,
|
|
68700
|
+
after: '](',
|
|
68701
|
+
...tracker.current()
|
|
68702
|
+
})
|
|
68703
|
+
value += tracker.move(text)
|
|
68704
|
+
subexit()
|
|
68705
|
+
value += tracker.move('](')
|
|
68706
|
+
|
|
68707
|
+
// A link could accidentally turn into a definition in certain contexts:
|
|
68708
|
+
// at the start of a line, without title, when its text has a `]` that
|
|
68709
|
+
// cannot be escaped (such as in code).
|
|
68710
|
+
//
|
|
68711
|
+
// We can prevent that with an empty title:
|
|
68712
|
+
//
|
|
68713
|
+
// ```
|
|
68714
|
+
// [`a]:`](b)
|
|
68715
|
+
// ```
|
|
68716
|
+
//
|
|
68717
|
+
// …is a definition with `` `](b) `` as its destination.
|
|
68718
|
+
//
|
|
68719
|
+
// Using:
|
|
68720
|
+
//
|
|
68721
|
+
// ```
|
|
68722
|
+
// [`a]:`](b "")
|
|
68723
|
+
// ```
|
|
68724
|
+
//
|
|
68725
|
+
// …instead fixes it.
|
|
68726
|
+
//
|
|
68727
|
+
// Control characters or whitespace in the url need an enclosed destination,
|
|
68728
|
+
// which also prevents this.
|
|
68729
|
+
const enclose = /[\0- \u007F]/.test(node.url)
|
|
68730
|
+
const last = info.before.charAt(info.before.length - 1)
|
|
68731
|
+
let title = node.title || undefined
|
|
68732
|
+
|
|
68733
|
+
if (!title && !enclose && (last === '\n' || last === '\r')) {
|
|
68734
|
+
let index = 0
|
|
68735
|
+
|
|
68736
|
+
while (index < text.length && text.charCodeAt(index) !== 93 /* `]` */) {
|
|
68737
|
+
index += text.charCodeAt(index) === 92 /* `\` */ ? 2 : 1
|
|
68738
|
+
}
|
|
68739
|
+
|
|
68740
|
+
if (text.charCodeAt(index + 1) === 58 /* `:` */) title = ''
|
|
68741
|
+
}
|
|
68742
|
+
|
|
68743
|
+
if (
|
|
68744
|
+
// If there’s no url but there is a title…
|
|
68745
|
+
(!node.url && typeof title === 'string') ||
|
|
68746
|
+
// If there are control characters or whitespace.
|
|
68747
|
+
enclose
|
|
68748
|
+
) {
|
|
68749
|
+
subexit = state.enter('destinationLiteral')
|
|
68750
|
+
value += tracker.move('<')
|
|
68751
|
+
value += tracker.move(
|
|
68752
|
+
state.safe(node.url, {before: value, after: '>', ...tracker.current()})
|
|
68753
|
+
)
|
|
68754
|
+
value += tracker.move('>')
|
|
68755
|
+
} else {
|
|
68756
|
+
// No whitespace, raw is prettier.
|
|
68757
|
+
subexit = state.enter('destinationRaw')
|
|
68758
|
+
value += tracker.move(
|
|
68759
|
+
state.safe(node.url, {
|
|
68760
|
+
before: value,
|
|
68761
|
+
after: typeof title === 'string' ? ' ' : ')',
|
|
68762
|
+
...tracker.current()
|
|
68763
|
+
})
|
|
68764
|
+
)
|
|
68765
|
+
}
|
|
68766
|
+
|
|
68767
|
+
subexit()
|
|
68768
|
+
|
|
68769
|
+
if (typeof title === 'string') {
|
|
68770
|
+
subexit = state.enter(`title${suffix}`)
|
|
68771
|
+
value += tracker.move(' ' + quote)
|
|
68772
|
+
value += tracker.move(
|
|
68773
|
+
state.safe(title, {
|
|
68774
|
+
before: value,
|
|
68775
|
+
after: quote,
|
|
68776
|
+
...tracker.current()
|
|
68777
|
+
})
|
|
68778
|
+
)
|
|
68779
|
+
value += tracker.move(quote)
|
|
68780
|
+
subexit()
|
|
68781
|
+
}
|
|
68782
|
+
|
|
67491
68783
|
value += tracker.move(')')
|
|
67492
68784
|
|
|
67493
68785
|
exit()
|
|
@@ -67974,7 +69266,7 @@ function paragraph_paragraph(node, _, state, info) {
|
|
|
67974
69266
|
* Whether `value` is phrasing content.
|
|
67975
69267
|
*/
|
|
67976
69268
|
|
|
67977
|
-
const
|
|
69269
|
+
const lib_phrasing =
|
|
67978
69270
|
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
|
|
67979
69271
|
(
|
|
67980
69272
|
convert([
|
|
@@ -68027,7 +69319,7 @@ const phrasing =
|
|
|
68027
69319
|
function handle_root_root(node, _, state, info) {
|
|
68028
69320
|
// Note: `html` nodes are ambiguous.
|
|
68029
69321
|
const hasPhrasing = node.children.some(function (d) {
|
|
68030
|
-
return
|
|
69322
|
+
return lib_phrasing(d)
|
|
68031
69323
|
})
|
|
68032
69324
|
|
|
68033
69325
|
if (!hasPhrasing) return state.containerFlow(node, info)
|
|
@@ -68073,6 +69365,7 @@ function checkStrong(state) {
|
|
|
68073
69365
|
|
|
68074
69366
|
|
|
68075
69367
|
|
|
69368
|
+
|
|
68076
69369
|
strong_strong.attention = strong_attention
|
|
68077
69370
|
strong_strong.peek = strong_peek
|
|
68078
69371
|
|
|
@@ -68094,7 +69387,8 @@ strong_strong.peek = strong_peek
|
|
|
68094
69387
|
*/
|
|
68095
69388
|
function strong_strong(node, _, state, info) {
|
|
68096
69389
|
const exit = state.enter('phrasing')
|
|
68097
|
-
const
|
|
69390
|
+
const item = attentionItem(node, strong_attention, state, state.createTracker(info))
|
|
69391
|
+
const value = container_phrasing_serialize([item], info.before, info.after)
|
|
68098
69392
|
exit()
|
|
68099
69393
|
return value
|
|
68100
69394
|
}
|
|
@@ -68157,7 +69451,7 @@ function strong_peek(_, _1, state) {
|
|
|
68157
69451
|
function handle_text_text(node, parent, state, info) {
|
|
68158
69452
|
/* c8 ignore next -- parent always passed */
|
|
68159
69453
|
const siblings = parent ? parent.children : []
|
|
68160
|
-
const index =
|
|
69454
|
+
const index = state.indexStack[state.indexStack.length - 1]
|
|
68161
69455
|
|
|
68162
69456
|
return state.safe(node.value, {
|
|
68163
69457
|
...info,
|
|
@@ -71392,7 +72686,7 @@ function micromark_extension_gfm_strikethrough_node_modules_micromark_util_chara
|
|
|
71392
72686
|
* @returns {typeof constants.characterGroupWhitespace | typeof constants.characterGroupPunctuation | undefined}
|
|
71393
72687
|
* Group.
|
|
71394
72688
|
*/
|
|
71395
|
-
function
|
|
72689
|
+
function node_modules_micromark_util_classify_character_classifyCharacter(code) {
|
|
71396
72690
|
if (code === null || micromark_extension_gfm_strikethrough_node_modules_micromark_util_character_markdownLineEndingOrSpace(code) || micromark_extension_gfm_strikethrough_node_modules_micromark_util_character_unicodeWhitespace(code)) {
|
|
71397
72691
|
return 1;
|
|
71398
72692
|
}
|
|
@@ -71560,7 +72854,7 @@ function gfmStrikethrough(options) {
|
|
|
71560
72854
|
|
|
71561
72855
|
/** @type {State} */
|
|
71562
72856
|
function more(code) {
|
|
71563
|
-
const before =
|
|
72857
|
+
const before = node_modules_micromark_util_classify_character_classifyCharacter(previous);
|
|
71564
72858
|
if (code === 126) {
|
|
71565
72859
|
// If this is the third marker, exit.
|
|
71566
72860
|
if (size > 1) return nok(code);
|
|
@@ -71570,7 +72864,7 @@ function gfmStrikethrough(options) {
|
|
|
71570
72864
|
}
|
|
71571
72865
|
if (size < 2 && !single) return nok(code);
|
|
71572
72866
|
const token = effects.exit('strikethroughSequenceTemporary');
|
|
71573
|
-
const after =
|
|
72867
|
+
const after = node_modules_micromark_util_classify_character_classifyCharacter(code);
|
|
71574
72868
|
token._open = !after || after === 2 && Boolean(before);
|
|
71575
72869
|
token._close = !before || before === 2 && Boolean(after);
|
|
71576
72870
|
return ok(code);
|
|
@@ -74854,15 +76148,6 @@ var defaultRehypePlugins = [rehypeSlug, rehypeAutolinkHeadings, rehype_ignore_li
|
|
|
74854
76148
|
ref: ref
|
|
74855
76149
|
}));
|
|
74856
76150
|
}));
|
|
74857
|
-
;// ../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js
|
|
74858
|
-
function _taggedTemplateLiteral(e, t) {
|
|
74859
|
-
return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, {
|
|
74860
|
-
raw: {
|
|
74861
|
-
value: Object.freeze(t)
|
|
74862
|
-
}
|
|
74863
|
-
}));
|
|
74864
|
-
}
|
|
74865
|
-
|
|
74866
76151
|
;// ../node_modules/hast-util-from-html/lib/errors.js
|
|
74867
76152
|
/**
|
|
74868
76153
|
* @typedef ErrorInfo
|
|
@@ -76094,7 +77379,7 @@ const commentEntitySubset = ['<', '>']
|
|
|
76094
77379
|
* @param {Comment} node
|
|
76095
77380
|
* Node to handle.
|
|
76096
77381
|
* @param {number | undefined} _1
|
|
76097
|
-
* Index of `node` in `parent
|
|
77382
|
+
* Index of `node` in `parent`.
|
|
76098
77383
|
* @param {Parents | undefined} _2
|
|
76099
77384
|
* Parent of `node`.
|
|
76100
77385
|
* @param {State} state
|
|
@@ -76116,7 +77401,12 @@ function comment_comment(node, _1, _2, state) {
|
|
|
76116
77401
|
: '<!--' + node.value.replace(htmlCommentRegex, encode) + '-->'
|
|
76117
77402
|
|
|
76118
77403
|
/**
|
|
77404
|
+
* Encode a dangerous character.
|
|
77405
|
+
*
|
|
76119
77406
|
* @param {string} $0
|
|
77407
|
+
* Character.
|
|
77408
|
+
* @returns {string}
|
|
77409
|
+
* Encoded character.
|
|
76120
77410
|
*/
|
|
76121
77411
|
function encode($0) {
|
|
76122
77412
|
return stringifyEntities(
|
|
@@ -76140,7 +77430,7 @@ function comment_comment(node, _1, _2, state) {
|
|
|
76140
77430
|
* @param {Doctype} _1
|
|
76141
77431
|
* Node to handle.
|
|
76142
77432
|
* @param {number | undefined} _2
|
|
76143
|
-
* Index of `node` in `parent
|
|
77433
|
+
* Index of `node` in `parent`.
|
|
76144
77434
|
* @param {Parents | undefined} _3
|
|
76145
77435
|
* Parent of `node`.
|
|
76146
77436
|
* @param {State} state
|
|
@@ -76174,6 +77464,9 @@ const emptyChildren = []
|
|
|
76174
77464
|
* Factory to check siblings in a direction.
|
|
76175
77465
|
*
|
|
76176
77466
|
* @param {number} increment
|
|
77467
|
+
* Direction.
|
|
77468
|
+
* @returns {typeof sibling}
|
|
77469
|
+
* Check.
|
|
76177
77470
|
*/
|
|
76178
77471
|
function siblings(increment) {
|
|
76179
77472
|
return sibling
|
|
@@ -76225,7 +77518,6 @@ function siblings(increment) {
|
|
|
76225
77518
|
* Parent of element.
|
|
76226
77519
|
* @returns {boolean}
|
|
76227
77520
|
* Whether to omit a tag.
|
|
76228
|
-
*
|
|
76229
77521
|
*/
|
|
76230
77522
|
|
|
76231
77523
|
const omission_own = {}.hasOwnProperty
|
|
@@ -76397,7 +77689,9 @@ function closing_p(_, index, parent) {
|
|
|
76397
77689
|
parent.tagName === 'ins' ||
|
|
76398
77690
|
parent.tagName === 'map' ||
|
|
76399
77691
|
parent.tagName === 'noscript' ||
|
|
76400
|
-
parent.tagName === 'video'
|
|
77692
|
+
parent.tagName === 'video' ||
|
|
77693
|
+
// Custom element.
|
|
77694
|
+
parent.tagName.includes('-'))
|
|
76401
77695
|
)
|
|
76402
77696
|
}
|
|
76403
77697
|
|
|
@@ -76434,8 +77728,8 @@ function dt(_, index, parent) {
|
|
|
76434
77728
|
const next = siblingAfter(parent, index)
|
|
76435
77729
|
return Boolean(
|
|
76436
77730
|
next &&
|
|
76437
|
-
|
|
76438
|
-
|
|
77731
|
+
next.type === 'element' &&
|
|
77732
|
+
(next.tagName === 'dt' || next.tagName === 'dd')
|
|
76439
77733
|
)
|
|
76440
77734
|
}
|
|
76441
77735
|
|
|
@@ -76535,8 +77829,8 @@ function thead(_, index, parent) {
|
|
|
76535
77829
|
const next = siblingAfter(parent, index)
|
|
76536
77830
|
return Boolean(
|
|
76537
77831
|
next &&
|
|
76538
|
-
|
|
76539
|
-
|
|
77832
|
+
next.type === 'element' &&
|
|
77833
|
+
(next.tagName === 'tbody' || next.tagName === 'tfoot')
|
|
76540
77834
|
)
|
|
76541
77835
|
}
|
|
76542
77836
|
|
|
@@ -76719,7 +78013,6 @@ function opening_body(node) {
|
|
|
76719
78013
|
*/
|
|
76720
78014
|
function colgroup(node, index, parent) {
|
|
76721
78015
|
const previous = siblingBefore(parent, index)
|
|
76722
|
-
const head = siblingAfter(node, -1, true)
|
|
76723
78016
|
|
|
76724
78017
|
// Previous colgroup was already omitted.
|
|
76725
78018
|
if (
|
|
@@ -76732,6 +78025,8 @@ function colgroup(node, index, parent) {
|
|
|
76732
78025
|
return false
|
|
76733
78026
|
}
|
|
76734
78027
|
|
|
78028
|
+
const head = siblingAfter(node, -1, true)
|
|
78029
|
+
|
|
76735
78030
|
return Boolean(head && head.type === 'element' && head.tagName === 'col')
|
|
76736
78031
|
}
|
|
76737
78032
|
|
|
@@ -76749,7 +78044,6 @@ function colgroup(node, index, parent) {
|
|
|
76749
78044
|
*/
|
|
76750
78045
|
function opening_tbody(node, index, parent) {
|
|
76751
78046
|
const previous = siblingBefore(parent, index)
|
|
76752
|
-
const head = siblingAfter(node, -1)
|
|
76753
78047
|
|
|
76754
78048
|
// Previous table section was already omitted.
|
|
76755
78049
|
if (
|
|
@@ -76762,6 +78056,8 @@ function opening_tbody(node, index, parent) {
|
|
|
76762
78056
|
return false
|
|
76763
78057
|
}
|
|
76764
78058
|
|
|
78059
|
+
const head = siblingAfter(node, -1)
|
|
78060
|
+
|
|
76765
78061
|
return Boolean(head && head.type === 'element' && head.tagName === 'tr')
|
|
76766
78062
|
}
|
|
76767
78063
|
|
|
@@ -76811,13 +78107,20 @@ const constants = {
|
|
|
76811
78107
|
]
|
|
76812
78108
|
}
|
|
76813
78109
|
|
|
78110
|
+
/**
|
|
78111
|
+
* SVG elements whose content is HTML.
|
|
78112
|
+
*
|
|
78113
|
+
* @type {ReadonlySet<string>}
|
|
78114
|
+
*/
|
|
78115
|
+
const htmlIntegrationPoints = new Set(['desc', 'foreignObject', 'title'])
|
|
78116
|
+
|
|
76814
78117
|
/**
|
|
76815
78118
|
* Serialize an element node.
|
|
76816
78119
|
*
|
|
76817
78120
|
* @param {Element} node
|
|
76818
78121
|
* Node to handle.
|
|
76819
78122
|
* @param {number | undefined} index
|
|
76820
|
-
* Index of `node` in `parent
|
|
78123
|
+
* Index of `node` in `parent`.
|
|
76821
78124
|
* @param {Parents | undefined} parent
|
|
76822
78125
|
* Parent of `node`.
|
|
76823
78126
|
* @param {State} state
|
|
@@ -76826,7 +78129,7 @@ const constants = {
|
|
|
76826
78129
|
* Serialized node.
|
|
76827
78130
|
*/
|
|
76828
78131
|
function element_element(node, index, parent, state) {
|
|
76829
|
-
const schema = state
|
|
78132
|
+
const {schema} = state
|
|
76830
78133
|
const omit = schema.space === 'svg' ? false : state.settings.omitOptionalTags
|
|
76831
78134
|
let selfClosing =
|
|
76832
78135
|
schema.space === 'svg'
|
|
@@ -76834,8 +78137,6 @@ function element_element(node, index, parent, state) {
|
|
|
76834
78137
|
: state.settings.voids.includes(node.tagName.toLowerCase())
|
|
76835
78138
|
/** @type {Array<string>} */
|
|
76836
78139
|
const parts = []
|
|
76837
|
-
/** @type {string} */
|
|
76838
|
-
let last
|
|
76839
78140
|
|
|
76840
78141
|
if (schema.space === 'html' && node.tagName === 'svg') {
|
|
76841
78142
|
state.schema = property_information_svg
|
|
@@ -76843,6 +78144,12 @@ function element_element(node, index, parent, state) {
|
|
|
76843
78144
|
|
|
76844
78145
|
const attributes = element_serializeAttributes(state, node.properties)
|
|
76845
78146
|
|
|
78147
|
+
// HTML integration points is HTML.
|
|
78148
|
+
// See: <https://html.spec.whatwg.org/#html-integration-point>.
|
|
78149
|
+
if (state.schema.space === 'svg' && htmlIntegrationPoints.has(node.tagName)) {
|
|
78150
|
+
state.schema = property_information_html
|
|
78151
|
+
}
|
|
78152
|
+
|
|
76846
78153
|
const content = state.all(
|
|
76847
78154
|
schema.space === 'html' && node.tagName === 'template' ? node.content : node
|
|
76848
78155
|
)
|
|
@@ -76864,7 +78171,7 @@ function element_element(node, index, parent, state) {
|
|
|
76864
78171
|
selfClosing &&
|
|
76865
78172
|
(schema.space === 'svg' || state.settings.closeSelfClosing)
|
|
76866
78173
|
) {
|
|
76867
|
-
last = attributes.charAt(attributes.length - 1)
|
|
78174
|
+
const last = attributes.charAt(attributes.length - 1)
|
|
76868
78175
|
if (
|
|
76869
78176
|
!state.settings.tightSelfClosing ||
|
|
76870
78177
|
last === '/' ||
|
|
@@ -76889,9 +78196,14 @@ function element_element(node, index, parent, state) {
|
|
|
76889
78196
|
}
|
|
76890
78197
|
|
|
76891
78198
|
/**
|
|
78199
|
+
* Serialize all attributes.
|
|
78200
|
+
*
|
|
76892
78201
|
* @param {State} state
|
|
78202
|
+
* Info passed around about the current state.
|
|
76893
78203
|
* @param {Properties | null | undefined} properties
|
|
78204
|
+
* Properties.
|
|
76894
78205
|
* @returns {string}
|
|
78206
|
+
* Serialized attributes.
|
|
76895
78207
|
*/
|
|
76896
78208
|
function element_serializeAttributes(state, properties) {
|
|
76897
78209
|
/** @type {Array<string>} */
|
|
@@ -76924,19 +78236,22 @@ function element_serializeAttributes(state, properties) {
|
|
|
76924
78236
|
}
|
|
76925
78237
|
|
|
76926
78238
|
/**
|
|
78239
|
+
* Serialize an attribute.
|
|
78240
|
+
*
|
|
76927
78241
|
* @param {State} state
|
|
78242
|
+
* Info passed around about the current state.
|
|
76928
78243
|
* @param {string} key
|
|
78244
|
+
* Property name.
|
|
76929
78245
|
* @param {Properties[keyof Properties]} value
|
|
78246
|
+
* Property value.
|
|
76930
78247
|
* @returns {string}
|
|
78248
|
+
* Serialized attribute.
|
|
76931
78249
|
*/
|
|
76932
78250
|
function serializeAttribute(state, key, value) {
|
|
76933
78251
|
const info = find(state.schema, key)
|
|
76934
78252
|
const x =
|
|
76935
78253
|
state.settings.allowParseErrors && state.schema.space === 'html' ? 0 : 1
|
|
76936
78254
|
const y = state.settings.allowDangerousCharacters ? 0 : 1
|
|
76937
|
-
let quote = state.quote
|
|
76938
|
-
/** @type {string | undefined} */
|
|
76939
|
-
let result
|
|
76940
78255
|
|
|
76941
78256
|
if (info.overloadedBoolean && (value === info.attribute || value === '')) {
|
|
76942
78257
|
value = true
|
|
@@ -76993,6 +78308,9 @@ function serializeAttribute(state, key, value) {
|
|
|
76993
78308
|
|
|
76994
78309
|
if (state.settings.collapseEmptyAttributes && !value) return name
|
|
76995
78310
|
|
|
78311
|
+
/** @type {string | undefined} */
|
|
78312
|
+
let result
|
|
78313
|
+
|
|
76996
78314
|
// Check unquoted value.
|
|
76997
78315
|
if (state.settings.preferUnquoted) {
|
|
76998
78316
|
result = stringifyEntities(
|
|
@@ -77007,6 +78325,8 @@ function serializeAttribute(state, key, value) {
|
|
|
77007
78325
|
// If we don’t want unquoted, or if `value` contains character references when
|
|
77008
78326
|
// unquoted…
|
|
77009
78327
|
if (result !== value) {
|
|
78328
|
+
let {quote} = state
|
|
78329
|
+
|
|
77010
78330
|
// If the alternative is less common than `quote`, switch.
|
|
77011
78331
|
if (
|
|
77012
78332
|
state.settings.quoteSmart &&
|
|
@@ -77050,7 +78370,7 @@ const textEntitySubset = ['<', '&']
|
|
|
77050
78370
|
* @param {Raw | Text} node
|
|
77051
78371
|
* Node to handle.
|
|
77052
78372
|
* @param {number | undefined} _
|
|
77053
|
-
* Index of `node` in `parent
|
|
78373
|
+
* Index of `node` in `parent`.
|
|
77054
78374
|
* @param {Parents | undefined} parent
|
|
77055
78375
|
* Parent of `node`.
|
|
77056
78376
|
* @param {State} state
|
|
@@ -77087,7 +78407,7 @@ function lib_handle_text_text(node, _, parent, state) {
|
|
|
77087
78407
|
* @param {Raw} node
|
|
77088
78408
|
* Node to handle.
|
|
77089
78409
|
* @param {number | undefined} index
|
|
77090
|
-
* Index of `node` in `parent
|
|
78410
|
+
* Index of `node` in `parent`.
|
|
77091
78411
|
* @param {Parents | undefined} parent
|
|
77092
78412
|
* Parent of `node`.
|
|
77093
78413
|
* @param {State} state
|
|
@@ -77113,7 +78433,7 @@ function raw_raw(node, index, parent, state) {
|
|
|
77113
78433
|
* @param {Root} node
|
|
77114
78434
|
* Node to handle.
|
|
77115
78435
|
* @param {number | undefined} _1
|
|
77116
|
-
* Index of `node` in `parent
|
|
78436
|
+
* Index of `node` in `parent`.
|
|
77117
78437
|
* @param {Parents | undefined} _2
|
|
77118
78438
|
* Parent of `node`.
|
|
77119
78439
|
* @param {State} state
|
|
@@ -77164,7 +78484,7 @@ function invalid(node) {
|
|
|
77164
78484
|
* Fail when a node with an unknown type is found in the tree.
|
|
77165
78485
|
*
|
|
77166
78486
|
* @param {unknown} node_
|
|
77167
|
-
*
|
|
78487
|
+
* Unknown node.
|
|
77168
78488
|
* @returns {never}
|
|
77169
78489
|
* Never.
|
|
77170
78490
|
*/
|
|
@@ -77206,7 +78526,7 @@ function handle_unknown(node_) {
|
|
|
77206
78526
|
* > 👉 **Note**: intentionally creates parse errors in markup (how parse
|
|
77207
78527
|
* > errors are handled is well defined, so this works but isn’t pretty).
|
|
77208
78528
|
* @property {boolean | null | undefined} [bogusComments=false]
|
|
77209
|
-
* Use “bogus comments” instead of comments to save
|
|
78529
|
+
* Use “bogus comments” instead of comments to save bytes: `<?charlie>`
|
|
77210
78530
|
* instead of `<!--charlie-->` (default: `false`).
|
|
77211
78531
|
*
|
|
77212
78532
|
* > 👉 **Note**: intentionally creates parse errors in markup (how parse
|
|
@@ -77257,13 +78577,16 @@ function handle_unknown(node_) {
|
|
|
77257
78577
|
* @property {Space | null | undefined} [space='html']
|
|
77258
78578
|
* When an `<svg>` element is found in the HTML space, this package already
|
|
77259
78579
|
* automatically switches to and from the SVG space when entering and exiting
|
|
77260
|
-
* it
|
|
78580
|
+
* it, and goes to HTML inside `desc`, `foreignObject`, and `title`
|
|
78581
|
+
* (default: `'html'`).
|
|
77261
78582
|
*
|
|
77262
78583
|
* > 👉 **Note**: hast is not XML.
|
|
77263
78584
|
* > It supports SVG as embedded in HTML.
|
|
77264
78585
|
* > It does not support the features available in XML.
|
|
77265
78586
|
* > Passing SVG might break but fragments of modern SVG should be fine.
|
|
77266
78587
|
* > Use [`xast`][xast] if you need to support SVG as XML.
|
|
78588
|
+
*
|
|
78589
|
+
* [xast]: https://github.com/syntax-tree/xast
|
|
77267
78590
|
* @property {boolean | null | undefined} [tightAttributes=false]
|
|
77268
78591
|
* Join attributes together, without whitespace, if possible: get
|
|
77269
78592
|
* `class="a b"title="c d"` instead of `class="a b" title="c d"` to save
|
|
@@ -77351,12 +78674,13 @@ const lib_emptyChildren = []
|
|
|
77351
78674
|
function toHtml(tree, options) {
|
|
77352
78675
|
const options_ = options || hast_util_to_html_lib_emptyOptions
|
|
77353
78676
|
const quote = options_.quote || '"'
|
|
77354
|
-
const alternative = quote === '"' ? "'" : '"'
|
|
77355
78677
|
|
|
77356
78678
|
if (quote !== '"' && quote !== "'") {
|
|
77357
78679
|
throw new Error('Invalid quote `' + quote + '`, expected `\'` or `"`')
|
|
77358
78680
|
}
|
|
77359
78681
|
|
|
78682
|
+
const alternative = quote === '"' ? "'" : '"'
|
|
78683
|
+
|
|
77360
78684
|
/** @type {State} */
|
|
77361
78685
|
const state = {
|
|
77362
78686
|
one: hast_util_to_html_lib_one,
|
|
@@ -77401,7 +78725,7 @@ function toHtml(tree, options) {
|
|
|
77401
78725
|
* @param {Nodes} node
|
|
77402
78726
|
* Node to handle.
|
|
77403
78727
|
* @param {number | undefined} index
|
|
77404
|
-
* Index of `node` in `parent
|
|
78728
|
+
* Index of `node` in `parent`.
|
|
77405
78729
|
* @param {Parents | undefined} parent
|
|
77406
78730
|
* Parent of `node`.
|
|
77407
78731
|
* @returns {string}
|
|
@@ -77419,6 +78743,7 @@ function hast_util_to_html_lib_one(node, index, parent) {
|
|
|
77419
78743
|
* @param {Parents | undefined} parent
|
|
77420
78744
|
* Parent whose children to serialize.
|
|
77421
78745
|
* @returns {string}
|
|
78746
|
+
* Serialized children.
|
|
77422
78747
|
*/
|
|
77423
78748
|
function hast_util_to_html_lib_all(parent) {
|
|
77424
78749
|
/** @type {Array<string>} */
|
|
@@ -77547,17 +78872,35 @@ function _objectSpread2(e) {
|
|
|
77547
78872
|
|
|
77548
78873
|
;// ./src/Context.tsx
|
|
77549
78874
|
function reducer(state,action){return _objectSpread2(_objectSpread2({},state),action);}var EditorContext=/*#__PURE__*/(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().createContext)({markdown:''});
|
|
77550
|
-
;// ./src/components/TextArea/
|
|
77551
|
-
var
|
|
77552
|
-
|
|
77553
|
-
|
|
77554
|
-
|
|
77555
|
-
|
|
77556
|
-
|
|
77557
|
-
|
|
77558
|
-
|
|
78875
|
+
;// ./src/components/TextArea/splitBlocks.ts
|
|
78876
|
+
var FENCE_OPEN=/^```/;var FENCE_CLOSE=/^```\r?\n?$/;var BLANK_LINE=/^[ \t]*\r?\n?$/;var FRONT_MATTER_FENCE=/^---\r?\n?$/;/**
|
|
78877
|
+
* Splits markdown into blocks that Prism's markdown grammar highlights the same way
|
|
78878
|
+
* on their own as it does in the full document, so unchanged blocks can be cached.
|
|
78879
|
+
* Joining the returned blocks always yields the original string.
|
|
78880
|
+
*
|
|
78881
|
+
* A block ends where a run of blank lines starts, so each block keeps its leading blank
|
|
78882
|
+
* lines (indented code needs them). No split happens inside a ``` fence, front matter or
|
|
78883
|
+
* multiline markup or link references, or right before a `---` line, which Prism
|
|
78884
|
+
* would read as front matter. Whitespace-only lines stay in their block because
|
|
78885
|
+
* Prism's inline emphasis can span them.
|
|
78886
|
+
* Fences follow Prism's rule, not CommonMark's, so the split matches what Prism sees.
|
|
78887
|
+
*/function splitBlocks(markdown){var lines=markdown.match(/[^\n]*\n|[^\n]+$/g)||[];var blocks=[];var current='';var pendingSplit=-1;var inFence=false;var inFrontMatter=/^(?:\s*[\r\n])?---(?:\r?\n|$)/.test(markdown);var frontMatterStarted=false;var syntax={end:'',quote:'',brackets:0,subset:0};var previousIsBlank=true;lines.forEach(function(line){var isBlank=BLANK_LINE.test(line);var canSplit=!inFence&&!inFrontMatter&&!syntax.end&&!syntax.brackets;if(/^\r?\n$/.test(line)&&!previousIsBlank&&canSplit){pendingSplit=current.length;}if(!isBlank&&pendingSplit>0){if(!FRONT_MATTER_FENCE.test(line)){blocks.push(current.slice(0,pendingSplit));current=current.slice(pendingSplit);}pendingSplit=-1;}current+=line;previousIsBlank=isBlank;if(inFrontMatter){if(FRONT_MATTER_FENCE.test(line)){inFrontMatter=!frontMatterStarted;frontMatterStarted=true;}return;}if(inFence){inFence=!FENCE_CLOSE.test(line);return;}if(!syntax.end&&FENCE_OPEN.test(line)){inFence=true;return;}updateSyntax(line,syntax);});if(current){blocks.push(current);}return blocks;}// Keep potential multiline Prism tokens together. Unclosed syntax conservatively
|
|
78888
|
+
// keeps the rest of the document in one block until the user closes it.
|
|
78889
|
+
function updateSyntax(line,state){var reference=false;for(var i=0;i<line.length;i++){var _char=line[i];if(state.end&&state.end!=='>'){var end=line.indexOf(state.end,i);if(end===-1)return;i=end+state.end.length-1;state.end='';continue;}if(state.end==='>'){if(state.quote){if(_char===state.quote)state.quote='';}else if(_char==='"'||_char==="'"){state.quote=_char;}else if(_char==='['){state.subset++;}else if(_char===']'&&state.subset){state.subset--;}else if(_char==='>'&&!state.subset){state.end='';}continue;}if(_char==='\\'){i++;}else if(_char==='<'&&/[a-z!?/]/i.test(line[i+1]||'')){state.end=line.startsWith('<!--',i)?'-->':line.startsWith('<![CDATA[',i)?']]>':line.startsWith('<?',i)?'?>':'>';}else if(_char==='['){state.brackets++;}else if(_char===']'){state.brackets=Math.max(0,state.brackets-1);reference=line[i+1]===':';}else if(reference&&(_char==='"'||_char==="'"||_char==='(')){state.end=_char==='('?')':_char;}}}
|
|
78890
|
+
;// ./src/components/TextArea/Markdown.factory.tsx
|
|
78891
|
+
/**
|
|
78892
|
+
* Prism's markdown grammar takes quadratic time on long lines, so a single base64 image
|
|
78893
|
+
* line can block the editor for minutes. Blocks with such a line are shown uncoloured.
|
|
78894
|
+
*/var MAX_HIGHLIGHT_LINE_LENGTH=1000;function html2Escape(sHtml){return sHtml.replace(/[<&"]/g,function(c){return{'<':'<','>':'>','&':'&','"':'"'}[c];});}function hasLongLine(text){var lineStart=0;while(lineStart<=text.length){var lineEnd=text.indexOf('\n',lineStart);var end=lineEnd===-1?text.length:lineEnd;if(end-lineStart>MAX_HIGHLIGHT_LINE_LENGTH){return true;}lineStart=end+1;}return false;}function getCodeInnerHtml(html){var codeStart=html.indexOf('<code');var contentStart=html.indexOf('>',codeStart)+1;var contentEnd=html.lastIndexOf('</code>');return html.slice(contentStart,contentEnd);}var MarkdownBlock=/*#__PURE__*/(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().memo)(function MarkdownBlock(props){return/*#__PURE__*/(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().createElement)('span',{dangerouslySetInnerHTML:{__html:props.html}});});function createMarkdown(rehypePrism){var processor=rehype().data('settings',{fragment:true})// https://github.com/uiwjs/react-md-editor/issues/593
|
|
77559
78895
|
// @ts-ignore
|
|
77560
|
-
.use(
|
|
78896
|
+
.use(rehypePrism,{ignoreMissing:true});function highlightBlock(block){var escaped=html2Escape(block);if(hasLongLine(block)){return escaped;}try{var html=processor.processSync("<pre><code class=\"language-markdown\">".concat(escaped,"</code></pre>")).toString();return getCodeInnerHtml(html);}catch(error){return escaped;}}/**
|
|
78897
|
+
* Highlighting runs per block, and blocks whose text did not change reuse their cached
|
|
78898
|
+
* HTML and DOM, so typing in a large document only re-highlights the edited block.
|
|
78899
|
+
* https://github.com/uiwjs/react-md-editor/issues/620
|
|
78900
|
+
*/return function Markdown(props){var prefixCls=props.prefixCls;var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useContext)(EditorContext),_useContext$markdown=_useContext.markdown,markdown=_useContext$markdown===void 0?'':_useContext$markdown,highlightEnable=_useContext.highlightEnable,dispatch=_useContext.dispatch;var preRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(null);var cacheRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(new Map());var nextIdRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(0);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useEffect)(function(){if(preRef.current&&dispatch){dispatch({textareaPre:preRef.current});}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78901
|
+
},[]);var blocks=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){if(!highlightEnable){cacheRef.current=new Map();return[];}var cache=new Map();var occurrences=new Map();var result=splitBlocks(markdown).map(function(block){var highlighted=cacheRef.current.get(block)||cache.get(block);if(!highlighted){highlighted={id:nextIdRef.current++,html:highlightBlock(block)};}cache.set(block,highlighted);var occurrence=occurrences.get(block)||0;occurrences.set(block,occurrence+1);return{key:"".concat(highlighted.id,"-").concat(occurrence),html:highlighted.html};});cacheRef.current=cache;return result;},[markdown,highlightEnable]);if(!markdown){return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("pre",{ref:preRef,className:"".concat(prefixCls,"-text-pre wmde-markdown-color")});}return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{className:"wmde-markdown-color",children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("pre",{ref:preRef,className:"language-markdown ".concat(prefixCls,"-text-pre wmde-markdown-color"),children:highlightEnable?/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("code",{className:"language-markdown code-highlight",children:[blocks.map(function(block){return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(MarkdownBlock,{html:block.html},block.key);}),'\n']}):/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("code",{className:"language-markdown",children:"".concat(markdown,"\n")})})});};}
|
|
78902
|
+
;// ./src/components/TextArea/Markdown.tsx
|
|
78903
|
+
/* harmony default export */ const TextArea_Markdown = (createMarkdown(index_es_f));
|
|
77561
78904
|
;// ../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
|
|
77562
78905
|
|
|
77563
78906
|
function _objectWithoutProperties(e, t) {
|
|
@@ -77724,7 +79067,7 @@ var italic={name:'italic',keyCommand:'italic',shortcuts:'ctrlcmd+i',prefix:'*',b
|
|
|
77724
79067
|
;// ./src/commands/link.tsx
|
|
77725
79068
|
var commands_link_link={name:'link',keyCommand:'link',shortcuts:'ctrlcmd+l',prefix:'[',suffix:'](url)',buttonProps:{'aria-label':'Add a link (ctrl + l)',title:'Add a link (ctrl + l)'},icon:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("svg",{"data-name":"italic",width:"12",height:"12",role:"img",viewBox:"0 0 520 520",children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("path",{fill:"currentColor",d:"M331.751196,182.121107 C392.438214,241.974735 391.605313,337.935283 332.11686,396.871226 C332.005129,396.991316 331.873084,397.121413 331.751196,397.241503 L263.493918,464.491645 C203.291404,523.80587 105.345257,523.797864 45.151885,464.491645 C-15.0506283,405.187427 -15.0506283,308.675467 45.151885,249.371249 L82.8416853,212.237562 C92.836501,202.39022 110.049118,208.9351 110.56511,222.851476 C111.223305,240.5867 114.451306,258.404985 120.407566,275.611815 C122.424812,281.438159 120.983487,287.882964 116.565047,292.23621 L103.272145,305.332975 C74.8052033,333.379887 73.9123737,379.047937 102.098973,407.369054 C130.563883,435.969378 177.350591,436.139505 206.033884,407.879434 L274.291163,340.6393 C302.9257,312.427264 302.805844,266.827265 274.291163,238.733318 C270.531934,235.036561 266.74528,232.16442 263.787465,230.157924 C259.544542,227.2873 256.928256,222.609848 256.731165,217.542518 C256.328935,206.967633 260.13184,196.070508 268.613213,187.714278 L289.998463,166.643567 C295.606326,161.118448 304.403592,160.439942 310.906317,164.911276 C318.353355,170.034591 325.328531,175.793397 331.751196,182.121107 Z M240.704978,55.4828366 L172.447607,122.733236 C172.325719,122.853326 172.193674,122.983423 172.081943,123.103513 C117.703294,179.334654 129.953294,261.569283 185.365841,328.828764 C191.044403,335.721376 198.762988,340.914712 206.209732,346.037661 C212.712465,350.509012 221.510759,349.829503 227.117615,344.305363 L248.502893,323.234572 C256.984277,314.87831 260.787188,303.981143 260.384957,293.406218 C260.187865,288.338869 257.571576,283.661398 253.328648,280.790763 C250.370829,278.78426 246.58417,275.912107 242.824936,272.215337 C214.310216,244.121282 206.209732,204.825874 229.906702,179.334654 L298.164073,112.094263 C326.847404,83.8340838 373.633159,84.0042113 402.099123,112.604645 C430.285761,140.92587 429.393946,186.594095 400.92595,214.641114 L387.63303,227.737929 C383.214584,232.091191 381.773257,238.536021 383.790506,244.362388 C389.746774,261.569283 392.974779,279.387637 393.632975,297.122928 C394.149984,311.039357 411.361608,317.584262 421.356437,307.736882 L459.046288,270.603053 C519.249898,211.29961 519.249898,114.787281 459.047304,55.4828366 C398.853851,-3.82360914 300.907572,-3.83161514 240.704978,55.4828366 Z"})}),execute:function execute(state,api){var newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});var state1=api.setSelectionRange(newSelectionRange);if(state1.selectedText.includes('http')||state1.selectedText.includes('www')){newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:'[](',suffix:')'});state1=api.setSelectionRange(newSelectionRange);executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:'[](',suffix:')'});}else{if(state1.selectedText.length===0){executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:'[title',suffix:'](url)'});}else{executeCommand({api:api,selectedText:state1.selectedText,selection:state.selection,prefix:state.command.prefix,suffix:state.command.suffix});}}}};
|
|
77726
79069
|
;// ./src/commands/list.tsx
|
|
77727
|
-
var makeList=function makeList(state,api,insertBefore){var newSelectionRange=selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix});var state1=api.setSelectionRange(newSelectionRange);var breaksBeforeCount=getBreaksNeededForEmptyLineBefore(state1.text,state1.selection.start);var breaksBefore=Array(breaksBeforeCount+1).join('\n');var breaksAfterCount=getBreaksNeededForEmptyLineAfter(state1.text,state1.selection.end);var breaksAfter=Array(breaksAfterCount+1).join('\n');var _insertBeforeEachLine=insertBeforeEachLine(state1.selectedText,insertBefore),modifiedText=_insertBeforeEachLine.modifiedText,insertionLength=_insertBeforeEachLine.insertionLength;if(insertionLength<0){// Remove
|
|
79070
|
+
var makeList=function makeList(state,api,insertBefore){var selectionStrategy=arguments.length>3&&arguments[3]!==undefined?arguments[3]:'word';var newSelectionRange=selectionStrategy==='line'?selectLine({text:state.text,selection:state.selection}):selectWord({text:state.text,selection:state.selection,prefix:state.command.prefix});var state1=api.setSelectionRange(newSelectionRange);var breaksBeforeCount=getBreaksNeededForEmptyLineBefore(state1.text,state1.selection.start);var breaksBefore=Array(breaksBeforeCount+1).join('\n');var breaksAfterCount=getBreaksNeededForEmptyLineAfter(state1.text,state1.selection.end);var breaksAfter=Array(breaksAfterCount+1).join('\n');var _insertBeforeEachLine=insertBeforeEachLine(state1.selectedText,insertBefore),modifiedText=_insertBeforeEachLine.modifiedText,insertionLength=_insertBeforeEachLine.insertionLength;if(insertionLength<0){// Remove
|
|
77728
79071
|
var selectionStart=state1.selection.start;var selectionEnd=state1.selection.end;if(state1.selection.start>0&&state.text.slice(state1.selection.start-1,state1.selection.start)==='\n'){selectionStart-=1;}if(state1.selection.end<state.text.length-1&&state.text.slice(state1.selection.end,state1.selection.end+1)==='\n'){selectionEnd+=1;}api.setSelectionRange({start:selectionStart,end:selectionEnd});api.replaceSelection("".concat(modifiedText));api.setSelectionRange({start:selectionStart,end:selectionStart+modifiedText.length});}else{// Add
|
|
77729
79072
|
api.replaceSelection("".concat(breaksBefore).concat(modifiedText).concat(breaksAfter));var _selectionStart=state1.selection.start+breaksBeforeCount;var _selectionEnd=_selectionStart+modifiedText.length;api.setSelectionRange({start:_selectionStart,end:_selectionEnd});}};var unorderedListCommand={name:'unordered-list',keyCommand:'list',shortcuts:'ctrl+shift+u',prefix:'- ',buttonProps:{'aria-label':'Add unordered list (ctrl + shift + u)',title:'Add unordered list (ctrl + shift + u)'},icon:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("svg",{"data-name":"unordered-list",width:"12",height:"12",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("path",{fill:"currentColor",d:"M96 96c0 26.51-21.49 48-48 48S0 122.51 0 96s21.49-48 48-48 48 21.49 48 48zM48 208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm0 160c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm96-236h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"})}),execute:function execute(state,api){makeList(state,api,'- ');}};var orderedListCommand={name:'ordered-list',keyCommand:'list',shortcuts:'ctrl+shift+o',prefix:'1. ',buttonProps:{'aria-label':'Add ordered list (ctrl + shift + o)',title:'Add ordered list (ctrl + shift + o)'},icon:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("svg",{"data-name":"ordered-list",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("path",{fill:"currentColor",d:"M3.263 139.527c0-7.477 3.917-11.572 11.573-11.572h15.131V88.078c0-5.163.534-10.503.534-10.503h-.356s-1.779 2.67-2.848 3.738c-4.451 4.273-10.504 4.451-15.666-1.068l-5.518-6.231c-5.342-5.341-4.984-11.216.534-16.379l21.72-19.938C32.815 33.602 36.732 32 42.785 32H54.89c7.656 0 11.749 3.916 11.749 11.572v84.384h15.488c7.655 0 11.572 4.094 11.572 11.572v8.901c0 7.477-3.917 11.572-11.572 11.572H14.836c-7.656 0-11.573-4.095-11.573-11.572v-8.902zM2.211 304.591c0-47.278 50.955-56.383 50.955-69.165 0-7.18-5.954-8.755-9.28-8.755-3.153 0-6.479 1.051-9.455 3.852-5.079 4.903-10.507 7.004-16.111 2.451l-8.579-6.829c-5.779-4.553-7.18-9.805-2.803-15.409C13.592 201.981 26.025 192 47.387 192c19.437 0 44.476 10.506 44.476 39.573 0 38.347-46.753 46.402-48.679 56.909h39.049c7.529 0 11.557 4.027 11.557 11.382v8.755c0 7.354-4.028 11.382-11.557 11.382h-67.94c-7.005 0-12.083-4.028-12.083-11.382v-4.028zM5.654 454.61l5.603-9.28c3.853-6.654 9.105-7.004 15.584-3.152 4.903 2.101 9.63 3.152 14.359 3.152 10.155 0 14.358-3.502 14.358-8.23 0-6.654-5.604-9.106-15.934-9.106h-4.728c-5.954 0-9.28-2.101-12.258-7.88l-1.05-1.926c-2.451-4.728-1.226-9.806 2.801-14.884l5.604-7.004c6.829-8.405 12.257-13.483 12.257-13.483v-.35s-4.203 1.051-12.608 1.051H16.685c-7.53 0-11.383-4.028-11.383-11.382v-8.755c0-7.53 3.853-11.382 11.383-11.382h58.484c7.529 0 11.382 4.027 11.382 11.382v3.327c0 5.778-1.401 9.806-5.079 14.183l-17.509 20.137c19.611 5.078 28.716 20.487 28.716 34.845 0 21.363-14.358 44.126-48.503 44.126-16.636 0-28.192-4.728-35.896-9.455-5.779-4.202-6.304-9.805-2.626-15.934zM144 132h352c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h352c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H144c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"})}),execute:function execute(state,api){makeList(state,api,function(item,index){return"".concat(index+1,". ");});}};var checkedListCommand={name:'checked-list',keyCommand:'list',shortcuts:'ctrl+shift+c',prefix:'- [ ] ',buttonProps:{'aria-label':'Add checked list (ctrl + shift + c)',title:'Add checked list (ctrl + shift + c)'},icon:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("svg",{"data-name":"checked-list",width:"12",height:"12",role:"img",viewBox:"0 0 512 512",children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("path",{fill:"currentColor",d:"M208 132h288c8.8 0 16-7.2 16-16V76c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zm0 160h288c8.8 0 16-7.2 16-16v-40c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v40c0 8.8 7.2 16 16 16zM64 368c-26.5 0-48.6 21.5-48.6 48s22.1 48 48.6 48 48-21.5 48-48-21.5-48-48-48zm92.5-299l-72.2 72.2-15.6 15.6c-4.7 4.7-12.9 4.7-17.6 0L3.5 109.4c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.3c4.7-4.7 12.3-4.7 17 0l17 16.5c4.6 4.7 4.6 12.3-.1 17zm0 159.6l-72.2 72.2-15.7 15.7c-4.7 4.7-12.9 4.7-17.6 0L3.5 269c-4.7-4.7-4.7-12.3 0-17l15.7-15.7c4.7-4.7 12.3-4.7 17 0l22.7 22.1 63.7-63.7c4.7-4.7 12.3-4.7 17 0l17 17c4.6 4.6 4.6 12.2-.1 16.9z"})}),execute:function execute(state,api){makeList(state,api,function(item,index){return"- [ ] ";});}};
|
|
77730
79073
|
;// ./src/commands/preview.tsx
|
|
@@ -77815,9 +79158,9 @@ textRef.current.removeEventListener('keydown',onKeyDown);}};// eslint-disable-ne
|
|
|
77815
79158
|
;// ./src/components/TextArea/factory.tsx
|
|
77816
79159
|
var factory_excluded=["prefixCls","className","onScroll","renderTextarea"];function createTextArea(options){var _options$useMinHeight;var MarkdownComponent=options===null||options===void 0?void 0:options.Markdown;var useMinHeight=(_options$useMinHeight=options===null||options===void 0?void 0:options.useMinHeight)!==null&&_options$useMinHeight!==void 0?_options$useMinHeight:false;return function TextArea(props){var _ref=props||{},prefixCls=_ref.prefixCls,className=_ref.className,onScroll=_ref.onScroll,renderTextarea=_ref.renderTextarea,otherProps=_objectWithoutProperties(_ref,factory_excluded);var _useContext=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useContext)(EditorContext),markdown=_useContext.markdown,scrollTop=_useContext.scrollTop,commands=_useContext.commands,minHeight=_useContext.minHeight,highlightEnable=_useContext.highlightEnable,extraCommands=_useContext.extraCommands,dispatch=_useContext.dispatch;var textRef=(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().useRef)(null);var executeRef=(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().useRef)();var warp=/*#__PURE__*/(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().createRef)();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useEffect)(function(){var state={};if(warp.current){state.textareaWarp=warp.current||undefined;warp.current.scrollTop=scrollTop||0;}if(dispatch){dispatch(_objectSpread2({},state));}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77817
79160
|
},[]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useEffect)(function(){if(textRef.current&&dispatch){var commandOrchestrator=new TextAreaCommandOrchestrator(textRef.current);executeRef.current=commandOrchestrator;dispatch({textarea:textRef.current,commandOrchestrator:commandOrchestrator});}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77818
|
-
},[]);var textStyle=MarkdownComponent&&highlightEnable?{}:{WebkitTextFillColor:'initial',overflow:'auto'};return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{ref:warp,className:"".concat(prefixCls,"-area ").concat(className||''),onScroll:onScroll,children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{className:"".concat(prefixCls,"-text"),style:useMinHeight?{minHeight:minHeight}:undefined,children:renderTextarea?(/*#__PURE__*/(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().cloneElement)(renderTextarea(_objectSpread2(_objectSpread2({},
|
|
79161
|
+
},[]);var textStyle=MarkdownComponent&&highlightEnable?{}:{WebkitTextFillColor:'initial',overflow:'auto'};var inputProps=_objectSpread2({},otherProps);if(!inputProps['aria-label']&&!inputProps['aria-labelledby']&&!inputProps.id&&!inputProps.title){inputProps['aria-label']='Markdown editor';}return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{ref:warp,className:"".concat(prefixCls,"-area ").concat(className||''),onScroll:onScroll,children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{className:"".concat(prefixCls,"-text"),style:useMinHeight?{minHeight:minHeight}:undefined,children:renderTextarea?(/*#__PURE__*/(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().cloneElement)(renderTextarea(_objectSpread2(_objectSpread2({},inputProps),{},{value:markdown,autoComplete:'off',spellCheck:'false',autoCapitalize:'off',className:"".concat(prefixCls,"-text-input"),style:{WebkitTextFillColor:'inherit',overflow:'auto'}}),{dispatch:dispatch,onChange:otherProps.onChange,shortcuts:shortcutsHandle,useContext:{commands:commands,extraCommands:extraCommands,commandOrchestrator:executeRef.current}}),{ref:textRef})):/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().Fragment),{children:[MarkdownComponent&&highlightEnable&&/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(MarkdownComponent,{prefixCls:prefixCls}),/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(Textarea,_objectSpread2(_objectSpread2({prefixCls:prefixCls},inputProps),{},{style:textStyle}))]})})});};}
|
|
77819
79162
|
;// ./src/components/TextArea/index.tsx
|
|
77820
|
-
/* harmony default export */ const components_TextArea = (createTextArea({Markdown:
|
|
79163
|
+
/* harmony default export */ const components_TextArea = (createTextArea({Markdown:TextArea_Markdown,useMinHeight:true}));
|
|
77821
79164
|
;// ../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
|
|
77822
79165
|
function _arrayWithHoles(r) {
|
|
77823
79166
|
if (Array.isArray(r)) return r;
|
|
@@ -77887,7 +79230,15 @@ document.body.style.overflow=originalOverflow.current;}}},[fullscreen,originalOv
|
|
|
77887
79230
|
var DragBar_DragBar=function DragBar(props){var _ref=props||{},prefixCls=_ref.prefixCls,onChange=_ref.onChange;var $dom=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(null);var dragRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)();var heightRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(props.height);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useEffect)(function(){if(heightRef.current!==props.height){heightRef.current=props.height;}},[props.height]);function handleMouseMove(event){if(dragRef.current){var _changedTouches$;var clientY=event.clientY||((_changedTouches$=event.changedTouches[0])===null||_changedTouches$===void 0?void 0:_changedTouches$.clientY);var newHeight=dragRef.current.height+clientY-dragRef.current.dragY;if(newHeight>=props.minHeight&&newHeight<=props.maxHeight){onChange&&onChange(dragRef.current.height+(clientY-dragRef.current.dragY));}}}function handleMouseUp(){var _$dom$current,_$dom$current2;dragRef.current=undefined;document.removeEventListener('mousemove',handleMouseMove);document.removeEventListener('mouseup',handleMouseUp);(_$dom$current=$dom.current)===null||_$dom$current===void 0?void 0:_$dom$current.removeEventListener('touchmove',handleMouseMove);(_$dom$current2=$dom.current)===null||_$dom$current2===void 0?void 0:_$dom$current2.removeEventListener('touchend',handleMouseUp);}function handleMouseDown(event){var _changedTouches$2,_$dom$current3,_$dom$current4;event.preventDefault();var clientY=event.clientY||((_changedTouches$2=event.changedTouches[0])===null||_changedTouches$2===void 0?void 0:_changedTouches$2.clientY);dragRef.current={height:heightRef.current,dragY:clientY};document.addEventListener('mousemove',handleMouseMove);document.addEventListener('mouseup',handleMouseUp);(_$dom$current3=$dom.current)===null||_$dom$current3===void 0?void 0:_$dom$current3.addEventListener('touchmove',handleMouseMove,{passive:false});(_$dom$current4=$dom.current)===null||_$dom$current4===void 0?void 0:_$dom$current4.addEventListener('touchend',handleMouseUp,{passive:false});};(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useEffect)(function(){if(document){var _$dom$current5,_$dom$current6;(_$dom$current5=$dom.current)===null||_$dom$current5===void 0?void 0:_$dom$current5.addEventListener('touchstart',handleMouseDown,{passive:false});(_$dom$current6=$dom.current)===null||_$dom$current6===void 0?void 0:_$dom$current6.addEventListener('mousedown',handleMouseDown);}return function(){if(document){var _$dom$current7;(_$dom$current7=$dom.current)===null||_$dom$current7===void 0?void 0:_$dom$current7.removeEventListener('touchstart',handleMouseDown);document.removeEventListener('mousemove',handleMouseMove);}};// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77888
79231
|
},[]);var svg=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("svg",{viewBox:"0 0 512 512",height:"100%",children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("path",{fill:"currentColor",d:"M304 256c0 26.5-21.5 48-48 48s-48-21.5-48-48 21.5-48 48-48 48 21.5 48 48zm120-48c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48zm-336 0c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z"})});},[]);return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{className:"".concat(prefixCls,"-bar"),ref:$dom,children:svg});};/* harmony default export */ const components_DragBar = (DragBar_DragBar);
|
|
77889
79232
|
;// ./src/Editor.factory.tsx
|
|
77890
|
-
var Editor_factory_excluded=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function setGroupPopFalse(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};Object.keys(data).forEach(function(keyname){data[keyname]=false;});return data;}
|
|
79233
|
+
var Editor_factory_excluded=["renderMsRef"],Editor_factory_excluded2=["prefixCls","className","value","commands","commandsFilter","direction","extraCommands","height","enableScroll","visibleDragbar","highlightEnable","preview","fullscreen","overflow","previewOptions","textareaProps","id","name","required","disabled","readOnly","placeholder","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-required","aria-errormessage","maxHeight","minHeight","autoFocus","autoFocusEnd","tabSize","defaultTabEnable","onChange","onStatistics","onHeightChange","hideToolbar","toolbarBottom","components","renderTextarea"];function setGroupPopFalse(){var data=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};Object.keys(data).forEach(function(keyname){data[keyname]=false;});return data;}var DEFAULT_PREVIEW_OPTIONS={};/**
|
|
79234
|
+
* Lets the preview render after the textarea on React 18+, so typing in a large
|
|
79235
|
+
* document stays responsive. Older React versions render it right away, as before.
|
|
79236
|
+
*/var useDeferredValue=((external_root_React_commonjs2_react_commonjs_react_amd_react_default()()).useDeferredValue)||function(value){return value;};var useIsomorphicLayoutEffect=typeof window==='undefined'?(external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useEffect):(external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useLayoutEffect);var SLOW_PREVIEW_MS=50;var MAX_PREVIEW_DELAY_MS=500;/**
|
|
79237
|
+
* Keeps the preview in step with every keystroke while it renders fast. Once a preview
|
|
79238
|
+
* render takes longer than SLOW_PREVIEW_MS, it waits for a pause in typing as long as
|
|
79239
|
+
* that render (at most MAX_PREVIEW_DELAY_MS) before updating.
|
|
79240
|
+
* https://github.com/uiwjs/react-md-editor/issues/620
|
|
79241
|
+
*/function usePreviewSource(markdown,previewRenderMs){var _useReducer=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useReducer)(function(count){return count+1;},0),_useReducer2=_slicedToArray(_useReducer,2),rerender=_useReducer2[1];var shownRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(markdown);if(previewRenderMs.current<SLOW_PREVIEW_MS){shownRef.current=markdown;};(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useEffect)(function(){if(shownRef.current===markdown){return;}var delay=Math.min(previewRenderMs.current,MAX_PREVIEW_DELAY_MS);var timer=setTimeout(function(){shownRef.current=markdown;rerender();},delay);return function(){return clearTimeout(timer);};},[markdown,previewRenderMs]);return shownRef.current;}function createMDEditor(options){var MarkdownPreview=options.MarkdownPreview,TextArea=options.TextArea;var PreviewComponent=MarkdownPreview;var TextAreaComponent=TextArea;function TimedPreview(props){var renderMsRef=props.renderMsRef,previewProps=_objectWithoutProperties(props,Editor_factory_excluded);var renderStart=performance.now();useIsomorphicLayoutEffect(function(){renderMsRef.current=performance.now()-renderStart;});return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(PreviewComponent,_objectSpread2({},previewProps));}var InternalMDEditor=/*#__PURE__*/(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().forwardRef)(function(props,ref){var _ref=props||{},_ref$prefixCls=_ref.prefixCls,prefixCls=_ref$prefixCls===void 0?'w-md-editor':_ref$prefixCls,className=_ref.className,propsValue=_ref.value,_ref$commands=_ref.commands,commands=_ref$commands===void 0?commands_getCommands():_ref$commands,commandsFilter=_ref.commandsFilter,direction=_ref.direction,_ref$extraCommands=_ref.extraCommands,extraCommands=_ref$extraCommands===void 0?getExtraCommands():_ref$extraCommands,_ref$height=_ref.height,height=_ref$height===void 0?200:_ref$height,_ref$enableScroll=_ref.enableScroll,enableScroll=_ref$enableScroll===void 0?true:_ref$enableScroll,_ref$visibleDragbar=_ref.visibleDragbar,visibleDragbar=_ref$visibleDragbar===void 0?typeof props.visiableDragbar==='boolean'?props.visiableDragbar:true:_ref$visibleDragbar,_ref$highlightEnable=_ref.highlightEnable,highlightEnable=_ref$highlightEnable===void 0?true:_ref$highlightEnable,_ref$preview=_ref.preview,previewType=_ref$preview===void 0?'live':_ref$preview,_ref$fullscreen=_ref.fullscreen,fullscreen=_ref$fullscreen===void 0?false:_ref$fullscreen,_ref$overflow=_ref.overflow,overflow=_ref$overflow===void 0?true:_ref$overflow,_ref$previewOptions=_ref.previewOptions,previewOptions=_ref$previewOptions===void 0?DEFAULT_PREVIEW_OPTIONS:_ref$previewOptions,textareaProps=_ref.textareaProps,id=_ref.id,name=_ref.name,required=_ref.required,disabled=_ref.disabled,readOnly=_ref.readOnly,placeholder=_ref.placeholder,ariaLabel=_ref['aria-label'],ariaLabelledBy=_ref['aria-labelledby'],ariaDescribedBy=_ref['aria-describedby'],ariaInvalid=_ref['aria-invalid'],ariaRequired=_ref['aria-required'],ariaErrorMessage=_ref['aria-errormessage'],_ref$maxHeight=_ref.maxHeight,maxHeight=_ref$maxHeight===void 0?1200:_ref$maxHeight,_ref$minHeight=_ref.minHeight,minHeight=_ref$minHeight===void 0?100:_ref$minHeight,autoFocus=_ref.autoFocus,_ref$autoFocusEnd=_ref.autoFocusEnd,autoFocusEnd=_ref$autoFocusEnd===void 0?false:_ref$autoFocusEnd,_ref$tabSize=_ref.tabSize,tabSize=_ref$tabSize===void 0?2:_ref$tabSize,_ref$defaultTabEnable=_ref.defaultTabEnable,defaultTabEnable=_ref$defaultTabEnable===void 0?false:_ref$defaultTabEnable,onChange=_ref.onChange,onStatistics=_ref.onStatistics,onHeightChange=_ref.onHeightChange,hideToolbar=_ref.hideToolbar,_ref$toolbarBottom=_ref.toolbarBottom,toolbarBottom=_ref$toolbarBottom===void 0?false:_ref$toolbarBottom,components=_ref.components,renderTextarea=_ref.renderTextarea,other=_objectWithoutProperties(_ref,Editor_factory_excluded2);var cmds=commands.map(function(item){return commandsFilter?commandsFilter(item,false):item;}).filter(Boolean);var extraCmds=extraCommands.map(function(item){return commandsFilter?commandsFilter(item,true):item;}).filter(Boolean);var _useReducer3=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useReducer)(reducer,{markdown:propsValue,preview:previewType,components:components,height:height,minHeight:minHeight,highlightEnable:highlightEnable,tabSize:tabSize,defaultTabEnable:defaultTabEnable,scrollTop:0,scrollTopPreview:0,commands:cmds,extraCommands:extraCmds,fullscreen:fullscreen,barPopup:{}}),_useReducer4=_slicedToArray(_useReducer3,2),state=_useReducer4[0],dispatch=_useReducer4[1];var container=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(null);var previewRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(null);var enableScrollRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(enableScroll);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useImperativeHandle)(ref,function(){return _objectSpread2(_objectSpread2({},state),{},{container:container.current,dispatch:dispatch});});(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return enableScrollRef.current=enableScroll;},[enableScroll]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useEffect)(function(){var stateInit={};if(container.current){stateInit.container=container.current||undefined;}stateInit.markdown=propsValue||'';stateInit.barPopup={};if(dispatch){dispatch(_objectSpread2(_objectSpread2({},state),stateInit));}// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77891
79242
|
},[]);var cls=[className,'wmde-markdown-var',direction?"".concat(prefixCls,"-").concat(direction):null,prefixCls,state.preview?"".concat(prefixCls,"-show-").concat(state.preview):null,state.fullscreen?"".concat(prefixCls,"-fullscreen"):null].filter(Boolean).join(' ').trim();(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return propsValue!==state.markdown&&dispatch({markdown:propsValue||''});},[propsValue,state.markdown]);// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77892
79243
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return previewType!==state.preview&&dispatch({preview:previewType});},[previewType]);// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77893
79244
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return tabSize!==state.tabSize&&dispatch({tabSize:tabSize});},[tabSize]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return highlightEnable!==state.highlightEnable&&dispatch({highlightEnable:highlightEnable});},// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -77896,7 +79247,7 @@ var Editor_factory_excluded=["prefixCls","className","value","commands","command
|
|
|
77896
79247
|
[fullscreen]);// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77897
79248
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return height!==state.height&&dispatch({height:height});},[height]);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return height!==state.height&&onHeightChange&&onHeightChange(state.height,height,state);},[height,onHeightChange,state]);// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77898
79249
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return commands!==state.commands&&dispatch({commands:cmds});},[props.commands]);// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
77899
|
-
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return extraCommands!==state.extraCommands&&dispatch({extraCommands:extraCmds});},[props.extraCommands]);var textareaDomRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)();var active=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)('preview');var initScroll=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(false);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){textareaDomRef.current=state.textareaWarp;if(state.textareaWarp){state.textareaWarp.addEventListener('mouseover',function(){active.current='text';});state.textareaWarp.addEventListener('mouseleave',function(){active.current='preview';});}},[state.textareaWarp]);var handleScroll=function handleScroll(e,type){if(!enableScrollRef.current)return;var textareaDom=textareaDomRef.current;var previewDom=previewRef.current?previewRef.current:undefined;if(!initScroll.current){active.current=type;initScroll.current=true;}if(textareaDom&&previewDom){var scale=(textareaDom.scrollHeight-textareaDom.offsetHeight)/(previewDom.scrollHeight-previewDom.offsetHeight);if(e.target===textareaDom&&active.current==='text'){previewDom.scrollTop=textareaDom.scrollTop/scale;}if(e.target===previewDom&&active.current==='preview'){textareaDom.scrollTop=previewDom.scrollTop*scale;}var scrollTop=0;if(active.current==='text'){scrollTop=textareaDom.scrollTop||0;}else if(active.current==='preview'){scrollTop=previewDom.scrollTop||0;}dispatch({scrollTop:scrollTop});}};var previewClassName="".concat(prefixCls,"-preview ").concat(previewOptions.className||'');var handlePreviewScroll=function handlePreviewScroll(e){return handleScroll(e,'preview');};var mdPreview=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{ref:previewRef,className:previewClassName,children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(
|
|
79250
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return extraCommands!==state.extraCommands&&dispatch({extraCommands:extraCmds});},[props.extraCommands]);var textareaDomRef=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)();var active=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)('preview');var initScroll=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(false);(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){textareaDomRef.current=state.textareaWarp;if(state.textareaWarp){state.textareaWarp.addEventListener('mouseover',function(){active.current='text';});state.textareaWarp.addEventListener('mouseleave',function(){active.current='preview';});}},[state.textareaWarp]);var handleScroll=function handleScroll(e,type){if(!enableScrollRef.current)return;var textareaDom=textareaDomRef.current;var previewDom=previewRef.current?previewRef.current:undefined;if(!initScroll.current){active.current=type;initScroll.current=true;}if(textareaDom&&previewDom){var scale=(textareaDom.scrollHeight-textareaDom.offsetHeight)/(previewDom.scrollHeight-previewDom.offsetHeight);if(e.target===textareaDom&&active.current==='text'){previewDom.scrollTop=textareaDom.scrollTop/scale;}if(e.target===previewDom&&active.current==='preview'){textareaDom.scrollTop=previewDom.scrollTop*scale;}var scrollTop=0;if(active.current==='text'){scrollTop=textareaDom.scrollTop||0;}else if(active.current==='preview'){scrollTop=previewDom.scrollTop||0;}dispatch({scrollTop:scrollTop});}};var previewClassName="".concat(prefixCls,"-preview ").concat(previewOptions.className||'');var handlePreviewScroll=function handlePreviewScroll(e){return handleScroll(e,'preview');};var previewRenderMs=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useRef)(0);var previewMarkdown=useDeferredValue(usePreviewSource(state.markdown||'',previewRenderMs));var mdPreview=(0,external_root_React_commonjs2_react_commonjs_react_amd_react_namespaceFn().useMemo)(function(){return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{ref:previewRef,className:previewClassName,children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(TimedPreview,_objectSpread2(_objectSpread2({},previewOptions),{},{renderMsRef:previewRenderMs,onScroll:handlePreviewScroll,source:previewMarkdown}))});},[previewClassName,previewOptions,previewMarkdown]);var preview=(components===null||components===void 0?void 0:components.preview)&&(components===null||components===void 0?void 0:components.preview(state.markdown||'',state,dispatch));if(preview&&/*#__PURE__*/(external_root_React_commonjs2_react_commonjs_react_amd_react_default()().isValidElement)(preview)){mdPreview=/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("div",{className:previewClassName,ref:previewRef,onScroll:handlePreviewScroll,children:preview});}var containerStyle=_objectSpread2(_objectSpread2({},other.style),{},{height:state.height||'100%'});var containerClick=function containerClick(){return dispatch({barPopup:_objectSpread2({},setGroupPopFalse(state.barPopup))});};var dragBarChange=function dragBarChange(newHeight){return dispatch({height:newHeight});};var changeHandle=function changeHandle(evn){onChange&&onChange(evn.target.value,evn,state);if(textareaProps&&textareaProps.onChange){textareaProps.onChange(evn);}if(state.textarea&&state.textarea instanceof HTMLTextAreaElement&&onStatistics){var obj=new TextAreaCommandOrchestrator(state.textarea);var objState=obj.getState()||{};onStatistics(_objectSpread2(_objectSpread2({},objState),{},{lineCount:evn.target.value.split('\n').length,length:evn.target.value.length}));}};return/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(EditorContext.Provider,{value:_objectSpread2(_objectSpread2({},state),{},{dispatch:dispatch}),children:/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("div",_objectSpread2(_objectSpread2({ref:container,className:cls},other),{},{onClick:containerClick,style:containerStyle,children:[/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToolbarVisibility,{hideToolbar:hideToolbar,toolbarBottom:toolbarBottom,prefixCls:prefixCls,overflow:overflow,placement:"top"}),/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("div",{className:"".concat(prefixCls,"-content"),children:[/(edit|live)/.test(state.preview||'')&&/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(TextAreaComponent,_objectSpread2(_objectSpread2({className:"".concat(prefixCls,"-input"),prefixCls:prefixCls,autoFocus:autoFocus,id:id,name:name,required:required,disabled:disabled,readOnly:readOnly,placeholder:placeholder,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,"aria-describedby":ariaDescribedBy,"aria-invalid":ariaInvalid,"aria-required":ariaRequired,"aria-errormessage":ariaErrorMessage},textareaProps),{},{onChange:changeHandle,renderTextarea:(components===null||components===void 0?void 0:components.textarea)||renderTextarea,onScroll:function onScroll(e){return handleScroll(e,'text');}})),/(live|preview)/.test(state.preview||'')&&mdPreview]}),visibleDragbar&&!state.fullscreen&&/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(components_DragBar,{prefixCls:prefixCls,height:state.height,maxHeight:maxHeight,minHeight:minHeight,onChange:dragBarChange}),/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToolbarVisibility,{hideToolbar:hideToolbar,toolbarBottom:toolbarBottom,prefixCls:prefixCls,overflow:overflow,placement:"bottom"})]}))});});var Editor=InternalMDEditor;Editor.Markdown=MarkdownPreview;Editor.displayName='MDEditor';return Editor;}
|
|
77900
79251
|
;// ./src/Editor.tsx
|
|
77901
79252
|
/* harmony default export */ const Editor = (createMDEditor({MarkdownPreview:react_markdown_preview_esm,TextArea:components_TextArea}));
|
|
77902
79253
|
;// ./src/index.less
|