securemark 0.298.7 → 0.299.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/index.js +123 -355
  3. package/package.json +1 -1
  4. package/src/combinator/control/constraint/block.ts +8 -5
  5. package/src/combinator/control/constraint/line.ts +13 -7
  6. package/src/combinator/control/manipulation/convert.ts +8 -11
  7. package/src/combinator/control/manipulation/match.ts +8 -4
  8. package/src/combinator/control/manipulation/scope.ts +6 -4
  9. package/src/combinator/control/monad/bind.ts +14 -6
  10. package/src/combinator/data/parser/context.ts +1 -74
  11. package/src/combinator/data/parser.ts +10 -8
  12. package/src/parser/api/normalize.ts +1 -0
  13. package/src/parser/block/blockquote.ts +7 -7
  14. package/src/parser/block/extension/aside.ts +1 -1
  15. package/src/parser/block/extension/example.ts +1 -1
  16. package/src/parser/block/extension/fig.ts +4 -4
  17. package/src/parser/block/extension/figbase.ts +1 -1
  18. package/src/parser/block/extension/figure.ts +3 -3
  19. package/src/parser/block/extension/message.ts +1 -1
  20. package/src/parser/block/extension/table.ts +8 -8
  21. package/src/parser/block/heading.ts +1 -1
  22. package/src/parser/block/ilist.ts +3 -3
  23. package/src/parser/block/mediablock.ts +1 -1
  24. package/src/parser/block/olist.ts +2 -2
  25. package/src/parser/block/pagebreak.ts +1 -1
  26. package/src/parser/block/reply/cite.ts +1 -1
  27. package/src/parser/block/sidefence.ts +6 -6
  28. package/src/parser/block/table.ts +2 -2
  29. package/src/parser/block/ulist.ts +3 -3
  30. package/src/parser/header.ts +2 -3
  31. package/src/parser/inline/annotation.ts +1 -1
  32. package/src/parser/inline/autolink/url.ts +1 -1
  33. package/src/parser/inline/code.ts +1 -1
  34. package/src/parser/inline/extension/indexer.ts +1 -1
  35. package/src/parser/inline/html.ts +1 -1
  36. package/src/parser/inline/link.ts +1 -1
  37. package/src/parser/inline/math.ts +2 -2
  38. package/src/parser/inline/remark.ts +2 -2
  39. package/src/parser/inline/ruby.ts +1 -1
  40. package/src/parser/inline/shortmedia.ts +1 -1
  41. package/src/parser/repeat.ts +8 -5
  42. package/src/parser/segment.ts +1 -2
  43. package/src/parser/source/escapable.ts +1 -1
  44. package/src/parser/source/text.test.ts +4 -0
  45. package/src/parser/source/text.ts +2 -0
  46. package/src/parser/visibility.ts +7 -6
  47. package/src/combinator/data/parser/context.test.ts +0 -62
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.298.7 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.299.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("Prism"), require("DOMPurify"));
@@ -167,129 +167,6 @@ exports.splice = splice;
167
167
 
168
168
  /***/ },
169
169
 
170
- /***/ 9888
171
- (__unused_webpack_module, exports, __webpack_require__) {
172
-
173
- "use strict";
174
-
175
-
176
- Object.defineProperty(exports, "__esModule", ({
177
- value: true
178
- }));
179
- exports.template = exports.inherit = exports.merge = exports.extend = exports.overwrite = exports.clone = exports.assign = void 0;
180
- const alias_1 = __webpack_require__(5413);
181
- const type_1 = __webpack_require__(113);
182
- const array_1 = __webpack_require__(6876);
183
- exports.assign = template((prop, target, source) => target[prop] = source[prop]);
184
- exports.clone = template((prop, target, source) => {
185
- switch ((0, type_1.type)(source[prop])) {
186
- case 'Array':
187
- return target[prop] = source[prop].slice();
188
- case 'Object':
189
- switch ((0, type_1.type)(target[prop])) {
190
- case 'Object':
191
- return target[prop] = (0, exports.clone)(empty(source[prop]), source[prop]);
192
- default:
193
- return target[prop] = source[prop];
194
- }
195
- default:
196
- return target[prop] = source[prop];
197
- }
198
- });
199
- exports.overwrite = template((prop, target, source) => {
200
- switch ((0, type_1.type)(source[prop])) {
201
- case 'Array':
202
- return target[prop] = source[prop];
203
- case 'Object':
204
- switch ((0, type_1.type)(target[prop])) {
205
- case 'Object':
206
- return (0, exports.overwrite)(target[prop], source[prop]);
207
- default:
208
- return target[prop] = (0, exports.overwrite)(empty(source[prop]), source[prop]);
209
- }
210
- default:
211
- return target[prop] = source[prop];
212
- }
213
- });
214
- exports.extend = template((prop, target, source) => {
215
- switch ((0, type_1.type)(source[prop])) {
216
- case 'undefined':
217
- return;
218
- case 'Array':
219
- return target[prop] = source[prop];
220
- case 'Object':
221
- switch ((0, type_1.type)(target[prop])) {
222
- case 'Object':
223
- return (0, exports.extend)(target[prop], source[prop]);
224
- default:
225
- return target[prop] = (0, exports.extend)(empty(source[prop]), source[prop]);
226
- }
227
- default:
228
- return target[prop] = source[prop];
229
- }
230
- });
231
- exports.merge = template((prop, target, source) => {
232
- switch ((0, type_1.type)(source[prop])) {
233
- case 'undefined':
234
- return;
235
- case 'Array':
236
- switch ((0, type_1.type)(target[prop])) {
237
- case 'Array':
238
- return target[prop] = (0, array_1.push)(target[prop], source[prop]);
239
- default:
240
- return target[prop] = source[prop].slice();
241
- }
242
- case 'Object':
243
- switch ((0, type_1.type)(target[prop])) {
244
- case 'Object':
245
- return (0, exports.merge)(target[prop], source[prop]);
246
- default:
247
- return target[prop] = (0, exports.merge)(empty(source[prop]), source[prop]);
248
- }
249
- default:
250
- return target[prop] = source[prop];
251
- }
252
- });
253
- exports.inherit = template((prop, target, source) => {
254
- switch ((0, type_1.type)(source[prop])) {
255
- case 'undefined':
256
- return;
257
- case 'Array':
258
- return target[prop] = source[prop].slice();
259
- case 'Object':
260
- switch ((0, type_1.type)(target[prop])) {
261
- case 'Object':
262
- return (0, exports.inherit)(target[prop], source[prop]);
263
- default:
264
- return target[prop] = (0, alias_1.ObjectCreate)(source[prop]);
265
- }
266
- default:
267
- return target[prop] = source[prop];
268
- }
269
- });
270
- function template(strategy) {
271
- return walk;
272
- function walk(target, ...sources) {
273
- if ((0, type_1.isPrimitive)(target)) return target;
274
- for (let i = 0; i < sources.length; ++i) {
275
- const source = sources[i];
276
- if (source === target) continue;
277
- if ((0, type_1.isPrimitive)(source)) continue;
278
- const keys = Object.keys(source);
279
- for (let i = 0; i < keys.length; ++i) {
280
- strategy(keys[i], target, source);
281
- }
282
- }
283
- return target;
284
- }
285
- }
286
- exports.template = template;
287
- function empty(source) {
288
- return source instanceof Object ? {} : (0, alias_1.ObjectCreate)(null);
289
- }
290
-
291
- /***/ },
292
-
293
170
  /***/ 6212
294
171
  (__unused_webpack_module, exports, __webpack_require__) {
295
172
 
@@ -2193,68 +2070,6 @@ True LRUにおけるLRUからの大幅な改善はすべてのアルゴリズム
2193
2070
 
2194
2071
  /***/ },
2195
2072
 
2196
- /***/ 113
2197
- (__unused_webpack_module, exports, __webpack_require__) {
2198
-
2199
- "use strict";
2200
-
2201
-
2202
- Object.defineProperty(exports, "__esModule", ({
2203
- value: true
2204
- }));
2205
- exports.isPrimitive = exports.is = exports.type = void 0;
2206
- const alias_1 = __webpack_require__(5413);
2207
- const ObjectPrototype = Object.prototype;
2208
- const ArrayPrototype = Array.prototype;
2209
- function type(value) {
2210
- const type = typeof value;
2211
- switch (type) {
2212
- case 'function':
2213
- return 'Function';
2214
- case 'object':
2215
- if (value === null) return 'null';
2216
- const tag = value[Symbol.toStringTag];
2217
- if (tag) return tag;
2218
- switch ((0, alias_1.ObjectGetPrototypeOf)(value)) {
2219
- case ArrayPrototype:
2220
- return 'Array';
2221
- case ObjectPrototype:
2222
- return 'Object';
2223
- default:
2224
- return value?.constructor?.name || (0, alias_1.toString)(value).slice(8, -1);
2225
- }
2226
- default:
2227
- return type;
2228
- }
2229
- }
2230
- exports.type = type;
2231
- function is(type, value) {
2232
- switch (type) {
2233
- case 'null':
2234
- return value === null;
2235
- case 'array':
2236
- return (0, alias_1.isArray)(value);
2237
- case 'object':
2238
- return value !== null && typeof value === type;
2239
- default:
2240
- return typeof value === type;
2241
- }
2242
- }
2243
- exports.is = is;
2244
- function isPrimitive(value) {
2245
- switch (typeof value) {
2246
- case 'function':
2247
- return false;
2248
- case 'object':
2249
- return value === null;
2250
- default:
2251
- return true;
2252
- }
2253
- }
2254
- exports.isPrimitive = isPrimitive;
2255
-
2256
- /***/ },
2257
-
2258
2073
  /***/ 1904
2259
2074
  (__unused_webpack_module, exports, __webpack_require__) {
2260
2075
 
@@ -2574,7 +2389,7 @@ exports.block = void 0;
2574
2389
  const parser_1 = __webpack_require__(605);
2575
2390
  const line_1 = __webpack_require__(8287);
2576
2391
  function block(parser, separation = true, segment = 0) {
2577
- return (0, parser_1.failsafe)(input => {
2392
+ return input => {
2578
2393
  const context = input;
2579
2394
  const {
2580
2395
  source,
@@ -2587,13 +2402,15 @@ function block(parser, separation = true, segment = 0) {
2587
2402
  return new parser_1.List();
2588
2403
  }
2589
2404
  const result = parser(input);
2590
- if (result === undefined) return;
2591
- if (separation && !(0, line_1.isEmptyline)(source, context.position)) return;
2405
+ if (result === undefined || separation && !(0, line_1.isEmptyline)(source, context.position)) {
2406
+ context.position = position;
2407
+ return;
2408
+ }
2592
2409
  if (segment !== 0 && context.segment & 1 /* Segment.write */ ^ 1 /* Segment.write */) {
2593
2410
  context.segment = segment;
2594
2411
  }
2595
2412
  return result;
2596
- });
2413
+ };
2597
2414
  }
2598
2415
  exports.block = block;
2599
2416
 
@@ -2639,7 +2456,7 @@ Object.defineProperty(exports, "__esModule", ({
2639
2456
  exports.isEmptyline = exports.firstline = exports.line = void 0;
2640
2457
  const parser_1 = __webpack_require__(605);
2641
2458
  function line(parser) {
2642
- return (0, parser_1.failsafe)(context => {
2459
+ return context => {
2643
2460
  const {
2644
2461
  source,
2645
2462
  position
@@ -2648,15 +2465,16 @@ function line(parser) {
2648
2465
  const line = firstline(source, position);
2649
2466
  context.offset += position;
2650
2467
  const result = parser((0, parser_1.input)(line, context));
2651
- context.position += position;
2652
- context.position += result && context.position === position ? line.length : 0;
2653
2468
  context.source = source;
2469
+ context.position = result ? context.position === 0 ? position + line.length : position + context.position : position;
2654
2470
  context.offset -= position;
2655
- if (result === undefined) return;
2656
- if (context.position < position + line.length && !isEmptyline(source, context.position)) return;
2471
+ if (result === undefined || context.position < position + line.length && !isEmptyline(source, context.position)) {
2472
+ context.position = position;
2473
+ return;
2474
+ }
2657
2475
  context.position = position + line.length;
2658
2476
  return result;
2659
- });
2477
+ };
2660
2478
  }
2661
2479
  exports.line = line;
2662
2480
  function firstline(source, position) {
@@ -2702,28 +2520,24 @@ Object.defineProperty(exports, "__esModule", ({
2702
2520
  }));
2703
2521
  exports.convert = void 0;
2704
2522
  const parser_1 = __webpack_require__(605);
2705
- function convert(conv, parser, empty = false) {
2706
- return (0, parser_1.failsafe)(input => {
2523
+ function convert(conv, parser) {
2524
+ return input => {
2707
2525
  const context = input;
2708
2526
  const {
2709
2527
  source,
2710
- position
2528
+ position,
2529
+ offset
2711
2530
  } = context;
2712
2531
  if (position === source.length) return;
2713
2532
  const src = conv(source.slice(position), context);
2714
2533
  if (src === '') {
2715
- if (!empty) return;
2716
2534
  context.position = source.length;
2717
2535
  return new parser_1.List();
2718
2536
  }
2719
- const {
2720
- offset,
2721
- backtracks
2722
- } = context;
2723
2537
  const result = parser((0, parser_1.subinput)(src, context));
2724
- context.position = context.source.length;
2538
+ context.position = result ? context.source.length : position;
2725
2539
  return result;
2726
- });
2540
+ };
2727
2541
  }
2728
2542
  exports.convert = convert;
2729
2543
 
@@ -2900,11 +2714,10 @@ Object.defineProperty(exports, "__esModule", ({
2900
2714
  value: true
2901
2715
  }));
2902
2716
  exports.match = void 0;
2903
- const parser_1 = __webpack_require__(605);
2904
2717
  const combinator_1 = __webpack_require__(3484);
2905
2718
  function match(pattern, f) {
2906
2719
  const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
2907
- return (0, parser_1.failsafe)(input => {
2720
+ return input => {
2908
2721
  const context = input;
2909
2722
  const {
2910
2723
  source,
@@ -2916,9 +2729,9 @@ function match(pattern, f) {
2916
2729
  if (!params) return;
2917
2730
  count && (0, combinator_1.consume)(params[0].length, context);
2918
2731
  const result = f(params)(input);
2919
- context.position += result && context.position === position ? params[0].length : 0;
2732
+ context.position += result ? context.position === position ? params[0].length : 0 : context.position - position;
2920
2733
  return result;
2921
- });
2734
+ };
2922
2735
  }
2923
2736
  exports.match = match;
2924
2737
 
@@ -2989,6 +2802,7 @@ function focus(scope, parser, slice = true) {
2989
2802
  const match = (0, delimiter_1.matcher)(scope, false);
2990
2803
  return (0, parser_1.failsafe)(context => {
2991
2804
  const {
2805
+ SID,
2992
2806
  source,
2993
2807
  position
2994
2808
  } = context;
@@ -3003,9 +2817,10 @@ function focus(scope, parser, slice = true) {
3003
2817
  }
3004
2818
  context.offset += position;
3005
2819
  const result = parser((0, parser_1.input)(src, context));
2820
+ context.source = source;
2821
+ context.SID = SID;
3006
2822
  context.position += position;
3007
2823
  context.position += result && context.position === position ? src.length : 0;
3008
- context.source = source;
3009
2824
  context.offset -= position;
3010
2825
  return result;
3011
2826
  });
@@ -3014,6 +2829,7 @@ exports.focus = focus;
3014
2829
  function rewrite(scope, parser, slice = true) {
3015
2830
  return (0, parser_1.failsafe)(context => {
3016
2831
  const {
2832
+ SID,
3017
2833
  source,
3018
2834
  position
3019
2835
  } = context;
@@ -3030,9 +2846,10 @@ function rewrite(scope, parser, slice = true) {
3030
2846
  const src = source.slice(position, context.position);
3031
2847
  context.offset += position;
3032
2848
  const res2 = parser((0, parser_1.input)(src, context));
2849
+ context.SID = SID;
2850
+ context.source = source;
3033
2851
  context.position += position;
3034
2852
  context.position += res2 && context.position === position ? src.length : 0;
3035
- context.source = source;
3036
2853
  context.offset -= position;
3037
2854
  return res2;
3038
2855
  });
@@ -3171,7 +2988,7 @@ function revert(context, linebreak) {
3171
2988
  /***/ },
3172
2989
 
3173
2990
  /***/ 994
3174
- (__unused_webpack_module, exports, __webpack_require__) {
2991
+ (__unused_webpack_module, exports) {
3175
2992
 
3176
2993
  "use strict";
3177
2994
 
@@ -3180,20 +2997,27 @@ Object.defineProperty(exports, "__esModule", ({
3180
2997
  value: true
3181
2998
  }));
3182
2999
  exports.bind = void 0;
3183
- const parser_1 = __webpack_require__(605);
3184
3000
  function bind(parser, f) {
3185
- return (0, parser_1.failsafe)(input => {
3001
+ return input => {
3186
3002
  const context = input;
3187
3003
  const {
3188
3004
  source,
3189
3005
  position
3190
3006
  } = context;
3191
3007
  if (position === source.length) return;
3192
- const result = parser(input);
3193
- if (result === undefined) return;
3008
+ const res1 = parser(input);
3009
+ if (res1 === undefined) {
3010
+ context.position = position;
3011
+ return;
3012
+ }
3194
3013
  context.range = context.position - position;
3195
- return f(result, context);
3196
- });
3014
+ const res2 = f(res1, context);
3015
+ if (res2 === undefined) {
3016
+ context.position = position;
3017
+ return;
3018
+ }
3019
+ return res2;
3020
+ };
3197
3021
  }
3198
3022
  exports.bind = bind;
3199
3023
 
@@ -3682,6 +3506,10 @@ class Context {
3682
3506
  this.offset = offset ?? 0;
3683
3507
  this.backtracks = backtracks ?? {};
3684
3508
  }
3509
+ clone() {
3510
+ // @ts-ignore
3511
+ return new this.constructor(this);
3512
+ }
3685
3513
  }
3686
3514
  exports.Context = Context;
3687
3515
  function input(source, context) {
@@ -3692,14 +3520,12 @@ function input(source, context) {
3692
3520
  }
3693
3521
  exports.input = input;
3694
3522
  function subinput(source, context) {
3695
- return {
3696
- ...context,
3697
- SID: sid(),
3698
- source,
3699
- position: 0,
3700
- offset: 0,
3701
- backtracks: {}
3702
- };
3523
+ const c = context.clone();
3524
+ c.source = source;
3525
+ c.position = 0;
3526
+ c.offset = 0;
3527
+ c.backtracks = {};
3528
+ return c;
3703
3529
  }
3704
3530
  exports.subinput = subinput;
3705
3531
  function failsafe(parser) {
@@ -3721,69 +3547,8 @@ exports.failsafe = failsafe;
3721
3547
  Object.defineProperty(exports, "__esModule", ({
3722
3548
  value: true
3723
3549
  }));
3724
- exports.constraint = exports.state = exports.precedence = exports.recursions = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
3550
+ exports.constraint = exports.state = exports.precedence = exports.recursions = exports.recursion = exports.consume = exports.creation = void 0;
3725
3551
  const alias_1 = __webpack_require__(5413);
3726
- const assign_1 = __webpack_require__(9888);
3727
- function reset(base, parser) {
3728
- const clock = base.resources?.clock;
3729
- const recursions = base.resources?.recursions;
3730
- return input => {
3731
- const context = input;
3732
- // @ts-expect-error
3733
- context.resources ??= {
3734
- clock,
3735
- recursions: recursions?.slice()
3736
- };
3737
- context.backtracks = {};
3738
- return parser(input);
3739
- };
3740
- // removed by dead control flow
3741
-
3742
- // removed by dead control flow
3743
-
3744
- // removed by dead control flow
3745
-
3746
- }
3747
- exports.reset = reset;
3748
- function context(base, parser) {
3749
- const changes = Object.entries(base);
3750
- const values = Array(changes.length);
3751
- return context => apply(parser, context, changes, values);
3752
- }
3753
- exports.context = context;
3754
- function apply(parser, context, changes, values, reset = false) {
3755
- for (let i = 0; i < changes.length; ++i) {
3756
- const change = changes[i];
3757
- const prop = change[0];
3758
- switch (prop) {
3759
- case 'source':
3760
- case 'position':
3761
- continue;
3762
- case 'resources':
3763
- values[i] = context[prop];
3764
- context[prop] ??= (0, assign_1.clone)({}, change[1]);
3765
- continue;
3766
- case 'backtracks':
3767
- change[1] = {};
3768
- }
3769
- values[i] = context[prop];
3770
- context[prop] = change[1];
3771
- }
3772
- const result = parser(context);
3773
- for (let i = 0; i < changes.length; ++i) {
3774
- const change = changes[i];
3775
- const prop = change[0];
3776
- switch (prop) {
3777
- case 'source':
3778
- case 'position':
3779
- continue;
3780
- case 'resources':
3781
- }
3782
- context[prop] = values[i];
3783
- values[i] = undefined;
3784
- }
3785
- return result;
3786
- }
3787
3552
  function creation(cost, parser) {
3788
3553
  return input => {
3789
3554
  const context = input;
@@ -4732,11 +4497,11 @@ const parse_1 = __webpack_require__(3662);
4732
4497
  const dom_1 = __webpack_require__(394);
4733
4498
  exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+ /y, (0, combinator_1.some)(source_1.contentline))]));
4734
4499
  exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.union)([(0, combinator_1.open)(/(?=>)/y, source), (0, combinator_1.open)(/!(?=>)/y, markdown)]))));
4735
- const opener = /(?=>>+(?:$|[ \n]))/y;
4736
- const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y));
4737
- const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
4738
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4739
- const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, context => {
4500
+ const opener = /(?=>>+(?:$|[ \r\n]))/y;
4501
+ const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \r\n])/y));
4502
+ const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \r\n])))|\r?\n$/g, '');
4503
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4504
+ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.blockquote */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, context => {
4740
4505
  (0, combinator_1.consume)(10, context);
4741
4506
  const {
4742
4507
  source
@@ -4753,7 +4518,7 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4753
4518
  }, context);
4754
4519
  context.position = source.length;
4755
4520
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
4756
- }, true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4521
+ }))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4757
4522
 
4758
4523
  /***/ },
4759
4524
 
@@ -4887,7 +4652,7 @@ const indexee_1 = __webpack_require__(7610);
4887
4652
  const util_1 = __webpack_require__(4992);
4888
4653
  const parse_1 = __webpack_require__(3662);
4889
4654
  const dom_1 = __webpack_require__(394);
4890
- exports.aside = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/y, 300),
4655
+ exports.aside = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})aside(?!\S)([^\r\n]*)(?:$|\r?\n)/y, 300),
4891
4656
  // Bug: Type mismatch between outer and inner.
4892
4657
  (nodes, context) => {
4893
4658
  const [body, overflow, closer, opener, delim, param] = (0, util_1.unwrap)(nodes);
@@ -4936,7 +4701,7 @@ const mathblock_1 = __webpack_require__(4903);
4936
4701
  const util_1 = __webpack_require__(4992);
4937
4702
  const parse_1 = __webpack_require__(3662);
4938
4703
  const dom_1 = __webpack_require__(394);
4939
- exports.example = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y, 300),
4704
+ exports.example = (0, combinator_1.block)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:example\/(\S+))?(?!\S)([^\r\n]*)(?:$|\r?\n)/y, 300),
4940
4705
  // Bug: Type mismatch between outer and inner.
4941
4706
  (nodes, context) => {
4942
4707
  const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
@@ -5003,21 +4768,21 @@ const table_1 = __webpack_require__(3646);
5003
4768
  const blockquote_1 = __webpack_require__(5885);
5004
4769
  const placeholder_1 = __webpack_require__(4091);
5005
4770
  const inline_1 = __webpack_require__(7973);
5006
- exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\r?\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]), true, 8 /* Segment.fig */);
4771
+ exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S)[^\r\n]*\r?\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]), true, 8 /* Segment.fig */);
5007
4772
  exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
5008
4773
  // Bug: TypeScript
5009
- const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/gm) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
4774
+ const fence = (/^[^\r\n]*\r?\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\r\n]*$)/gm) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
5010
4775
  const {
5011
4776
  position
5012
4777
  } = context;
5013
4778
  const result = parser(context);
5014
4779
  context.position = position;
5015
4780
  context.segment = 10 /* Segment.figure */ | 1 /* Segment.write */;
5016
- return result ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4781
+ return result ? `${fence}figure ${source.replace(/^([^\r\n]+\r?\n[^\r\n]+\r?\n)(.+?)\r?\n?$/s, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
5017
4782
  }, (0, combinator_1.union)([figure_1.figure])), ([{
5018
4783
  value: el
5019
4784
  }]) => el.tagName === 'FIGURE')));
5020
- const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
4785
+ const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S)[^\r\n]*\r?\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
5021
4786
 
5022
4787
  /***/ },
5023
4788
 
@@ -5035,7 +4800,7 @@ const parser_1 = __webpack_require__(605);
5035
4800
  const combinator_1 = __webpack_require__(3484);
5036
4801
  const label_1 = __webpack_require__(2178);
5037
4802
  const dom_1 = __webpack_require__(394);
5038
- exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\n]*(?:$|\n)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
4803
+ exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\r\n]*(?:$|\r?\n)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
5039
4804
  value: el
5040
4805
  }]) => {
5041
4806
  const label = el.getAttribute('data-label');
@@ -5080,16 +4845,16 @@ const dom_1 = __webpack_require__(394);
5080
4845
  exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure )?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\r\n]*(?:$|\r?\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
5081
4846
  // All parsers which can include closing terms.
5082
4847
  (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length - 1, [], 2 ** 4 - 1)), true, 10 /* Segment.figure */);
5083
- exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?!\S).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])])), nodes => {
4848
+ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?!\S)[^\r\n]*\r?\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])])), nodes => {
5084
4849
  const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
5085
4850
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
5086
4851
  class: 'figindex'
5087
4852
  }), (0, dom_1.html)('span', {
5088
4853
  class: 'figtext'
5089
4854
  }, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])]))]);
5090
- })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \n])|\[?\$)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
4855
+ })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \r\n])|\[?\$)[^\r\n]*(?:$|\r?\n)/y, 300), (nodes, context) => {
5091
4856
  const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
5092
- const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure )?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure )?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
4857
+ const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure )?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure )?(\[?\$\S+)[^\S\r\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
5093
4858
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', {
5094
4859
  class: 'invalid',
5095
4860
  translate: 'no',
@@ -5163,7 +4928,7 @@ const paragraph_1 = __webpack_require__(4330);
5163
4928
  const util_1 = __webpack_require__(4992);
5164
4929
  const array_1 = __webpack_require__(6876);
5165
4930
  const dom_1 = __webpack_require__(394);
5166
- exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)(?!\S)([^\n]*)(?:$|\n)/y, 300),
4931
+ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)(?!\S)([^\r\n]*)(?:$|\r?\n)/y, 300),
5167
4932
  // Bug: Type mismatch between outer and inner.
5168
4933
  (nodes, context) => {
5169
4934
  const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
@@ -5281,13 +5046,13 @@ exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.
5281
5046
  }));
5282
5047
  const parser = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([row])), rows => new parser_1.List([new parser_1.Node((0, dom_1.html)('table', format([...(0, util_1.unwrap)(rows)])))]))));
5283
5048
  const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.union)([align]), (0, combinator_1.some)((0, combinator_1.union)([head, data, (0, combinator_1.some)(dataline, alignment), source_1.emptyline]))]), ns => Array.isArray(ns.head?.value) ? ns : ns.unshift(new parser_1.Node([[]])) && ns)));
5284
- const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
5049
+ const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\r\n]*\r?\n)/y;
5285
5050
  const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
5286
5051
  value
5287
5052
  }]) => new parser_1.List([new parser_1.Node(value.split('/').map(s => s.split('')))])));
5288
- const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y;
5289
- const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5290
- const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5053
+ const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\r\n]*\r?\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \r\n])/y;
5054
+ const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \r\n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\r\n]*(?:$|\r?\n)/y)), (0, combinator_1.open)(/(?:[^\S\r\n]*\r?\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5055
+ const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \r\n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\r\n]*(?:$|\r?\n)/y)), (0, combinator_1.open)(/(?:[^\S\r\n]*\r?\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5291
5056
  const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+ /y, (0, combinator_1.convert)(source => `:${source}`, data)), (0, combinator_1.convert)(source => `: ${source}`, data)])));
5292
5057
  function attributes(source) {
5293
5058
  let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
@@ -5508,7 +5273,7 @@ const source_1 = __webpack_require__(8745);
5508
5273
  const visibility_1 = __webpack_require__(6364);
5509
5274
  const util_1 = __webpack_require__(4992);
5510
5275
  const dom_1 = __webpack_require__(394);
5511
- exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\r\n]*(?:\r?\n#+(?=$| |\r?\n)[^\r\n]*)*(?:$|\r?\n)/y, input => {
5276
+ exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\r\n]*(?:\r?\n#+(?=$|[ \r\n])[^\r\n]*)*(?:$|\r?\n)/y, input => {
5512
5277
  const context = input;
5513
5278
  const {
5514
5279
  source,
@@ -5556,7 +5321,7 @@ const visibility_1 = __webpack_require__(6364);
5556
5321
  const util_1 = __webpack_require__(4992);
5557
5322
  const dom_1 = __webpack_require__(394);
5558
5323
  exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
5559
- exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.recursion)(2 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('ul', {
5324
+ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \r\n])/y, (0, combinator_1.recursion)(2 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \r\n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('ul', {
5560
5325
  class: 'invalid',
5561
5326
  ...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
5562
5327
  }, (0, util_1.unwrap)(ns)))]))));
@@ -5567,7 +5332,7 @@ exports.ilistitem = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.
5567
5332
  }) => new parser_1.List([new parser_1.Node(''), new parser_1.Node((0, dom_1.html)('span', {
5568
5333
  class: 'invalid',
5569
5334
  ...(0, util_1.invalid)('list', 'syntax', 'Fix the indent or the head of the list item')
5570
- }, source.replace('\n', '')))]));
5335
+ }, source.replace(/\r?\n/, '')))]));
5571
5336
 
5572
5337
  /***/ },
5573
5338
 
@@ -5628,7 +5393,7 @@ exports.mediablock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinat
5628
5393
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
5629
5394
  class: 'invalid',
5630
5395
  ...(0, util_1.invalid)('mediablock', 'syntax', 'Not media syntax')
5631
- }, source.replace('\n', '')))]))))]), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5396
+ }, source.replace(/\r?\n/, '')))]))))]), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('div', (0, util_1.unwrap)(ns)))])));
5632
5397
 
5633
5398
  /***/ },
5634
5399
 
@@ -5652,8 +5417,8 @@ const visibility_1 = __webpack_require__(6364);
5652
5417
  const memoize_1 = __webpack_require__(6925);
5653
5418
  const dom_1 = __webpack_require__(394);
5654
5419
  const openers = {
5655
- '.': /([0-9]+|[a-z]+|[A-Z]+)(?:-(?=$|[0-9\n])[0-9]*)*(?:\.?(?:$|[\n])|\. )/y,
5656
- '(': /\((?=$|[0-9a-z\n])([0-9]*|[a-z]*)(?=$|[)\n])\)?(?:-(?=$|[0-9\n])[0-9]*)*(?:$|[ \n])/y
5420
+ '.': /([0-9]+|[a-z]+|[A-Z]+)(?:-(?=$|[0-9\r\n])[0-9]*)*(?:\.?(?:$|[\r\n])|\. )/y,
5421
+ '(': /\((?=$|[0-9a-z\r\n])([0-9]*|[a-z]*)(?=$|[)\r\n])\)?(?:-(?=$|[0-9\r\n])[0-9]*)*(?:$|[ \r\n])/y
5657
5422
  };
5658
5423
  exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/(?:[0-9]+)(?:-[0-9]+)*\. /y.source, /\((?:[0-9]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
5659
5424
  exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => idx(ms[1]), [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => idx(ms[1]), []))])));
@@ -5772,7 +5537,7 @@ exports.pagebreak = void 0;
5772
5537
  const parser_1 = __webpack_require__(605);
5773
5538
  const combinator_1 = __webpack_require__(3484);
5774
5539
  const dom_1 = __webpack_require__(394);
5775
- exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\n]*(?:$|\n)/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('hr'))]))));
5540
+ exports.pagebreak = (0, combinator_1.block)((0, combinator_1.line)((0, combinator_1.focus)(/={3,}[^\S\r\n]*(?:$|\r?\n)/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('hr'))]))));
5776
5541
 
5777
5542
  /***/ },
5778
5543
 
@@ -5839,7 +5604,7 @@ const anchor_1 = __webpack_require__(8535);
5839
5604
  const source_1 = __webpack_require__(8745);
5840
5605
  const util_1 = __webpack_require__(4992);
5841
5606
  const dom_1 = __webpack_require__(394);
5842
- exports.syntax = />*(?=>>[^>\s]\S*[^\S\n]*(?:$|\n))/y;
5607
+ exports.syntax = />*(?=>>[^>\s]\S*[^\S\r\n]*(?:$|\r?\n))/y;
5843
5608
  exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(exports.syntax), (0, combinator_1.union)([(0, combinator_1.line)(anchor_1.anchor),
5844
5609
  // Subject page representation.
5845
5610
  // リンクの実装は後で検討
@@ -5915,16 +5680,16 @@ const autolink_1 = __webpack_require__(1671);
5915
5680
  const source_1 = __webpack_require__(8745);
5916
5681
  const util_1 = __webpack_require__(4992);
5917
5682
  const dom_1 = __webpack_require__(394);
5918
- exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/\|+ [^\n]*(?:\n\|+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.union)([source])), ([{
5683
+ exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/\|+ [^\r\n]*(?:\r?\n\|+(?=$|[ \r\n])[^\r\n]*)*(?:$|\r?\n)/y, (0, combinator_1.union)([source])), ([{
5919
5684
  value
5920
5685
  }]) => new parser_1.List([new parser_1.Node((0, dom_1.define)(value, {
5921
5686
  class: 'invalid',
5922
5687
  ...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
5923
5688
  }))]))));
5924
- const opener = /(?=\|\|+(?:$|[ \n]))/y;
5925
- const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, /\|(?:$|[ \n])/y));
5926
- const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
5927
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5689
+ const opener = /(?=\|\|+(?:$|[ \r\n]))/y;
5690
+ const indent = (0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, /\|(?:$|[ \r\n])/y));
5691
+ const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \r\n])))|\r?\n$/g, '');
5692
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(0 /* Recursion.block */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5928
5693
 
5929
5694
  /***/ },
5930
5695
 
@@ -5947,13 +5712,13 @@ const util_1 = __webpack_require__(4992);
5947
5712
  const duff_1 = __webpack_require__(9202);
5948
5713
  const array_1 = __webpack_require__(6876);
5949
5714
  const dom_1 = __webpack_require__(394);
5950
- exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*\n\|[-:][^\n]*\n\|/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => new parser_1.List([new parser_1.Node((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
5715
+ exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\r\n]*\r?\n\|[-:][^\r\n]*\r?\n\|/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => new parser_1.List([new parser_1.Node((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
5951
5716
  const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /\|?\s*$/y, optional)), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
5952
5717
  source
5953
5718
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('tr', {
5954
5719
  class: 'invalid',
5955
5720
  ...(0, util_1.invalid)('table-row', 'syntax', 'Missing the start symbol of the table row')
5956
- }, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
5721
+ }, [(0, dom_1.html)('td', source.replace(/\r?\n/, ''))]))])));
5957
5722
  const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/:-+:?/y, ({
5958
5723
  source,
5959
5724
  position,
@@ -6003,10 +5768,10 @@ const visibility_1 = __webpack_require__(6364);
6003
5768
  const util_1 = __webpack_require__(4992);
6004
5769
  const dom_1 = __webpack_require__(394);
6005
5770
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)('- ', exports.ulist_)));
6006
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.recursion)(2 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
5771
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \r\n])/y, (0, combinator_1.recursion)(2 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \r\n])/y, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
6007
5772
  'data-index': (0, inline_1.dataindex)(ns)
6008
5773
  }, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
6009
- exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
5774
+ exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \r\n])/y, ({
6010
5775
  source,
6011
5776
  position
6012
5777
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
@@ -6115,9 +5880,8 @@ const parser_1 = __webpack_require__(605);
6115
5880
  const combinator_1 = __webpack_require__(3484);
6116
5881
  const source_1 = __webpack_require__(8745);
6117
5882
  const util_1 = __webpack_require__(4992);
6118
- const normalize_1 = __webpack_require__(4490);
6119
5883
  const dom_1 = __webpack_require__(394);
6120
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
5884
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.convert)(source => source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
6121
5885
  class: 'header'
6122
5886
  }, [(0, dom_1.html)('details', {
6123
5887
  open: ''
@@ -6131,7 +5895,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
6131
5895
  class: 'invalid',
6132
5896
  translate: 'no',
6133
5897
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
6134
- }, (0, normalize_1.normalize)(source.slice(position))))]);
5898
+ }, source.slice(position)))]);
6135
5899
  }])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\r\n]*\r?\n/y))])));
6136
5900
  const field = (0, combinator_1.line)(({
6137
5901
  source,
@@ -6357,7 +6121,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1
6357
6121
  for (let i = 0; i < prefix; ++i) {
6358
6122
  nodes.unshift(new parser_1.Node('('));
6359
6123
  nodes = new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
6360
- class: (0, bracket_1.bracketname)(context, 1, 0)
6124
+ class: (0, bracket_1.bracketname)(context, 0, 0)
6361
6125
  }, (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
6362
6126
  context.range += 1;
6363
6127
  }
@@ -6599,7 +6363,7 @@ const inline_1 = __webpack_require__(7973);
6599
6363
  const link_1 = __webpack_require__(3628);
6600
6364
  const source_1 = __webpack_require__(8745);
6601
6365
  exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, bracket)]), [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, context => new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6602
- exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, context => {
6366
+ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\r\n]*(?=$|\r?\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, context => {
6603
6367
  const {
6604
6368
  source,
6605
6369
  position
@@ -6717,7 +6481,7 @@ const parser_1 = __webpack_require__(605);
6717
6481
  const combinator_1 = __webpack_require__(3484);
6718
6482
  const util_1 = __webpack_require__(4992);
6719
6483
  const dom_1 = __webpack_require__(394);
6720
- exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
6484
+ exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\r\n]*?)(?:((?<!`)\1(?!`))|(?=$|\r?\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
6721
6485
  'data-src': whole
6722
6486
  }, format(body)))]) : body ? new parser_1.List([new parser_1.Node((0, dom_1.html)('code', {
6723
6487
  class: 'invalid',
@@ -7164,7 +6928,7 @@ const dom_1 = __webpack_require__(394);
7164
6928
  exports.indexer = (0, combinator_1.validate)(' [|', (0, combinator_1.surround)(/ \[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7165
6929
  class: 'indexer',
7166
6930
  'data-index': ''
7167
- }))]))]), /\][^\S\n]*(?:$|\n)/y));
6931
+ }))]))]), /\][^\S\r\n]*(?:$|\r?\n)/y));
7168
6932
 
7169
6933
  /***/ },
7170
6934
 
@@ -7275,7 +7039,7 @@ exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combina
7275
7039
  (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag2index(tag), Array(exports.TAGS.length))), (0, combinator_1.surround)(
7276
7040
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
7277
7041
  (0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))]));
7278
- exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
7042
+ exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\r\n]|[^\\\r\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
7279
7043
  function elem(tag, content, as, bs, cs, context) {
7280
7044
  if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
7281
7045
  if (content) {
@@ -7480,7 +7244,7 @@ exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8
7480
7244
  value: params
7481
7245
  }], context) => new parser_1.List([new parser_1.Node(parse(content, params, context))])))));
7482
7246
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(' ', (0, source_1.str)(/\S+/y)), (0, source_1.str)(/[^\s{}]+/y)]);
7483
- exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Node(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
7247
+ exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/ nofollow(?=[ }])/y), () => new parser_1.List([new parser_1.Node(' rel="nofollow"')])), (0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\r\n]|[^\\\r\n"])*")?(?=[ }])/yi), (0, source_1.str)(/ [^\s{}]+/y)]);
7484
7248
  function parse(content, params, context) {
7485
7249
  const INSECURE_URI = params.shift().value;
7486
7250
  (0, combinator_1.consume)(10, context);
@@ -7626,7 +7390,7 @@ const source_1 = __webpack_require__(8745);
7626
7390
  const util_1 = __webpack_require__(4992);
7627
7391
  const dom_1 = __webpack_require__(394);
7628
7392
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
7629
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 16 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /(?<!\s)\$(?![-0-9A-Za-z])/y, false, [3 | 16 /* Backtrack.escapable */])]), ({
7393
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 16 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\$|[`"{}\r\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /(?<!\s)\$(?![-0-9A-Za-z])/y, false, [3 | 16 /* Backtrack.escapable */])]), ({
7630
7394
  source,
7631
7395
  caches: {
7632
7396
  math: cache
@@ -7640,7 +7404,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
7640
7404
  translate: 'no',
7641
7405
  ...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
7642
7406
  }, source))])));
7643
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\n]/y)]))), (0, source_1.str)('}'), true));
7407
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\r\n]/y)]))), (0, source_1.str)('}'), true));
7644
7408
 
7645
7409
  /***/ },
7646
7410
 
@@ -7869,11 +7633,11 @@ const inline_1 = __webpack_require__(7973);
7869
7633
  const source_1 = __webpack_require__(8745);
7870
7634
  const util_1 = __webpack_require__(4992);
7871
7635
  const dom_1 = __webpack_require__(394);
7872
- exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)('%]')), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7636
+ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \r\n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)('%]')), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7873
7637
  class: 'remark'
7874
7638
  }, [(0, dom_1.html)('input', {
7875
7639
  type: 'checkbox'
7876
- }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=[ \n])/y, ({
7640
+ }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=[ \r\n])/y, ({
7877
7641
  source
7878
7642
  }) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
7879
7643
  class: 'invalid',
@@ -7932,7 +7696,7 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
7932
7696
  }) => acc ? acc + ' ' + value : value, '').trim())), new parser_1.Node((0, dom_1.html)('rp', ')'))])))))]);
7933
7697
  }
7934
7698
  }));
7935
- const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
7699
+ const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\r?\n/y;
7936
7700
  const text = input => {
7937
7701
  const context = input;
7938
7702
  const {
@@ -7998,7 +7762,7 @@ const combinator_1 = __webpack_require__(3484);
7998
7762
  const url_1 = __webpack_require__(2129);
7999
7763
  const media_1 = __webpack_require__(7478);
8000
7764
  exports.shortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.rewrite)((0, combinator_1.open)('!', url_1.url), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
8001
- exports.lineshortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.focus)(/(?<=^|[\r\n])!https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/y, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
7765
+ exports.lineshortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.focus)(/(?<=^|[\r\n])!https?:\/\/\S+(?=[^\S\r\n]*(?:$|\r?\n))/y, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
8002
7766
 
8003
7767
  /***/ },
8004
7768
 
@@ -8404,7 +8168,7 @@ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, c
8404
8168
  return acc;
8405
8169
  }) {
8406
8170
  const test = (0, delimiter_1.tester)(after, false);
8407
- return (0, parser_1.failsafe)(input => {
8171
+ return input => {
8408
8172
  const context = input;
8409
8173
  const {
8410
8174
  source,
@@ -8418,7 +8182,10 @@ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, c
8418
8182
  let i = opener.length;
8419
8183
  for (; source[context.position + i] === source[context.position];) ++i;
8420
8184
  context.position += i;
8421
- if (test(input) === undefined) return;
8185
+ if (test(input) === undefined) {
8186
+ context.position = position;
8187
+ return;
8188
+ }
8422
8189
  let depth = i / opener.length + 1 | 0;
8423
8190
  if (recursions) for (const recursion of rs) {
8424
8191
  const rec = (0, alias_1.min)(recursion, recursions.length - 1);
@@ -8493,9 +8260,9 @@ function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, c
8493
8260
  ++i;
8494
8261
  }
8495
8262
  const postfix = i;
8496
- context.range = context.position - position - prefix - postfix;
8263
+ context.range = context.position - position - prefix;
8497
8264
  return termination(nodes, context, prefix, postfix, state);
8498
- });
8265
+ };
8499
8266
  }
8500
8267
  exports.repeat = repeat;
8501
8268
  function countFollows(source, position, closer, limit) {
@@ -8526,7 +8293,6 @@ const codeblock_1 = __webpack_require__(9194);
8526
8293
  const mathblock_1 = __webpack_require__(4903);
8527
8294
  const extension_1 = __webpack_require__(6193);
8528
8295
  const source_1 = __webpack_require__(8745);
8529
- const api_1 = __webpack_require__(5886);
8530
8296
  const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptysegment, context_1.MAX_SEGMENT_SIZE + 1), input => {
8531
8297
  const {
8532
8298
  source,
@@ -8564,7 +8330,7 @@ function* segment(source, initial = true) {
8564
8330
  position = context.position;
8565
8331
  for (let i = 0; i < segs.length; ++i) {
8566
8332
  const seg = segs[i];
8567
- initial && !validate(seg, context_1.MAX_SEGMENT_SIZE) ? yield [`${"\u0007" /* Command.Error */}Too large segment over ${context_1.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`, 0 /* Segment.unknown */] : yield [initial ? (0, api_1.normalize)(seg) : seg, context.segment];
8333
+ initial && !validate(seg, context_1.MAX_SEGMENT_SIZE) ? yield [`${"\u0007" /* Command.Error */}Too large segment over ${context_1.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`, 0 /* Segment.unknown */] : yield [seg, context.segment];
8568
8334
  }
8569
8335
  }
8570
8336
  }
@@ -8686,7 +8452,7 @@ const escsource = context => {
8686
8452
  case '\\':
8687
8453
  switch (source[position + 1]) {
8688
8454
  case undefined:
8689
- return new parser_1.List([new parser_1.Node(char)]);
8455
+ case '\r':
8690
8456
  case '\n':
8691
8457
  return new parser_1.List([new parser_1.Node(char)]);
8692
8458
  default:
@@ -8860,6 +8626,7 @@ const text = input => {
8860
8626
  switch (source[position + 1]) {
8861
8627
  case undefined:
8862
8628
  return new parser_1.List();
8629
+ case '\r':
8863
8630
  case '\n':
8864
8631
  return new parser_1.List();
8865
8632
  default:
@@ -8877,7 +8644,7 @@ const text = input => {
8877
8644
  exports.nonWhitespace.lastIndex = position + 1;
8878
8645
  const s = canSkip(source, position);
8879
8646
  let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position, state);
8880
- const lineend = false || s && i === source.length || s && source[i] === '\n';
8647
+ const lineend = false || s && i === source.length || s && source[i] === '\r' || s && source[i] === '\n';
8881
8648
  i -= position;
8882
8649
  i = lineend ? i : i - +s || 1;
8883
8650
  (0, combinator_1.consume)(i - 1, context);
@@ -9194,9 +8961,9 @@ const combinator_1 = __webpack_require__(3484);
9194
8961
  const normalize_1 = __webpack_require__(4490);
9195
8962
  var blank;
9196
8963
  (function (blank) {
9197
- blank.line = new RegExp(/((?:^|\n)[^\S\n]*(?=\S))((?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+(?=$|\n))/g.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'g');
9198
- blank.start = new RegExp(/(?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
9199
- blank.unit = new RegExp(/(?:[^\S\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
8964
+ blank.line = new RegExp(/((?:^|\n)[^\S\r\n]*(?=\S))((?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+(?=$|\r?\n))/g.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'g');
8965
+ blank.start = new RegExp(/(?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)+/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
8966
+ blank.unit = new RegExp(/(?:[^\S\r\n]|\\(?=$|\s)|&IBHN;|<wbr ?>)/y.source.replace('IBHN', `(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')})`), 'y');
9200
8967
  })(blank || (blank = {}));
9201
8968
  function visualize(parser) {
9202
8969
  return (0, combinator_1.convert)(source => source.replace(blank.line, `$1${"\u001B" /* Command.Escape */}$2`), parser);
@@ -9243,6 +9010,7 @@ function isNonblank({
9243
9010
  case '':
9244
9011
  case ' ':
9245
9012
  case '\t':
9013
+ case '\r':
9246
9014
  case '\n':
9247
9015
  return false;
9248
9016
  default:
@@ -9254,7 +9022,7 @@ function trimBlank(parser) {
9254
9022
  }
9255
9023
  exports.trimBlank = trimBlank;
9256
9024
  function trimBlankStart(parser) {
9257
- return (0, parser_1.failsafe)(input => {
9025
+ return input => {
9258
9026
  const context = input;
9259
9027
  const {
9260
9028
  source,
@@ -9266,7 +9034,7 @@ function trimBlankStart(parser) {
9266
9034
  reg.test(source);
9267
9035
  context.position = reg.lastIndex || position;
9268
9036
  return context.position === source.length ? new parser_1.List() : parser(input);
9269
- });
9037
+ };
9270
9038
  }
9271
9039
  function trimBlankEnd(parser) {
9272
9040
  return (0, combinator_1.fmap)(parser, trimBlankNodeEnd);