@quartz-community/remark-obsidian 0.2.3 → 0.2.5

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/dist/index.js CHANGED
@@ -57,12 +57,12 @@ function propertiesFactory(check) {
57
57
  /** @type {Record<string, unknown>} */
58
58
  check
59
59
  );
60
- return castFactory(all);
61
- function all(node) {
60
+ return castFactory(all2);
61
+ function all2(node2) {
62
62
  const nodeAsRecord = (
63
63
  /** @type {Record<string, unknown>} */
64
64
  /** @type {unknown} */
65
- node
65
+ node2
66
66
  );
67
67
  let key;
68
68
  for (key in check) {
@@ -73,8 +73,8 @@ function propertiesFactory(check) {
73
73
  }
74
74
  function typeFactory(check) {
75
75
  return castFactory(type);
76
- function type(node) {
77
- return node && node.type === check;
76
+ function type(node2) {
77
+ return node2 && node2.type === check;
78
78
  }
79
79
  }
80
80
  function castFactory(testFunction) {
@@ -118,10 +118,10 @@ function visitParents(tree, test, visitor, reverse) {
118
118
  const is2 = convert(check);
119
119
  const step = reverse ? -1 : 1;
120
120
  factory(tree, void 0, [])();
121
- function factory(node, index, parents) {
121
+ function factory(node2, index, parents) {
122
122
  const value = (
123
123
  /** @type {Record<string, unknown>} */
124
- node && typeof node === "object" ? node : {}
124
+ node2 && typeof node2 === "object" ? node2 : {}
125
125
  );
126
126
  if (typeof value.type === "string") {
127
127
  const name = (
@@ -132,7 +132,7 @@ function visitParents(tree, test, visitor, reverse) {
132
132
  )
133
133
  );
134
134
  Object.defineProperty(visit2, "name", {
135
- value: "node (" + color(node.type + (name ? "<" + name + ">" : "")) + ")"
135
+ value: "node (" + color(node2.type + (name ? "<" + name + ">" : "")) + ")"
136
136
  });
137
137
  }
138
138
  return visit2;
@@ -141,16 +141,16 @@ function visitParents(tree, test, visitor, reverse) {
141
141
  let subresult;
142
142
  let offset;
143
143
  let grandparents;
144
- if (!test || is2(node, index, parents[parents.length - 1] || void 0)) {
145
- result = toResult(visitor(node, parents));
144
+ if (!test || is2(node2, index, parents[parents.length - 1] || void 0)) {
145
+ result = toResult(visitor(node2, parents));
146
146
  if (result[0] === EXIT) {
147
147
  return result;
148
148
  }
149
149
  }
150
- if ("children" in node && node.children) {
150
+ if ("children" in node2 && node2.children) {
151
151
  const nodeAsParent = (
152
152
  /** @type {UnistParent} */
153
- node
153
+ node2
154
154
  );
155
155
  if (nodeAsParent.children && result[0] !== SKIP) {
156
156
  offset = (reverse ? nodeAsParent.children.length : -1) + step;
@@ -194,10 +194,10 @@ function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
194
194
  reverse = maybeReverse;
195
195
  }
196
196
  visitParents(tree, test, overload, reverse);
197
- function overload(node, parents) {
197
+ function overload(node2, parents) {
198
198
  const parent = parents[parents.length - 1];
199
- const index = parent ? parent.children.indexOf(node) : void 0;
200
- return visitor(node, index, parent);
199
+ const index = parent ? parent.children.indexOf(node2) : void 0;
200
+ return visitor(node2, index, parent);
201
201
  }
202
202
  }
203
203
 
@@ -453,8 +453,8 @@ var LEFT_BRACKET = 91;
453
453
  var BACKSLASH = 92;
454
454
  var RIGHT_BRACKET = 93;
455
455
  var PIPE = 124;
456
- function isLineEnding(code) {
457
- return code === codes.lineFeed || code === codes.carriageReturn;
456
+ function isLineEnding(code2) {
457
+ return code2 === codes.lineFeed || code2 === codes.carriageReturn || code2 === codes.carriageReturnLineFeed;
458
458
  }
459
459
  function wikilinkSyntax() {
460
460
  return {
@@ -469,151 +469,151 @@ function tokenize(effects, ok3, nok) {
469
469
  let hasHeading = false;
470
470
  let hasAlias = false;
471
471
  return start;
472
- function start(code) {
473
- if (code === EXCLAMATION) {
472
+ function start(code2) {
473
+ if (code2 === EXCLAMATION) {
474
474
  effects.enter("wikilink");
475
475
  effects.enter("wikilinkEmbedMarker");
476
- effects.consume(code);
476
+ effects.consume(code2);
477
477
  effects.exit("wikilinkEmbedMarker");
478
478
  return openFirst;
479
479
  }
480
- if (code === LEFT_BRACKET) {
480
+ if (code2 === LEFT_BRACKET) {
481
481
  effects.enter("wikilink");
482
- return openFirst(code);
482
+ return openFirst(code2);
483
483
  }
484
- return nok(code);
484
+ return nok(code2);
485
485
  }
486
- function openFirst(code) {
487
- if (code !== LEFT_BRACKET) return nok(code);
486
+ function openFirst(code2) {
487
+ if (code2 !== LEFT_BRACKET) return nok(code2);
488
488
  effects.enter("wikilinkMarker");
489
- effects.consume(code);
489
+ effects.consume(code2);
490
490
  return openSecond;
491
491
  }
492
- function openSecond(code) {
493
- if (code !== LEFT_BRACKET) return nok(code);
494
- effects.consume(code);
492
+ function openSecond(code2) {
493
+ if (code2 !== LEFT_BRACKET) return nok(code2);
494
+ effects.consume(code2);
495
495
  effects.exit("wikilinkMarker");
496
496
  return pathStart;
497
497
  }
498
- function pathStart(code) {
499
- if (code === HASH) return headingMarker(code);
500
- if (code === PIPE) return nok(code);
501
- if (code === RIGHT_BRACKET || code === null || isLineEnding(code))
502
- return nok(code);
498
+ function pathStart(code2) {
499
+ if (code2 === HASH) return headingMarker(code2);
500
+ if (code2 === PIPE) return nok(code2);
501
+ if (code2 === RIGHT_BRACKET || code2 === null || isLineEnding(code2))
502
+ return nok(code2);
503
503
  effects.enter("wikilinkPath");
504
504
  hasPath = true;
505
- return path(code);
505
+ return path(code2);
506
506
  }
507
- function path(code) {
508
- if (code === BACKSLASH) {
509
- effects.consume(code);
507
+ function path(code2) {
508
+ if (code2 === BACKSLASH) {
509
+ effects.consume(code2);
510
510
  return pathEscape;
511
511
  }
512
- if (code === HASH) {
512
+ if (code2 === HASH) {
513
513
  effects.exit("wikilinkPath");
514
- return headingMarker(code);
514
+ return headingMarker(code2);
515
515
  }
516
- if (code === PIPE) {
516
+ if (code2 === PIPE) {
517
517
  effects.exit("wikilinkPath");
518
- return aliasMarker(code);
518
+ return aliasMarker(code2);
519
519
  }
520
- if (code === RIGHT_BRACKET) {
520
+ if (code2 === RIGHT_BRACKET) {
521
521
  effects.exit("wikilinkPath");
522
- return closeFirst(code);
522
+ return closeFirst(code2);
523
523
  }
524
- if (code === null || isLineEnding(code)) return nok(code);
525
- effects.consume(code);
524
+ if (code2 === null || isLineEnding(code2)) return nok(code2);
525
+ effects.consume(code2);
526
526
  return path;
527
527
  }
528
- function pathEscape(code) {
529
- if (code === PIPE) {
528
+ function pathEscape(code2) {
529
+ if (code2 === PIPE) {
530
530
  effects.exit("wikilinkPath");
531
- return aliasMarker(code);
531
+ return aliasMarker(code2);
532
532
  }
533
- if (code === null || isLineEnding(code)) return nok(code);
534
- effects.consume(code);
533
+ if (code2 === null || isLineEnding(code2)) return nok(code2);
534
+ effects.consume(code2);
535
535
  return path;
536
536
  }
537
- function headingMarker(code) {
538
- if (code !== HASH) return nok(code);
537
+ function headingMarker(code2) {
538
+ if (code2 !== HASH) return nok(code2);
539
539
  effects.enter("wikilinkHeadingMarker");
540
- effects.consume(code);
540
+ effects.consume(code2);
541
541
  effects.exit("wikilinkHeadingMarker");
542
542
  return headingStart;
543
543
  }
544
- function headingStart(code) {
545
- if (code === null || isLineEnding(code)) return nok(code);
546
- if (code === RIGHT_BRACKET) {
544
+ function headingStart(code2) {
545
+ if (code2 === null || isLineEnding(code2)) return nok(code2);
546
+ if (code2 === RIGHT_BRACKET) {
547
547
  hasHeading = true;
548
- return closeFirst(code);
548
+ return closeFirst(code2);
549
549
  }
550
- if (code === PIPE) {
550
+ if (code2 === PIPE) {
551
551
  hasHeading = true;
552
- return aliasMarker(code);
552
+ return aliasMarker(code2);
553
553
  }
554
554
  effects.enter("wikilinkHeading");
555
555
  hasHeading = true;
556
- return heading(code);
556
+ return heading2(code2);
557
557
  }
558
- function heading(code) {
559
- if (code === BACKSLASH) {
560
- effects.consume(code);
558
+ function heading2(code2) {
559
+ if (code2 === BACKSLASH) {
560
+ effects.consume(code2);
561
561
  return headingEscape;
562
562
  }
563
- if (code === PIPE) {
563
+ if (code2 === PIPE) {
564
564
  effects.exit("wikilinkHeading");
565
- return aliasMarker(code);
565
+ return aliasMarker(code2);
566
566
  }
567
- if (code === RIGHT_BRACKET) {
567
+ if (code2 === RIGHT_BRACKET) {
568
568
  effects.exit("wikilinkHeading");
569
- return closeFirst(code);
569
+ return closeFirst(code2);
570
570
  }
571
- if (code === null || isLineEnding(code)) return nok(code);
572
- effects.consume(code);
573
- return heading;
571
+ if (code2 === null || isLineEnding(code2)) return nok(code2);
572
+ effects.consume(code2);
573
+ return heading2;
574
574
  }
575
- function headingEscape(code) {
576
- if (code === PIPE) {
575
+ function headingEscape(code2) {
576
+ if (code2 === PIPE) {
577
577
  effects.exit("wikilinkHeading");
578
- return aliasMarker(code);
578
+ return aliasMarker(code2);
579
579
  }
580
- if (code === null || isLineEnding(code)) return nok(code);
581
- effects.consume(code);
582
- return heading;
580
+ if (code2 === null || isLineEnding(code2)) return nok(code2);
581
+ effects.consume(code2);
582
+ return heading2;
583
583
  }
584
- function aliasMarker(code) {
585
- if (code !== PIPE) return nok(code);
584
+ function aliasMarker(code2) {
585
+ if (code2 !== PIPE) return nok(code2);
586
586
  effects.enter("wikilinkAliasMarker");
587
- effects.consume(code);
587
+ effects.consume(code2);
588
588
  effects.exit("wikilinkAliasMarker");
589
589
  return aliasStart;
590
590
  }
591
- function aliasStart(code) {
592
- if (code === RIGHT_BRACKET) return closeFirst(code);
593
- if (code === null || isLineEnding(code)) return nok(code);
591
+ function aliasStart(code2) {
592
+ if (code2 === RIGHT_BRACKET) return closeFirst(code2);
593
+ if (code2 === null || isLineEnding(code2)) return nok(code2);
594
594
  effects.enter("wikilinkAlias");
595
595
  hasAlias = true;
596
- return alias(code);
596
+ return alias(code2);
597
597
  }
598
- function alias(code) {
599
- if (code === RIGHT_BRACKET) {
598
+ function alias(code2) {
599
+ if (code2 === RIGHT_BRACKET) {
600
600
  effects.exit("wikilinkAlias");
601
- return closeFirst(code);
601
+ return closeFirst(code2);
602
602
  }
603
- if (code === null || isLineEnding(code)) return nok(code);
604
- effects.consume(code);
603
+ if (code2 === null || isLineEnding(code2)) return nok(code2);
604
+ effects.consume(code2);
605
605
  return alias;
606
606
  }
607
- function closeFirst(code) {
608
- if (code !== RIGHT_BRACKET) return nok(code);
609
- if (!hasPath && !hasHeading && !hasAlias) return nok(code);
607
+ function closeFirst(code2) {
608
+ if (code2 !== RIGHT_BRACKET) return nok(code2);
609
+ if (!hasPath && !hasHeading && !hasAlias) return nok(code2);
610
610
  effects.enter("wikilinkMarker");
611
- effects.consume(code);
611
+ effects.consume(code2);
612
612
  return closeSecond;
613
613
  }
614
- function closeSecond(code) {
615
- if (code !== RIGHT_BRACKET) return nok(code);
616
- effects.consume(code);
614
+ function closeSecond(code2) {
615
+ if (code2 !== RIGHT_BRACKET) return nok(code2);
616
+ effects.consume(code2);
617
617
  effects.exit("wikilinkMarker");
618
618
  effects.exit("wikilink");
619
619
  return ok3;
@@ -622,8 +622,8 @@ function tokenize(effects, ok3, nok) {
622
622
 
623
623
  // src/lib/syntax/highlight.ts
624
624
  var EQUALS = 61;
625
- function isLineEnding2(code) {
626
- return code === codes.lineFeed || code === codes.carriageReturn;
625
+ function isLineEnding2(code2) {
626
+ return code2 === codes.lineFeed || code2 === codes.carriageReturn || code2 === codes.carriageReturnLineFeed;
627
627
  }
628
628
  function highlightSyntax() {
629
629
  return {
@@ -636,32 +636,32 @@ function tokenize2(effects, ok3, nok) {
636
636
  const close = { tokenize: tokenizeClose, partial: true };
637
637
  let hasContent = false;
638
638
  return start;
639
- function start(code) {
640
- if (code !== EQUALS) return nok(code);
639
+ function start(code2) {
640
+ if (code2 !== EQUALS) return nok(code2);
641
641
  effects.enter("highlight");
642
642
  effects.enter("highlightMarker");
643
- effects.consume(code);
643
+ effects.consume(code2);
644
644
  return openSecond;
645
645
  }
646
- function openSecond(code) {
647
- if (code !== EQUALS) return nok(code);
648
- effects.consume(code);
646
+ function openSecond(code2) {
647
+ if (code2 !== EQUALS) return nok(code2);
648
+ effects.consume(code2);
649
649
  effects.exit("highlightMarker");
650
650
  effects.enter("highlightContent");
651
651
  return content;
652
652
  }
653
- function content(code) {
654
- if (code === null || isLineEnding2(code)) return nok(code);
655
- if (!hasContent && code === EQUALS) return nok(code);
656
- if (code === EQUALS)
657
- return effects.attempt(close, closeAfter, contentConsume)(code);
658
- effects.consume(code);
653
+ function content(code2) {
654
+ if (code2 === null || isLineEnding2(code2)) return nok(code2);
655
+ if (!hasContent && code2 === EQUALS) return nok(code2);
656
+ if (code2 === EQUALS)
657
+ return effects.attempt(close, closeAfter, contentConsume)(code2);
658
+ effects.consume(code2);
659
659
  hasContent = true;
660
660
  return content;
661
661
  }
662
- function contentConsume(code) {
663
- if (code === null || isLineEnding2(code)) return nok(code);
664
- effects.consume(code);
662
+ function contentConsume(code2) {
663
+ if (code2 === null || isLineEnding2(code2)) return nok(code2);
664
+ effects.consume(code2);
665
665
  return content;
666
666
  }
667
667
  function tokenizeClose(closeEffects, closeOk, closeNok) {
@@ -680,9 +680,9 @@ function tokenize2(effects, ok3, nok) {
680
680
  return closeOk;
681
681
  }
682
682
  }
683
- function closeAfter(code) {
683
+ function closeAfter(code2) {
684
684
  effects.exit("highlight");
685
- return ok3(code);
685
+ return ok3(code2);
686
686
  }
687
687
  }
688
688
 
@@ -691,8 +691,8 @@ var PERCENT = 37;
691
691
  var LINE_FEED = -4;
692
692
  var CARRIAGE_RETURN = -3;
693
693
  var CARRIAGE_RETURN_LINE_FEED = -5;
694
- function isLineEnding3(code) {
695
- return code === LINE_FEED || code === CARRIAGE_RETURN || code === CARRIAGE_RETURN_LINE_FEED;
694
+ function isLineEnding3(code2) {
695
+ return code2 === LINE_FEED || code2 === CARRIAGE_RETURN || code2 === CARRIAGE_RETURN_LINE_FEED;
696
696
  }
697
697
  var commentFlow = {
698
698
  tokenize: tokenizeFlow,
@@ -714,53 +714,91 @@ function commentSyntax() {
714
714
  };
715
715
  }
716
716
  function tokenizeText(effects, ok3, nok) {
717
- const close = { tokenize: tokenizeClose, partial: true };
717
+ const closeFromContent = createClose(true);
718
+ const closeFromBoundary = createClose(false);
718
719
  return start;
719
- function start(code) {
720
- if (code !== PERCENT) return nok(code);
720
+ function start(code2) {
721
+ if (code2 !== PERCENT) return nok(code2);
721
722
  effects.enter("comment");
722
723
  effects.enter("commentMarker");
723
- effects.consume(code);
724
+ effects.consume(code2);
724
725
  return openSecond;
725
726
  }
726
- function openSecond(code) {
727
- if (code !== PERCENT) return nok(code);
728
- effects.consume(code);
727
+ function openSecond(code2) {
728
+ if (code2 !== PERCENT) return nok(code2);
729
+ effects.consume(code2);
729
730
  effects.exit("commentMarker");
731
+ return atContentBoundary;
732
+ }
733
+ function atContentBoundary(code2) {
734
+ if (code2 === null) return nok(code2);
735
+ if (isLineEnding3(code2)) {
736
+ return effects.attempt(nonLazyContinuation, atContentBoundary, nok)(code2);
737
+ }
738
+ if (code2 === PERCENT) {
739
+ return effects.attempt(closeFromBoundary, closeAfter, startContent)(code2);
740
+ }
730
741
  effects.enter("commentContent");
742
+ effects.consume(code2);
731
743
  return content;
732
744
  }
733
- function content(code) {
734
- if (code === null) return nok(code);
735
- if (code === PERCENT)
736
- return effects.attempt(close, closeAfter, contentConsume)(code);
737
- effects.consume(code);
745
+ function startContent(code2) {
746
+ if (code2 === null) return nok(code2);
747
+ effects.enter("commentContent");
748
+ effects.consume(code2);
738
749
  return content;
739
750
  }
740
- function contentConsume(code) {
741
- if (code === null) return nok(code);
742
- effects.consume(code);
751
+ function content(code2) {
752
+ if (code2 === null) {
753
+ effects.exit("commentContent");
754
+ return nok(code2);
755
+ }
756
+ if (isLineEnding3(code2)) {
757
+ effects.exit("commentContent");
758
+ return effects.attempt(nonLazyContinuation, atContentBoundary, nok)(code2);
759
+ }
760
+ if (code2 === PERCENT) {
761
+ return effects.attempt(
762
+ closeFromContent,
763
+ closeAfter,
764
+ contentConsume
765
+ )(code2);
766
+ }
767
+ effects.consume(code2);
743
768
  return content;
744
769
  }
745
- function tokenizeClose(closeEffects, closeOk, closeNok) {
746
- return closeStart;
747
- function closeStart(closeCode) {
748
- if (closeCode !== PERCENT) return closeNok(closeCode);
749
- closeEffects.exit("commentContent");
750
- closeEffects.enter("commentMarker");
751
- closeEffects.consume(closeCode);
752
- return closeSecond;
753
- }
754
- function closeSecond(closeCode) {
755
- if (closeCode !== PERCENT) return closeNok(closeCode);
756
- closeEffects.consume(closeCode);
757
- closeEffects.exit("commentMarker");
758
- return closeOk;
770
+ function contentConsume(code2) {
771
+ if (code2 === null) {
772
+ effects.exit("commentContent");
773
+ return nok(code2);
759
774
  }
775
+ effects.consume(code2);
776
+ return content;
760
777
  }
761
- function closeAfter(code) {
778
+ function closeAfter(code2) {
762
779
  effects.exit("comment");
763
- return ok3(code);
780
+ return ok3(code2);
781
+ }
782
+ function createClose(hasOpenContent) {
783
+ return {
784
+ partial: true,
785
+ tokenize: function tokenizeClose(closeEffects, closeOk, closeNok) {
786
+ return closeStart;
787
+ function closeStart(closeCode) {
788
+ if (closeCode !== PERCENT) return closeNok(closeCode);
789
+ if (hasOpenContent) closeEffects.exit("commentContent");
790
+ closeEffects.enter("commentMarker");
791
+ closeEffects.consume(closeCode);
792
+ return closeSecond;
793
+ }
794
+ function closeSecond(closeCode) {
795
+ if (closeCode !== PERCENT) return closeNok(closeCode);
796
+ closeEffects.consume(closeCode);
797
+ closeEffects.exit("commentMarker");
798
+ return closeOk;
799
+ }
800
+ }
801
+ };
764
802
  }
765
803
  }
766
804
  function tokenizeFlow(effects, ok3, nok) {
@@ -770,93 +808,93 @@ function tokenizeFlow(effects, ok3, nok) {
770
808
  partial: true
771
809
  };
772
810
  return start;
773
- function start(code) {
774
- if (code !== PERCENT) return nok(code);
811
+ function start(code2) {
812
+ if (code2 !== PERCENT) return nok(code2);
775
813
  effects.enter("comment");
776
814
  effects.enter("commentMarker");
777
- effects.consume(code);
815
+ effects.consume(code2);
778
816
  return openSecond;
779
817
  }
780
- function openSecond(code) {
781
- if (code !== PERCENT) return nok(code);
782
- effects.consume(code);
818
+ function openSecond(code2) {
819
+ if (code2 !== PERCENT) return nok(code2);
820
+ effects.consume(code2);
783
821
  effects.exit("commentMarker");
784
822
  return afterOpen;
785
823
  }
786
- function afterOpen(code) {
787
- if (code === null) {
824
+ function afterOpen(code2) {
825
+ if (code2 === null) {
788
826
  effects.exit("comment");
789
- return ok3(code);
827
+ return ok3(code2);
790
828
  }
791
- if (isLineEnding3(code)) {
829
+ if (isLineEnding3(code2)) {
792
830
  return effects.attempt(
793
831
  nonLazyContinuation,
794
832
  beforeContentChunk,
795
833
  afterLazy
796
- )(code);
834
+ )(code2);
797
835
  }
798
836
  effects.enter("commentContent");
799
- return contentChunk(code);
837
+ return contentChunk(code2);
800
838
  }
801
- function beforeContentChunk(code) {
802
- if (code === null) {
839
+ function beforeContentChunk(code2) {
840
+ if (code2 === null) {
803
841
  effects.exit("comment");
804
- return ok3(code);
842
+ return ok3(code2);
805
843
  }
806
- if (isLineEnding3(code)) {
844
+ if (isLineEnding3(code2)) {
807
845
  return effects.attempt(
808
846
  nonLazyContinuation,
809
847
  beforeContentChunk,
810
848
  afterLazy
811
- )(code);
849
+ )(code2);
812
850
  }
813
- if (code === PERCENT) {
814
- return effects.attempt(flowClose, closeAfter, startContent)(code);
851
+ if (code2 === PERCENT) {
852
+ return effects.attempt(flowClose, closeAfter, startContent)(code2);
815
853
  }
816
854
  effects.enter("commentContent");
817
- return contentChunk(code);
855
+ return contentChunk(code2);
818
856
  }
819
- function startContent(code) {
857
+ function startContent(code2) {
820
858
  effects.enter("commentContent");
821
- effects.consume(code);
859
+ effects.consume(code2);
822
860
  return contentChunk;
823
861
  }
824
- function contentChunk(code) {
825
- if (code === null) {
862
+ function contentChunk(code2) {
863
+ if (code2 === null) {
826
864
  effects.exit("commentContent");
827
865
  effects.exit("comment");
828
- return ok3(code);
866
+ return ok3(code2);
829
867
  }
830
- if (code === PERCENT) {
831
- return effects.attempt(flowClose, closeAfter, contentConsume)(code);
868
+ if (code2 === PERCENT) {
869
+ return effects.attempt(flowClose, closeAfter, contentConsume)(code2);
832
870
  }
833
- if (isLineEnding3(code)) {
871
+ if (isLineEnding3(code2)) {
834
872
  effects.exit("commentContent");
835
873
  return effects.attempt(
836
874
  nonLazyContinuation,
837
875
  beforeContentChunk,
838
876
  afterLazy
839
- )(code);
877
+ )(code2);
840
878
  }
841
- effects.consume(code);
879
+ effects.consume(code2);
842
880
  return contentChunk;
843
881
  }
844
- function contentConsume(code) {
845
- if (code === null) {
882
+ function contentConsume(code2) {
883
+ if (code2 === null) {
846
884
  effects.exit("commentContent");
847
885
  effects.exit("comment");
848
- return ok3(code);
886
+ return ok3(code2);
849
887
  }
850
- effects.consume(code);
888
+ effects.consume(code2);
851
889
  return contentChunk;
852
890
  }
853
- function closeAfter(code) {
891
+ function closeAfter(code2) {
854
892
  effects.exit("comment");
855
- return ok3(code);
893
+ return ok3(code2);
856
894
  }
857
- function afterLazy(code) {
895
+ function afterLazy(code2) {
858
896
  effects.exit("comment");
859
- return ok3(code);
897
+ return ok3(code2);
860
898
  }
861
899
  function tokenizeFlowClose(closeEffects, closeOk, closeNok) {
862
900
  let inContent = false;
@@ -889,18 +927,18 @@ function tokenizeFlow(effects, ok3, nok) {
889
927
  function tokenizeNonLazyContinuation(effects, ok3, nok) {
890
928
  const self = this;
891
929
  return start;
892
- function start(code) {
893
- if (code === null) {
894
- return ok3(code);
930
+ function start(code2) {
931
+ if (code2 === null) {
932
+ return ok3(code2);
895
933
  }
896
- if (!isLineEnding3(code)) return nok(code);
934
+ if (!isLineEnding3(code2)) return nok(code2);
897
935
  effects.enter("lineEnding");
898
- effects.consume(code);
936
+ effects.consume(code2);
899
937
  effects.exit("lineEnding");
900
938
  return lineStart;
901
939
  }
902
- function lineStart(code) {
903
- return self.parser.lazy[self.now().line] ? nok(code) : ok3(code);
940
+ function lineStart(code2) {
941
+ return self.parser.lazy[self.now().line] ? nok(code2) : ok3(code2);
904
942
  }
905
943
  }
906
944
 
@@ -910,18 +948,18 @@ var SLASH = 47;
910
948
  var DASH = 45;
911
949
  var UNDERSCORE = 95;
912
950
  var tagCharRegex = /[\p{L}\p{M}\p{Emoji}]/u;
913
- function isWhitespace(code) {
914
- return code === codes.space || code === codes.horizontalTab || code === codes.lineFeed || code === codes.carriageReturn || code === codes.carriageReturnLineFeed;
951
+ function isWhitespace(code2) {
952
+ return code2 === codes.space || code2 === codes.horizontalTab || code2 === codes.lineFeed || code2 === codes.carriageReturn || code2 === codes.carriageReturnLineFeed;
915
953
  }
916
- function isTagChar(code) {
917
- if (code === null || code < 0) return false;
918
- if (code >= 48 && code <= 57) return true;
919
- if (code === DASH || code === UNDERSCORE) return true;
920
- return tagCharRegex.test(String.fromCodePoint(code));
954
+ function isTagChar(code2) {
955
+ if (code2 === null || code2 < 0) return false;
956
+ if (code2 >= 48 && code2 <= 57) return true;
957
+ if (code2 === DASH || code2 === UNDERSCORE) return true;
958
+ return tagCharRegex.test(String.fromCodePoint(code2));
921
959
  }
922
- function isNonDigit(code) {
923
- if (code === null) return false;
924
- return !(code >= 48 && code <= 57);
960
+ function isNonDigit(code2) {
961
+ if (code2 === null) return false;
962
+ return !(code2 >= 48 && code2 <= 57);
925
963
  }
926
964
  function tagSyntax() {
927
965
  return {
@@ -934,47 +972,47 @@ function tokenize3(effects, ok3, nok) {
934
972
  let hasNonDigit = false;
935
973
  const context = this;
936
974
  return start;
937
- function start(code) {
975
+ function start(code2) {
938
976
  const previous2 = context.previous;
939
977
  const allowedStart = previous2 === null || isWhitespace(previous2) || previous2 === HASH2;
940
- if (!allowedStart) return nok(code);
941
- if (code !== HASH2) return nok(code);
978
+ if (!allowedStart) return nok(code2);
979
+ if (code2 !== HASH2) return nok(code2);
942
980
  effects.enter("tag");
943
981
  effects.enter("tagMarker");
944
- effects.consume(code);
982
+ effects.consume(code2);
945
983
  effects.exit("tagMarker");
946
984
  return tagStart;
947
985
  }
948
- function tagStart(code) {
949
- if (!isTagChar(code)) return nok(code);
986
+ function tagStart(code2) {
987
+ if (!isTagChar(code2)) return nok(code2);
950
988
  effects.enter("tagContent");
951
- if (isNonDigit(code)) hasNonDigit = true;
952
- effects.consume(code);
989
+ if (isNonDigit(code2)) hasNonDigit = true;
990
+ effects.consume(code2);
953
991
  return tagContent;
954
992
  }
955
- function tagContent(code) {
956
- if (code === SLASH) {
957
- effects.consume(code);
993
+ function tagContent(code2) {
994
+ if (code2 === SLASH) {
995
+ effects.consume(code2);
958
996
  return afterSlash;
959
997
  }
960
- if (isTagChar(code)) {
961
- if (isNonDigit(code)) hasNonDigit = true;
962
- effects.consume(code);
998
+ if (isTagChar(code2)) {
999
+ if (isNonDigit(code2)) hasNonDigit = true;
1000
+ effects.consume(code2);
963
1001
  return tagContent;
964
1002
  }
965
- return end(code);
1003
+ return end(code2);
966
1004
  }
967
- function afterSlash(code) {
968
- if (!isTagChar(code)) return nok(code);
969
- if (isNonDigit(code)) hasNonDigit = true;
970
- effects.consume(code);
1005
+ function afterSlash(code2) {
1006
+ if (!isTagChar(code2)) return nok(code2);
1007
+ if (isNonDigit(code2)) hasNonDigit = true;
1008
+ effects.consume(code2);
971
1009
  return tagContent;
972
1010
  }
973
- function end(code) {
974
- if (!hasNonDigit) return nok(code);
1011
+ function end(code2) {
1012
+ if (!hasNonDigit) return nok(code2);
975
1013
  effects.exit("tagContent");
976
1014
  effects.exit("tag");
977
- return ok3(code);
1015
+ return ok3(code2);
978
1016
  }
979
1017
  }
980
1018
 
@@ -996,29 +1034,29 @@ function wikilinkFromMarkdown() {
996
1034
  );
997
1035
  },
998
1036
  wikilinkEmbedMarker() {
999
- const node = this.stack[this.stack.length - 1];
1000
- node.embedded = true;
1037
+ const node2 = this.stack[this.stack.length - 1];
1038
+ node2.embedded = true;
1001
1039
  },
1002
1040
  wikilinkPath(token) {
1003
- const node = this.stack[this.stack.length - 1];
1004
- node.path = this.sliceSerialize(token).replace(/\\([#\[\]])/g, "$1");
1041
+ const node2 = this.stack[this.stack.length - 1];
1042
+ node2.path = this.sliceSerialize(token).replace(/\\([#\[\]])/g, "$1");
1005
1043
  },
1006
1044
  wikilinkHeading(token) {
1007
- const node = this.stack[this.stack.length - 1];
1008
- node.heading = this.sliceSerialize(token).replace(/\\([#\[\]])/g, "$1");
1045
+ const node2 = this.stack[this.stack.length - 1];
1046
+ node2.heading = this.sliceSerialize(token).replace(/\\([#\[\]])/g, "$1");
1009
1047
  },
1010
1048
  wikilinkAlias(token) {
1011
- const node = this.stack[this.stack.length - 1];
1012
- node.alias = this.sliceSerialize(token);
1049
+ const node2 = this.stack[this.stack.length - 1];
1050
+ node2.alias = this.sliceSerialize(token);
1013
1051
  }
1014
1052
  },
1015
1053
  exit: {
1016
1054
  wikilink(token) {
1017
- const node = this.stack[this.stack.length - 1];
1018
- if (node.alias) {
1019
- if (node.path.endsWith("\\")) node.path = node.path.slice(0, -1);
1020
- if (node.heading.endsWith("\\"))
1021
- node.heading = node.heading.slice(0, -1);
1055
+ const node2 = this.stack[this.stack.length - 1];
1056
+ if (node2.alias) {
1057
+ if (node2.path.endsWith("\\")) node2.path = node2.path.slice(0, -1);
1058
+ if (node2.heading.endsWith("\\"))
1059
+ node2.heading = node2.heading.slice(0, -1);
1022
1060
  }
1023
1061
  this.exit(token);
1024
1062
  }
@@ -1036,8 +1074,8 @@ function highlightFromMarkdown() {
1036
1074
  },
1037
1075
  exit: {
1038
1076
  highlightContent(token) {
1039
- const node = this.stack[this.stack.length - 1];
1040
- node.children = [{ type: "text", value: this.sliceSerialize(token) }];
1077
+ const node2 = this.stack[this.stack.length - 1];
1078
+ node2.children = [{ type: "text", value: this.sliceSerialize(token) }];
1041
1079
  },
1042
1080
  highlight(token) {
1043
1081
  this.exit(token);
@@ -1047,6 +1085,7 @@ function highlightFromMarkdown() {
1047
1085
  }
1048
1086
 
1049
1087
  // src/lib/mdast/comment.ts
1088
+ var MARKER_LENGTH = 2;
1050
1089
  function commentFromMarkdown() {
1051
1090
  return {
1052
1091
  enter: {
@@ -1055,11 +1094,14 @@ function commentFromMarkdown() {
1055
1094
  }
1056
1095
  },
1057
1096
  exit: {
1058
- commentContent(token) {
1059
- const node = this.stack[this.stack.length - 1];
1060
- node.value += this.sliceSerialize(token);
1061
- },
1097
+ // Content is emitted as one `commentContent` token per line, separated by
1098
+ // `lineEnding` tokens. Those separators cannot be captured here without
1099
+ // overriding the core `lineEnding` handler, so the value is recovered
1100
+ // from the whole comment span instead.
1062
1101
  comment(token) {
1102
+ const node2 = this.stack[this.stack.length - 1];
1103
+ const body = this.sliceSerialize(token).slice(MARKER_LENGTH);
1104
+ node2.value = body.endsWith("%%") ? body.slice(0, -MARKER_LENGTH) : body;
1063
1105
  this.exit(token);
1064
1106
  }
1065
1107
  }
@@ -1074,8 +1116,8 @@ function tagFromMarkdown() {
1074
1116
  this.enter({ type: "tag", value: "" }, token);
1075
1117
  },
1076
1118
  tagContent(token) {
1077
- const node = this.stack[this.stack.length - 1];
1078
- if (node.type === "tag") node.value = this.sliceSerialize(token);
1119
+ const node2 = this.stack[this.stack.length - 1];
1120
+ if (node2.type === "tag") node2.value = this.sliceSerialize(token);
1079
1121
  }
1080
1122
  },
1081
1123
  exit: {
@@ -1090,11 +1132,11 @@ function tagFromMarkdown() {
1090
1132
  function wikilinkToMarkdown() {
1091
1133
  return {
1092
1134
  handlers: {
1093
- wikilink(node) {
1094
- const prefix = node.embedded ? "!" : "";
1095
- const heading = node.heading ? `#${node.heading}` : "";
1096
- const alias = node.alias ? `|${node.alias}` : "";
1097
- return `${prefix}[[${node.path}${heading}${alias}]]`;
1135
+ wikilink(node2) {
1136
+ const prefix = node2.embedded ? "!" : "";
1137
+ const heading2 = node2.heading ? `#${node2.heading}` : "";
1138
+ const alias = node2.alias ? `|${node2.alias}` : "";
1139
+ return `${prefix}[[${node2.path}${heading2}${alias}]]`;
1098
1140
  }
1099
1141
  }
1100
1142
  };
@@ -1104,9 +1146,9 @@ function wikilinkToMarkdown() {
1104
1146
  function highlightToMarkdown() {
1105
1147
  return {
1106
1148
  handlers: {
1107
- highlight(node, _parent, state, info) {
1149
+ highlight(node2, _parent, state, info) {
1108
1150
  const exit = state.enter("highlight");
1109
- const content = state.containerPhrasing(node, info);
1151
+ const content = state.containerPhrasing(node2, info);
1110
1152
  exit();
1111
1153
  return `==${content}==`;
1112
1154
  }
@@ -1118,8 +1160,8 @@ function highlightToMarkdown() {
1118
1160
  function commentToMarkdown() {
1119
1161
  return {
1120
1162
  handlers: {
1121
- comment(node) {
1122
- return `%%${node.value}%%`;
1163
+ comment(node2) {
1164
+ return `%%${node2.value}%%`;
1123
1165
  }
1124
1166
  }
1125
1167
  };
@@ -1129,8 +1171,8 @@ function commentToMarkdown() {
1129
1171
  function tagToMarkdown() {
1130
1172
  return {
1131
1173
  handlers: {
1132
- tag(node) {
1133
- return `#${node.value}`;
1174
+ tag(node2) {
1175
+ return `#${node2.value}`;
1134
1176
  }
1135
1177
  }
1136
1178
  };
@@ -1138,37 +1180,37 @@ function tagToMarkdown() {
1138
1180
 
1139
1181
  // src/lib/task-char.ts
1140
1182
  function customTaskCharTransform(tree, source) {
1141
- visit(tree, "listItem", (node) => {
1142
- if (typeof node.checked === "boolean") {
1143
- let char = node.checked ? "x" : " ";
1144
- if (source && node.position?.start?.offset != null) {
1183
+ visit(tree, "listItem", (node2) => {
1184
+ if (typeof node2.checked === "boolean") {
1185
+ let char = node2.checked ? "x" : " ";
1186
+ if (source && node2.position?.start?.offset != null) {
1145
1187
  const slice = source.slice(
1146
- node.position.start.offset,
1147
- node.position.start.offset + 20
1188
+ node2.position.start.offset,
1189
+ node2.position.start.offset + 20
1148
1190
  );
1149
1191
  const m = slice.match(/\[([^\]])\]/);
1150
1192
  if (m) {
1151
1193
  char = m[1];
1152
1194
  }
1153
1195
  }
1154
- node.data ??= {};
1155
- node.data.taskChar = char;
1156
- node.data.hProperties ??= {};
1157
- node.data.hProperties.dataTaskChar = char;
1196
+ node2.data ??= {};
1197
+ node2.data.taskChar = char;
1198
+ node2.data.hProperties ??= {};
1199
+ node2.data.hProperties.dataTaskChar = char;
1158
1200
  return;
1159
1201
  }
1160
- const firstChild = node.children?.[0];
1202
+ const firstChild = node2.children?.[0];
1161
1203
  if (!firstChild || firstChild.type !== "paragraph") return;
1162
1204
  const firstText = firstChild.children?.[0];
1163
1205
  if (!firstText || firstText.type !== "text") return;
1164
1206
  const match = firstText.value.match(/^\[([^\]])\]\s/);
1165
1207
  if (!match) return;
1166
1208
  const taskChar = match[1];
1167
- node.checked = taskChar !== " ";
1168
- node.data ??= {};
1169
- node.data.taskChar = taskChar;
1170
- node.data.hProperties ??= {};
1171
- node.data.hProperties.dataTaskChar = taskChar;
1209
+ node2.checked = taskChar !== " ";
1210
+ node2.data ??= {};
1211
+ node2.data.taskChar = taskChar;
1212
+ node2.data.hProperties ??= {};
1213
+ node2.data.hProperties.dataTaskChar = taskChar;
1172
1214
  firstText.value = firstText.value.slice(match[0].length);
1173
1215
  if (firstText.value.length === 0) {
1174
1216
  firstChild.children.shift();
@@ -1179,6 +1221,234 @@ function customTaskCharTransform(tree, source) {
1179
1221
  });
1180
1222
  }
1181
1223
 
1224
+ // node_modules/mdast-util-to-markdown/lib/handle/blockquote.js
1225
+ function blockquote(node2, _, state, info) {
1226
+ const exit = state.enter("blockquote");
1227
+ const tracker = state.createTracker(info);
1228
+ tracker.move("> ");
1229
+ tracker.shift(2);
1230
+ const value = state.indentLines(
1231
+ state.containerFlow(node2, tracker.current()),
1232
+ map
1233
+ );
1234
+ exit();
1235
+ return value;
1236
+ }
1237
+ function map(line, _, blank) {
1238
+ return ">" + (blank ? "" : " ") + line;
1239
+ }
1240
+
1241
+ // node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
1242
+ function patternInScope(stack, pattern) {
1243
+ return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct, false);
1244
+ }
1245
+ function listInScope(stack, list2, none) {
1246
+ if (typeof list2 === "string") {
1247
+ list2 = [list2];
1248
+ }
1249
+ if (!list2 || list2.length === 0) {
1250
+ return none;
1251
+ }
1252
+ let index = -1;
1253
+ while (++index < list2.length) {
1254
+ if (stack.includes(list2[index])) {
1255
+ return true;
1256
+ }
1257
+ }
1258
+ return false;
1259
+ }
1260
+
1261
+ // node_modules/mdast-util-to-markdown/lib/handle/break.js
1262
+ function hardBreak(_, _1, state, info) {
1263
+ let index = -1;
1264
+ while (++index < state.unsafe.length) {
1265
+ if (state.unsafe[index].character === "\n" && patternInScope(state.stack, state.unsafe[index])) {
1266
+ return /[ \t]/.test(info.before) ? "" : " ";
1267
+ }
1268
+ }
1269
+ return "\\\n";
1270
+ }
1271
+
1272
+ // node_modules/longest-streak/index.js
1273
+ function longestStreak(value, substring) {
1274
+ const source = String(value);
1275
+ let index = source.indexOf(substring);
1276
+ let expected = index;
1277
+ let count = 0;
1278
+ let max = 0;
1279
+ if (typeof substring !== "string") {
1280
+ throw new TypeError("Expected substring");
1281
+ }
1282
+ while (index !== -1) {
1283
+ if (index === expected) {
1284
+ if (++count > max) {
1285
+ max = count;
1286
+ }
1287
+ } else {
1288
+ count = 1;
1289
+ }
1290
+ expected = index + substring.length;
1291
+ index = source.indexOf(substring, expected);
1292
+ }
1293
+ return max;
1294
+ }
1295
+
1296
+ // node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js
1297
+ function formatCodeAsIndented(node2, state) {
1298
+ return Boolean(
1299
+ state.options.fences === false && node2.value && // If there’s no info…
1300
+ !node2.lang && // And there’s a non-whitespace character…
1301
+ /[^ \r\n]/.test(node2.value) && // And the value doesn’t start or end in a blank…
1302
+ !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node2.value)
1303
+ );
1304
+ }
1305
+
1306
+ // node_modules/mdast-util-to-markdown/lib/util/check-fence.js
1307
+ function checkFence(state) {
1308
+ const marker = state.options.fence || "`";
1309
+ if (marker !== "`" && marker !== "~") {
1310
+ throw new Error(
1311
+ "Cannot serialize code with `" + marker + "` for `options.fence`, expected `` ` `` or `~`"
1312
+ );
1313
+ }
1314
+ return marker;
1315
+ }
1316
+
1317
+ // node_modules/mdast-util-to-markdown/lib/handle/code.js
1318
+ function code(node2, _, state, info) {
1319
+ const marker = checkFence(state);
1320
+ const raw = node2.value || "";
1321
+ const suffix = marker === "`" ? "GraveAccent" : "Tilde";
1322
+ if (formatCodeAsIndented(node2, state)) {
1323
+ const exit2 = state.enter("codeIndented");
1324
+ const value2 = state.indentLines(raw, map2);
1325
+ exit2();
1326
+ return value2;
1327
+ }
1328
+ const tracker = state.createTracker(info);
1329
+ const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3));
1330
+ const exit = state.enter("codeFenced");
1331
+ let value = tracker.move(sequence);
1332
+ if (node2.lang) {
1333
+ const subexit = state.enter(`codeFencedLang${suffix}`);
1334
+ value += tracker.move(
1335
+ state.safe(node2.lang, {
1336
+ before: value,
1337
+ after: " ",
1338
+ encode: ["`"],
1339
+ ...tracker.current()
1340
+ })
1341
+ );
1342
+ subexit();
1343
+ }
1344
+ if (node2.lang && node2.meta) {
1345
+ const subexit = state.enter(`codeFencedMeta${suffix}`);
1346
+ value += tracker.move(" ");
1347
+ value += tracker.move(
1348
+ state.safe(node2.meta, {
1349
+ before: value,
1350
+ after: "\n",
1351
+ encode: ["`"],
1352
+ ...tracker.current()
1353
+ })
1354
+ );
1355
+ subexit();
1356
+ }
1357
+ value += tracker.move("\n");
1358
+ if (raw) {
1359
+ value += tracker.move(raw + "\n");
1360
+ }
1361
+ value += tracker.move(sequence);
1362
+ exit();
1363
+ return value;
1364
+ }
1365
+ function map2(line, _, blank) {
1366
+ return (blank ? "" : " ") + line;
1367
+ }
1368
+
1369
+ // node_modules/mdast-util-to-markdown/lib/util/check-quote.js
1370
+ function checkQuote(state) {
1371
+ const marker = state.options.quote || '"';
1372
+ if (marker !== '"' && marker !== "'") {
1373
+ throw new Error(
1374
+ "Cannot serialize title with `" + marker + "` for `options.quote`, expected `\"`, or `'`"
1375
+ );
1376
+ }
1377
+ return marker;
1378
+ }
1379
+
1380
+ // node_modules/mdast-util-to-markdown/lib/handle/definition.js
1381
+ function definition(node2, _, state, info) {
1382
+ const quote = checkQuote(state);
1383
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
1384
+ const exit = state.enter("definition");
1385
+ let subexit = state.enter("label");
1386
+ const tracker = state.createTracker(info);
1387
+ let value = tracker.move("[");
1388
+ value += tracker.move(
1389
+ state.safe(state.associationId(node2), {
1390
+ before: value,
1391
+ after: "]",
1392
+ ...tracker.current()
1393
+ })
1394
+ );
1395
+ value += tracker.move("]: ");
1396
+ subexit();
1397
+ if (
1398
+ // If there’s no url, or…
1399
+ !node2.url || // If there are control characters or whitespace.
1400
+ /[\0- \u007F]/.test(node2.url)
1401
+ ) {
1402
+ subexit = state.enter("destinationLiteral");
1403
+ value += tracker.move("<");
1404
+ value += tracker.move(
1405
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
1406
+ );
1407
+ value += tracker.move(">");
1408
+ } else {
1409
+ subexit = state.enter("destinationRaw");
1410
+ value += tracker.move(
1411
+ state.safe(node2.url, {
1412
+ before: value,
1413
+ after: node2.title ? " " : "\n",
1414
+ ...tracker.current()
1415
+ })
1416
+ );
1417
+ }
1418
+ subexit();
1419
+ if (node2.title) {
1420
+ subexit = state.enter(`title${suffix}`);
1421
+ value += tracker.move(" " + quote);
1422
+ value += tracker.move(
1423
+ state.safe(node2.title, {
1424
+ before: value,
1425
+ after: quote,
1426
+ ...tracker.current()
1427
+ })
1428
+ );
1429
+ value += tracker.move(quote);
1430
+ subexit();
1431
+ }
1432
+ exit();
1433
+ return value;
1434
+ }
1435
+
1436
+ // node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js
1437
+ function checkEmphasis(state) {
1438
+ const marker = state.options.emphasis || "*";
1439
+ if (marker !== "*" && marker !== "_") {
1440
+ throw new Error(
1441
+ "Cannot serialize emphasis with `" + marker + "` for `options.emphasis`, expected `*`, or `_`"
1442
+ );
1443
+ }
1444
+ return marker;
1445
+ }
1446
+
1447
+ // node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js
1448
+ function encodeCharacterReference(code2) {
1449
+ return "&#x" + code2.toString(16).toUpperCase() + ";";
1450
+ }
1451
+
1182
1452
  // node_modules/micromark-util-character/index.js
1183
1453
  var asciiAlpha = regexCheck(/[A-Za-z]/);
1184
1454
  var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
@@ -1186,19 +1456,786 @@ var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
1186
1456
  var asciiDigit = regexCheck(/\d/);
1187
1457
  var asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
1188
1458
  var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
1189
- function markdownLineEnding(code) {
1190
- return code !== null && code < -2;
1459
+ function markdownLineEnding(code2) {
1460
+ return code2 !== null && code2 < -2;
1191
1461
  }
1192
- function markdownSpace(code) {
1193
- return code === -2 || code === -1 || code === 32;
1462
+ function markdownLineEndingOrSpace(code2) {
1463
+ return code2 !== null && (code2 < 0 || code2 === 32);
1464
+ }
1465
+ function markdownSpace(code2) {
1466
+ return code2 === -2 || code2 === -1 || code2 === 32;
1194
1467
  }
1195
1468
  var unicodePunctuation = regexCheck(/\p{P}|\p{S}/u);
1196
1469
  var unicodeWhitespace = regexCheck(/\s/);
1197
1470
  function regexCheck(regex) {
1198
1471
  return check;
1199
- function check(code) {
1200
- return code !== null && code > -1 && regex.test(String.fromCharCode(code));
1472
+ function check(code2) {
1473
+ return code2 !== null && code2 > -1 && regex.test(String.fromCharCode(code2));
1474
+ }
1475
+ }
1476
+
1477
+ // node_modules/micromark-util-classify-character/index.js
1478
+ function classifyCharacter(code2) {
1479
+ if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
1480
+ return 1;
1481
+ }
1482
+ if (unicodePunctuation(code2)) {
1483
+ return 2;
1484
+ }
1485
+ }
1486
+
1487
+ // node_modules/mdast-util-to-markdown/lib/util/encode-info.js
1488
+ function encodeInfo(outside, inside, marker) {
1489
+ const outsideKind = classifyCharacter(outside);
1490
+ const insideKind = classifyCharacter(inside);
1491
+ if (outsideKind === void 0) {
1492
+ return insideKind === void 0 ? (
1493
+ // Letter inside:
1494
+ // we have to encode *both* letters for `_` as it is looser.
1495
+ // it already forms for `*` (and GFMs `~`).
1496
+ marker === "_" ? { inside: true, outside: true } : { inside: false, outside: false }
1497
+ ) : insideKind === 1 ? (
1498
+ // Whitespace inside: encode both (letter, whitespace).
1499
+ { inside: true, outside: true }
1500
+ ) : (
1501
+ // Punctuation inside: encode outer (letter)
1502
+ { inside: false, outside: true }
1503
+ );
1504
+ }
1505
+ if (outsideKind === 1) {
1506
+ return insideKind === void 0 ? (
1507
+ // Letter inside: already forms.
1508
+ { inside: false, outside: false }
1509
+ ) : insideKind === 1 ? (
1510
+ // Whitespace inside: encode both (whitespace).
1511
+ { inside: true, outside: true }
1512
+ ) : (
1513
+ // Punctuation inside: already forms.
1514
+ { inside: false, outside: false }
1515
+ );
1201
1516
  }
1517
+ return insideKind === void 0 ? (
1518
+ // Letter inside: already forms.
1519
+ { inside: false, outside: false }
1520
+ ) : insideKind === 1 ? (
1521
+ // Whitespace inside: encode inner (whitespace).
1522
+ { inside: true, outside: false }
1523
+ ) : (
1524
+ // Punctuation inside: already forms.
1525
+ { inside: false, outside: false }
1526
+ );
1527
+ }
1528
+
1529
+ // node_modules/mdast-util-to-markdown/lib/handle/emphasis.js
1530
+ emphasis.peek = emphasisPeek;
1531
+ function emphasis(node2, _, state, info) {
1532
+ const marker = checkEmphasis(state);
1533
+ const exit = state.enter("emphasis");
1534
+ const tracker = state.createTracker(info);
1535
+ const before = tracker.move(marker);
1536
+ let between = tracker.move(
1537
+ state.containerPhrasing(node2, {
1538
+ after: marker,
1539
+ before,
1540
+ ...tracker.current()
1541
+ })
1542
+ );
1543
+ const betweenHead = between.charCodeAt(0);
1544
+ const open = encodeInfo(
1545
+ info.before.charCodeAt(info.before.length - 1),
1546
+ betweenHead,
1547
+ marker
1548
+ );
1549
+ if (open.inside) {
1550
+ between = encodeCharacterReference(betweenHead) + between.slice(1);
1551
+ }
1552
+ const betweenTail = between.charCodeAt(between.length - 1);
1553
+ const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
1554
+ if (close.inside) {
1555
+ between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
1556
+ }
1557
+ const after = tracker.move(marker);
1558
+ exit();
1559
+ state.attentionEncodeSurroundingInfo = {
1560
+ after: close.outside,
1561
+ before: open.outside
1562
+ };
1563
+ return before + between + after;
1564
+ }
1565
+ function emphasisPeek(_, _1, state) {
1566
+ return state.options.emphasis || "*";
1567
+ }
1568
+
1569
+ // node_modules/mdast-util-to-string/lib/index.js
1570
+ var emptyOptions = {};
1571
+ function toString(value, options) {
1572
+ const settings = options || emptyOptions;
1573
+ const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
1574
+ const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
1575
+ return one(value, includeImageAlt, includeHtml);
1576
+ }
1577
+ function one(value, includeImageAlt, includeHtml) {
1578
+ if (node(value)) {
1579
+ if ("value" in value) {
1580
+ return value.type === "html" && !includeHtml ? "" : value.value;
1581
+ }
1582
+ if (includeImageAlt && "alt" in value && value.alt) {
1583
+ return value.alt;
1584
+ }
1585
+ if ("children" in value) {
1586
+ return all(value.children, includeImageAlt, includeHtml);
1587
+ }
1588
+ }
1589
+ if (Array.isArray(value)) {
1590
+ return all(value, includeImageAlt, includeHtml);
1591
+ }
1592
+ return "";
1593
+ }
1594
+ function all(values, includeImageAlt, includeHtml) {
1595
+ const result = [];
1596
+ let index = -1;
1597
+ while (++index < values.length) {
1598
+ result[index] = one(values[index], includeImageAlt, includeHtml);
1599
+ }
1600
+ return result.join("");
1601
+ }
1602
+ function node(value) {
1603
+ return Boolean(value && typeof value === "object");
1604
+ }
1605
+
1606
+ // node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js
1607
+ function formatHeadingAsSetext(node2, state) {
1608
+ let literalWithBreak = false;
1609
+ visit(node2, function(node3) {
1610
+ if ("value" in node3 && /\r?\n|\r/.test(node3.value) || node3.type === "break") {
1611
+ literalWithBreak = true;
1612
+ return EXIT;
1613
+ }
1614
+ });
1615
+ return Boolean(
1616
+ (!node2.depth || node2.depth < 3) && toString(node2) && (state.options.setext || literalWithBreak)
1617
+ );
1618
+ }
1619
+
1620
+ // node_modules/mdast-util-to-markdown/lib/handle/heading.js
1621
+ function heading(node2, _, state, info) {
1622
+ const rank = Math.max(Math.min(6, node2.depth || 1), 1);
1623
+ const tracker = state.createTracker(info);
1624
+ if (formatHeadingAsSetext(node2, state)) {
1625
+ const exit2 = state.enter("headingSetext");
1626
+ const subexit2 = state.enter("phrasing");
1627
+ const value2 = state.containerPhrasing(node2, {
1628
+ ...tracker.current(),
1629
+ before: "\n",
1630
+ after: "\n"
1631
+ });
1632
+ subexit2();
1633
+ exit2();
1634
+ return value2 + "\n" + (rank === 1 ? "=" : "-").repeat(
1635
+ // The whole size…
1636
+ value2.length - // Minus the position of the character after the last EOL (or
1637
+ // 0 if there is none)…
1638
+ (Math.max(value2.lastIndexOf("\r"), value2.lastIndexOf("\n")) + 1)
1639
+ );
1640
+ }
1641
+ const sequence = "#".repeat(rank);
1642
+ const exit = state.enter("headingAtx");
1643
+ const subexit = state.enter("phrasing");
1644
+ tracker.move(sequence + " ");
1645
+ let value = state.containerPhrasing(node2, {
1646
+ before: "# ",
1647
+ after: "\n",
1648
+ ...tracker.current()
1649
+ });
1650
+ if (/^[\t ]/.test(value)) {
1651
+ value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1);
1652
+ }
1653
+ value = value ? sequence + " " + value : sequence;
1654
+ if (state.options.closeAtx) {
1655
+ value += " " + sequence;
1656
+ }
1657
+ subexit();
1658
+ exit();
1659
+ return value;
1660
+ }
1661
+
1662
+ // node_modules/mdast-util-to-markdown/lib/handle/html.js
1663
+ html.peek = htmlPeek;
1664
+ function html(node2) {
1665
+ return node2.value || "";
1666
+ }
1667
+ function htmlPeek() {
1668
+ return "<";
1669
+ }
1670
+
1671
+ // node_modules/mdast-util-to-markdown/lib/handle/image.js
1672
+ image.peek = imagePeek;
1673
+ function image(node2, _, state, info) {
1674
+ const quote = checkQuote(state);
1675
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
1676
+ const exit = state.enter("image");
1677
+ let subexit = state.enter("label");
1678
+ const tracker = state.createTracker(info);
1679
+ let value = tracker.move("![");
1680
+ value += tracker.move(
1681
+ state.safe(node2.alt, { before: value, after: "]", ...tracker.current() })
1682
+ );
1683
+ value += tracker.move("](");
1684
+ subexit();
1685
+ if (
1686
+ // If there’s no url but there is a title…
1687
+ !node2.url && node2.title || // If there are control characters or whitespace.
1688
+ /[\0- \u007F]/.test(node2.url)
1689
+ ) {
1690
+ subexit = state.enter("destinationLiteral");
1691
+ value += tracker.move("<");
1692
+ value += tracker.move(
1693
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
1694
+ );
1695
+ value += tracker.move(">");
1696
+ } else {
1697
+ subexit = state.enter("destinationRaw");
1698
+ value += tracker.move(
1699
+ state.safe(node2.url, {
1700
+ before: value,
1701
+ after: node2.title ? " " : ")",
1702
+ ...tracker.current()
1703
+ })
1704
+ );
1705
+ }
1706
+ subexit();
1707
+ if (node2.title) {
1708
+ subexit = state.enter(`title${suffix}`);
1709
+ value += tracker.move(" " + quote);
1710
+ value += tracker.move(
1711
+ state.safe(node2.title, {
1712
+ before: value,
1713
+ after: quote,
1714
+ ...tracker.current()
1715
+ })
1716
+ );
1717
+ value += tracker.move(quote);
1718
+ subexit();
1719
+ }
1720
+ value += tracker.move(")");
1721
+ exit();
1722
+ return value;
1723
+ }
1724
+ function imagePeek() {
1725
+ return "!";
1726
+ }
1727
+
1728
+ // node_modules/mdast-util-to-markdown/lib/handle/image-reference.js
1729
+ imageReference.peek = imageReferencePeek;
1730
+ function imageReference(node2, _, state, info) {
1731
+ const type = node2.referenceType;
1732
+ const exit = state.enter("imageReference");
1733
+ let subexit = state.enter("label");
1734
+ const tracker = state.createTracker(info);
1735
+ let value = tracker.move("![");
1736
+ const alt = state.safe(node2.alt, {
1737
+ before: value,
1738
+ after: "]",
1739
+ ...tracker.current()
1740
+ });
1741
+ value += tracker.move(alt + "][");
1742
+ subexit();
1743
+ const stack = state.stack;
1744
+ state.stack = [];
1745
+ subexit = state.enter("reference");
1746
+ const reference = state.safe(state.associationId(node2), {
1747
+ before: value,
1748
+ after: "]",
1749
+ ...tracker.current()
1750
+ });
1751
+ subexit();
1752
+ state.stack = stack;
1753
+ exit();
1754
+ if (type === "full" || !alt || alt !== reference) {
1755
+ value += tracker.move(reference + "]");
1756
+ } else if (type === "shortcut") {
1757
+ value = value.slice(0, -1);
1758
+ } else {
1759
+ value += tracker.move("]");
1760
+ }
1761
+ return value;
1762
+ }
1763
+ function imageReferencePeek() {
1764
+ return "!";
1765
+ }
1766
+
1767
+ // node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
1768
+ inlineCode.peek = inlineCodePeek;
1769
+ function inlineCode(node2, _, state) {
1770
+ let value = node2.value || "";
1771
+ let sequence = "`";
1772
+ let index = -1;
1773
+ while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
1774
+ sequence += "`";
1775
+ }
1776
+ if (/[^ \r\n]/.test(value) && (/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value) || /^`|`$/.test(value))) {
1777
+ value = " " + value + " ";
1778
+ }
1779
+ while (++index < state.unsafe.length) {
1780
+ const pattern = state.unsafe[index];
1781
+ const expression = state.compilePattern(pattern);
1782
+ let match;
1783
+ if (!pattern.atBreak) continue;
1784
+ while (match = expression.exec(value)) {
1785
+ let position = match.index;
1786
+ if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
1787
+ position--;
1788
+ }
1789
+ value = value.slice(0, position) + " " + value.slice(match.index + 1);
1790
+ }
1791
+ }
1792
+ return sequence + value + sequence;
1793
+ }
1794
+ function inlineCodePeek() {
1795
+ return "`";
1796
+ }
1797
+
1798
+ // node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js
1799
+ function formatLinkAsAutolink(node2, state) {
1800
+ const raw = toString(node2);
1801
+ return Boolean(
1802
+ !state.options.resourceLink && // If there’s a url…
1803
+ node2.url && // And there’s a no title…
1804
+ !node2.title && // And the content of `node` is a single text node…
1805
+ node2.children && node2.children.length === 1 && node2.children[0].type === "text" && // And if the url is the same as the content…
1806
+ (raw === node2.url || "mailto:" + raw === node2.url) && // And that starts w/ a protocol…
1807
+ /^[a-z][a-z+.-]+:/i.test(node2.url) && // And that doesn’t contain ASCII control codes (character escapes and
1808
+ // references don’t work), space, or angle brackets…
1809
+ !/[\0- <>\u007F]/.test(node2.url)
1810
+ );
1811
+ }
1812
+
1813
+ // node_modules/mdast-util-to-markdown/lib/handle/link.js
1814
+ link.peek = linkPeek;
1815
+ function link(node2, _, state, info) {
1816
+ const quote = checkQuote(state);
1817
+ const suffix = quote === '"' ? "Quote" : "Apostrophe";
1818
+ const tracker = state.createTracker(info);
1819
+ let exit;
1820
+ let subexit;
1821
+ if (formatLinkAsAutolink(node2, state)) {
1822
+ const stack = state.stack;
1823
+ state.stack = [];
1824
+ exit = state.enter("autolink");
1825
+ let value2 = tracker.move("<");
1826
+ value2 += tracker.move(
1827
+ state.containerPhrasing(node2, {
1828
+ before: value2,
1829
+ after: ">",
1830
+ ...tracker.current()
1831
+ })
1832
+ );
1833
+ value2 += tracker.move(">");
1834
+ exit();
1835
+ state.stack = stack;
1836
+ return value2;
1837
+ }
1838
+ exit = state.enter("link");
1839
+ subexit = state.enter("label");
1840
+ let value = tracker.move("[");
1841
+ value += tracker.move(
1842
+ state.containerPhrasing(node2, {
1843
+ before: value,
1844
+ after: "](",
1845
+ ...tracker.current()
1846
+ })
1847
+ );
1848
+ value += tracker.move("](");
1849
+ subexit();
1850
+ if (
1851
+ // If there’s no url but there is a title…
1852
+ !node2.url && node2.title || // If there are control characters or whitespace.
1853
+ /[\0- \u007F]/.test(node2.url)
1854
+ ) {
1855
+ subexit = state.enter("destinationLiteral");
1856
+ value += tracker.move("<");
1857
+ value += tracker.move(
1858
+ state.safe(node2.url, { before: value, after: ">", ...tracker.current() })
1859
+ );
1860
+ value += tracker.move(">");
1861
+ } else {
1862
+ subexit = state.enter("destinationRaw");
1863
+ value += tracker.move(
1864
+ state.safe(node2.url, {
1865
+ before: value,
1866
+ after: node2.title ? " " : ")",
1867
+ ...tracker.current()
1868
+ })
1869
+ );
1870
+ }
1871
+ subexit();
1872
+ if (node2.title) {
1873
+ subexit = state.enter(`title${suffix}`);
1874
+ value += tracker.move(" " + quote);
1875
+ value += tracker.move(
1876
+ state.safe(node2.title, {
1877
+ before: value,
1878
+ after: quote,
1879
+ ...tracker.current()
1880
+ })
1881
+ );
1882
+ value += tracker.move(quote);
1883
+ subexit();
1884
+ }
1885
+ value += tracker.move(")");
1886
+ exit();
1887
+ return value;
1888
+ }
1889
+ function linkPeek(node2, _, state) {
1890
+ return formatLinkAsAutolink(node2, state) ? "<" : "[";
1891
+ }
1892
+
1893
+ // node_modules/mdast-util-to-markdown/lib/handle/link-reference.js
1894
+ linkReference.peek = linkReferencePeek;
1895
+ function linkReference(node2, _, state, info) {
1896
+ const type = node2.referenceType;
1897
+ const exit = state.enter("linkReference");
1898
+ let subexit = state.enter("label");
1899
+ const tracker = state.createTracker(info);
1900
+ let value = tracker.move("[");
1901
+ const text2 = state.containerPhrasing(node2, {
1902
+ before: value,
1903
+ after: "]",
1904
+ ...tracker.current()
1905
+ });
1906
+ value += tracker.move(text2 + "][");
1907
+ subexit();
1908
+ const stack = state.stack;
1909
+ state.stack = [];
1910
+ subexit = state.enter("reference");
1911
+ const reference = state.safe(state.associationId(node2), {
1912
+ before: value,
1913
+ after: "]",
1914
+ ...tracker.current()
1915
+ });
1916
+ subexit();
1917
+ state.stack = stack;
1918
+ exit();
1919
+ if (type === "full" || !text2 || text2 !== reference) {
1920
+ value += tracker.move(reference + "]");
1921
+ } else if (type === "shortcut") {
1922
+ value = value.slice(0, -1);
1923
+ } else {
1924
+ value += tracker.move("]");
1925
+ }
1926
+ return value;
1927
+ }
1928
+ function linkReferencePeek() {
1929
+ return "[";
1930
+ }
1931
+
1932
+ // node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
1933
+ function checkBullet(state) {
1934
+ const marker = state.options.bullet || "*";
1935
+ if (marker !== "*" && marker !== "+" && marker !== "-") {
1936
+ throw new Error(
1937
+ "Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`"
1938
+ );
1939
+ }
1940
+ return marker;
1941
+ }
1942
+
1943
+ // node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js
1944
+ function checkBulletOther(state) {
1945
+ const bullet = checkBullet(state);
1946
+ const bulletOther = state.options.bulletOther;
1947
+ if (!bulletOther) {
1948
+ return bullet === "*" ? "-" : "*";
1949
+ }
1950
+ if (bulletOther !== "*" && bulletOther !== "+" && bulletOther !== "-") {
1951
+ throw new Error(
1952
+ "Cannot serialize items with `" + bulletOther + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
1953
+ );
1954
+ }
1955
+ if (bulletOther === bullet) {
1956
+ throw new Error(
1957
+ "Expected `bullet` (`" + bullet + "`) and `bulletOther` (`" + bulletOther + "`) to be different"
1958
+ );
1959
+ }
1960
+ return bulletOther;
1961
+ }
1962
+
1963
+ // node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js
1964
+ function checkBulletOrdered(state) {
1965
+ const marker = state.options.bulletOrdered || ".";
1966
+ if (marker !== "." && marker !== ")") {
1967
+ throw new Error(
1968
+ "Cannot serialize items with `" + marker + "` for `options.bulletOrdered`, expected `.` or `)`"
1969
+ );
1970
+ }
1971
+ return marker;
1972
+ }
1973
+
1974
+ // node_modules/mdast-util-to-markdown/lib/util/check-rule.js
1975
+ function checkRule(state) {
1976
+ const marker = state.options.rule || "*";
1977
+ if (marker !== "*" && marker !== "-" && marker !== "_") {
1978
+ throw new Error(
1979
+ "Cannot serialize rules with `" + marker + "` for `options.rule`, expected `*`, `-`, or `_`"
1980
+ );
1981
+ }
1982
+ return marker;
1983
+ }
1984
+
1985
+ // node_modules/mdast-util-to-markdown/lib/handle/list.js
1986
+ function list(node2, parent, state, info) {
1987
+ const exit = state.enter("list");
1988
+ const bulletCurrent = state.bulletCurrent;
1989
+ let bullet = node2.ordered ? checkBulletOrdered(state) : checkBullet(state);
1990
+ const bulletOther = node2.ordered ? bullet === "." ? ")" : "." : checkBulletOther(state);
1991
+ let useDifferentMarker = parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false;
1992
+ if (!node2.ordered) {
1993
+ const firstListItem = node2.children ? node2.children[0] : void 0;
1994
+ if (
1995
+ // Bullet could be used as a thematic break marker:
1996
+ (bullet === "*" || bullet === "-") && // Empty first list item:
1997
+ firstListItem && (!firstListItem.children || !firstListItem.children[0]) && // Directly in two other list items:
1998
+ state.stack[state.stack.length - 1] === "list" && state.stack[state.stack.length - 2] === "listItem" && state.stack[state.stack.length - 3] === "list" && state.stack[state.stack.length - 4] === "listItem" && // That are each the first child.
1999
+ state.indexStack[state.indexStack.length - 1] === 0 && state.indexStack[state.indexStack.length - 2] === 0 && state.indexStack[state.indexStack.length - 3] === 0
2000
+ ) {
2001
+ useDifferentMarker = true;
2002
+ }
2003
+ if (checkRule(state) === bullet && firstListItem) {
2004
+ let index = -1;
2005
+ while (++index < node2.children.length) {
2006
+ const item = node2.children[index];
2007
+ if (item && item.type === "listItem" && item.children && item.children[0] && item.children[0].type === "thematicBreak") {
2008
+ useDifferentMarker = true;
2009
+ break;
2010
+ }
2011
+ }
2012
+ }
2013
+ }
2014
+ if (useDifferentMarker) {
2015
+ bullet = bulletOther;
2016
+ }
2017
+ state.bulletCurrent = bullet;
2018
+ const value = state.containerFlow(node2, info);
2019
+ state.bulletLastUsed = bullet;
2020
+ state.bulletCurrent = bulletCurrent;
2021
+ exit();
2022
+ return value;
2023
+ }
2024
+
2025
+ // node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
2026
+ function checkListItemIndent(state) {
2027
+ const style = state.options.listItemIndent || "one";
2028
+ if (style !== "tab" && style !== "one" && style !== "mixed") {
2029
+ throw new Error(
2030
+ "Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
2031
+ );
2032
+ }
2033
+ return style;
2034
+ }
2035
+
2036
+ // node_modules/mdast-util-to-markdown/lib/handle/list-item.js
2037
+ function listItem(node2, parent, state, info) {
2038
+ const listItemIndent = checkListItemIndent(state);
2039
+ let bullet = state.bulletCurrent || checkBullet(state);
2040
+ if (parent && parent.type === "list" && parent.ordered) {
2041
+ bullet = (typeof parent.start === "number" && parent.start > -1 ? parent.start : 1) + (state.options.incrementListMarker === false ? 0 : parent.children.indexOf(node2)) + bullet;
2042
+ }
2043
+ let size = bullet.length + 1;
2044
+ if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.type === "list" && parent.spread || node2.spread)) {
2045
+ size = Math.ceil(size / 4) * 4;
2046
+ }
2047
+ const tracker = state.createTracker(info);
2048
+ tracker.move(bullet + " ".repeat(size - bullet.length));
2049
+ tracker.shift(size);
2050
+ const exit = state.enter("listItem");
2051
+ const value = state.indentLines(
2052
+ state.containerFlow(node2, tracker.current()),
2053
+ map3
2054
+ );
2055
+ exit();
2056
+ return value;
2057
+ function map3(line, index, blank) {
2058
+ if (index) {
2059
+ return (blank ? "" : " ".repeat(size)) + line;
2060
+ }
2061
+ return (blank ? bullet : bullet + " ".repeat(size - bullet.length)) + line;
2062
+ }
2063
+ }
2064
+
2065
+ // node_modules/mdast-util-to-markdown/lib/handle/paragraph.js
2066
+ function paragraph(node2, _, state, info) {
2067
+ const exit = state.enter("paragraph");
2068
+ const subexit = state.enter("phrasing");
2069
+ const value = state.containerPhrasing(node2, info);
2070
+ subexit();
2071
+ exit();
2072
+ return value;
2073
+ }
2074
+
2075
+ // node_modules/mdast-util-phrasing/lib/index.js
2076
+ var phrasing = (
2077
+ /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
2078
+ convert([
2079
+ "break",
2080
+ "delete",
2081
+ "emphasis",
2082
+ // To do: next major: removed since footnotes were added to GFM.
2083
+ "footnote",
2084
+ "footnoteReference",
2085
+ "image",
2086
+ "imageReference",
2087
+ "inlineCode",
2088
+ // Enabled by `mdast-util-math`:
2089
+ "inlineMath",
2090
+ "link",
2091
+ "linkReference",
2092
+ // Enabled by `mdast-util-mdx`:
2093
+ "mdxJsxTextElement",
2094
+ // Enabled by `mdast-util-mdx`:
2095
+ "mdxTextExpression",
2096
+ "strong",
2097
+ "text",
2098
+ // Enabled by `mdast-util-directive`:
2099
+ "textDirective"
2100
+ ])
2101
+ );
2102
+
2103
+ // node_modules/mdast-util-to-markdown/lib/handle/root.js
2104
+ function root(node2, _, state, info) {
2105
+ const hasPhrasing = node2.children.some(function(d) {
2106
+ return phrasing(d);
2107
+ });
2108
+ const container = hasPhrasing ? state.containerPhrasing : state.containerFlow;
2109
+ return container.call(state, node2, info);
2110
+ }
2111
+
2112
+ // node_modules/mdast-util-to-markdown/lib/util/check-strong.js
2113
+ function checkStrong(state) {
2114
+ const marker = state.options.strong || "*";
2115
+ if (marker !== "*" && marker !== "_") {
2116
+ throw new Error(
2117
+ "Cannot serialize strong with `" + marker + "` for `options.strong`, expected `*`, or `_`"
2118
+ );
2119
+ }
2120
+ return marker;
2121
+ }
2122
+
2123
+ // node_modules/mdast-util-to-markdown/lib/handle/strong.js
2124
+ strong.peek = strongPeek;
2125
+ function strong(node2, _, state, info) {
2126
+ const marker = checkStrong(state);
2127
+ const exit = state.enter("strong");
2128
+ const tracker = state.createTracker(info);
2129
+ const before = tracker.move(marker + marker);
2130
+ let between = tracker.move(
2131
+ state.containerPhrasing(node2, {
2132
+ after: marker,
2133
+ before,
2134
+ ...tracker.current()
2135
+ })
2136
+ );
2137
+ const betweenHead = between.charCodeAt(0);
2138
+ const open = encodeInfo(
2139
+ info.before.charCodeAt(info.before.length - 1),
2140
+ betweenHead,
2141
+ marker
2142
+ );
2143
+ if (open.inside) {
2144
+ between = encodeCharacterReference(betweenHead) + between.slice(1);
2145
+ }
2146
+ const betweenTail = between.charCodeAt(between.length - 1);
2147
+ const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker);
2148
+ if (close.inside) {
2149
+ between = between.slice(0, -1) + encodeCharacterReference(betweenTail);
2150
+ }
2151
+ const after = tracker.move(marker + marker);
2152
+ exit();
2153
+ state.attentionEncodeSurroundingInfo = {
2154
+ after: close.outside,
2155
+ before: open.outside
2156
+ };
2157
+ return before + between + after;
2158
+ }
2159
+ function strongPeek(_, _1, state) {
2160
+ return state.options.strong || "*";
2161
+ }
2162
+
2163
+ // node_modules/mdast-util-to-markdown/lib/handle/text.js
2164
+ function text(node2, _, state, info) {
2165
+ return state.safe(node2.value, info);
2166
+ }
2167
+
2168
+ // node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js
2169
+ function checkRuleRepetition(state) {
2170
+ const repetition = state.options.ruleRepetition || 3;
2171
+ if (repetition < 3) {
2172
+ throw new Error(
2173
+ "Cannot serialize rules with repetition `" + repetition + "` for `options.ruleRepetition`, expected `3` or more"
2174
+ );
2175
+ }
2176
+ return repetition;
2177
+ }
2178
+
2179
+ // node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js
2180
+ function thematicBreak(_, _1, state) {
2181
+ const value = (checkRule(state) + (state.options.ruleSpaces ? " " : "")).repeat(checkRuleRepetition(state));
2182
+ return state.options.ruleSpaces ? value.slice(0, -1) : value;
2183
+ }
2184
+
2185
+ // node_modules/mdast-util-to-markdown/lib/handle/index.js
2186
+ var handle = {
2187
+ blockquote,
2188
+ break: hardBreak,
2189
+ code,
2190
+ definition,
2191
+ emphasis,
2192
+ hardBreak,
2193
+ heading,
2194
+ html,
2195
+ image,
2196
+ imageReference,
2197
+ inlineCode,
2198
+ link,
2199
+ linkReference,
2200
+ list,
2201
+ listItem,
2202
+ paragraph,
2203
+ root,
2204
+ strong,
2205
+ text,
2206
+ thematicBreak
2207
+ };
2208
+
2209
+ // src/lib/mdast/task-char-to-markdown.ts
2210
+ function taskCharToMarkdown() {
2211
+ return {
2212
+ unsafe: [{ atBreak: true, character: "-", after: "[:|-]" }],
2213
+ handlers: {
2214
+ listItem(node2, parent, state, info) {
2215
+ const taskChar = node2.data?.taskChar ?? (typeof node2.checked === "boolean" ? node2.checked ? "x" : " " : null);
2216
+ const head = node2.children[0];
2217
+ const isTask = taskChar !== null && head?.type === "paragraph";
2218
+ if (!isTask) {
2219
+ return handle.listItem(node2, parent, state, info);
2220
+ }
2221
+ const checkbox = `[${taskChar}] `;
2222
+ const tracker = state.createTracker(info);
2223
+ tracker.move(checkbox);
2224
+ const savedChecked = node2.checked;
2225
+ delete node2.checked;
2226
+ let value = handle.listItem(node2, parent, state, {
2227
+ ...info,
2228
+ ...tracker.current()
2229
+ });
2230
+ node2.checked = savedChecked;
2231
+ value = value.replace(
2232
+ /^([*+-]|\d+\.)([\r\n]| {1,3})/,
2233
+ (match) => match + checkbox
2234
+ );
2235
+ return value;
2236
+ }
2237
+ }
2238
+ };
1202
2239
  }
1203
2240
 
1204
2241
  // node_modules/micromark-factory-space/index.js
@@ -1206,20 +2243,20 @@ function factorySpace(effects, ok3, type, max) {
1206
2243
  const limit = max ? max - 1 : Number.POSITIVE_INFINITY;
1207
2244
  let size = 0;
1208
2245
  return start;
1209
- function start(code) {
1210
- if (markdownSpace(code)) {
2246
+ function start(code2) {
2247
+ if (markdownSpace(code2)) {
1211
2248
  effects.enter(type);
1212
- return prefix(code);
2249
+ return prefix(code2);
1213
2250
  }
1214
- return ok3(code);
2251
+ return ok3(code2);
1215
2252
  }
1216
- function prefix(code) {
1217
- if (markdownSpace(code) && size++ < limit) {
1218
- effects.consume(code);
2253
+ function prefix(code2) {
2254
+ if (markdownSpace(code2) && size++ < limit) {
2255
+ effects.consume(code2);
1219
2256
  return prefix;
1220
2257
  }
1221
2258
  effects.exit(type);
1222
- return ok3(code);
2259
+ return ok3(code2);
1223
2260
  }
1224
2261
  }
1225
2262
 
@@ -1239,127 +2276,127 @@ function tokenizeMathFenced(effects, ok3, nok) {
1239
2276
  const initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
1240
2277
  let sizeOpen = 0;
1241
2278
  return start;
1242
- function start(code) {
2279
+ function start(code2) {
1243
2280
  effects.enter("mathFlow");
1244
2281
  effects.enter("mathFlowFence");
1245
2282
  effects.enter("mathFlowFenceSequence");
1246
- return sequenceOpen(code);
2283
+ return sequenceOpen(code2);
1247
2284
  }
1248
- function sequenceOpen(code) {
1249
- if (code === 36) {
1250
- effects.consume(code);
2285
+ function sequenceOpen(code2) {
2286
+ if (code2 === 36) {
2287
+ effects.consume(code2);
1251
2288
  sizeOpen++;
1252
2289
  return sequenceOpen;
1253
2290
  }
1254
2291
  if (sizeOpen < 2) {
1255
- return nok(code);
2292
+ return nok(code2);
1256
2293
  }
1257
2294
  effects.exit("mathFlowFenceSequence");
1258
- return factorySpace(effects, metaBefore, "whitespace")(code);
2295
+ return factorySpace(effects, metaBefore, "whitespace")(code2);
1259
2296
  }
1260
- function metaBefore(code) {
1261
- if (code === null || markdownLineEnding(code)) {
1262
- return metaAfter(code);
2297
+ function metaBefore(code2) {
2298
+ if (code2 === null || markdownLineEnding(code2)) {
2299
+ return metaAfter(code2);
1263
2300
  }
1264
2301
  effects.enter("mathFlowFenceMeta");
1265
2302
  effects.enter("chunkString", {
1266
2303
  contentType: "string"
1267
2304
  });
1268
- return meta(code);
2305
+ return meta(code2);
1269
2306
  }
1270
- function meta(code) {
1271
- if (code === null || markdownLineEnding(code)) {
2307
+ function meta(code2) {
2308
+ if (code2 === null || markdownLineEnding(code2)) {
1272
2309
  effects.exit("chunkString");
1273
2310
  effects.exit("mathFlowFenceMeta");
1274
- return metaAfter(code);
2311
+ return metaAfter(code2);
1275
2312
  }
1276
- if (code === 36) {
1277
- return nok(code);
2313
+ if (code2 === 36) {
2314
+ return nok(code2);
1278
2315
  }
1279
- effects.consume(code);
2316
+ effects.consume(code2);
1280
2317
  return meta;
1281
2318
  }
1282
- function metaAfter(code) {
2319
+ function metaAfter(code2) {
1283
2320
  effects.exit("mathFlowFence");
1284
2321
  if (self.interrupt) {
1285
- return ok3(code);
2322
+ return ok3(code2);
1286
2323
  }
1287
- return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code);
2324
+ return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code2);
1288
2325
  }
1289
- function beforeNonLazyContinuation(code) {
2326
+ function beforeNonLazyContinuation(code2) {
1290
2327
  return effects.attempt({
1291
2328
  tokenize: tokenizeClosingFence,
1292
2329
  partial: true
1293
- }, after, contentStart)(code);
2330
+ }, after, contentStart)(code2);
1294
2331
  }
1295
- function contentStart(code) {
1296
- return (initialSize ? factorySpace(effects, beforeContentChunk, "linePrefix", initialSize + 1) : beforeContentChunk)(code);
2332
+ function contentStart(code2) {
2333
+ return (initialSize ? factorySpace(effects, beforeContentChunk, "linePrefix", initialSize + 1) : beforeContentChunk)(code2);
1297
2334
  }
1298
- function beforeContentChunk(code) {
1299
- if (code === null) {
1300
- return after(code);
2335
+ function beforeContentChunk(code2) {
2336
+ if (code2 === null) {
2337
+ return after(code2);
1301
2338
  }
1302
- if (markdownLineEnding(code)) {
1303
- return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code);
2339
+ if (markdownLineEnding(code2)) {
2340
+ return effects.attempt(nonLazyContinuation2, beforeNonLazyContinuation, after)(code2);
1304
2341
  }
1305
2342
  effects.enter("mathFlowValue");
1306
- return contentChunk(code);
2343
+ return contentChunk(code2);
1307
2344
  }
1308
- function contentChunk(code) {
1309
- if (code === null || markdownLineEnding(code)) {
2345
+ function contentChunk(code2) {
2346
+ if (code2 === null || markdownLineEnding(code2)) {
1310
2347
  effects.exit("mathFlowValue");
1311
- return beforeContentChunk(code);
2348
+ return beforeContentChunk(code2);
1312
2349
  }
1313
- effects.consume(code);
2350
+ effects.consume(code2);
1314
2351
  return contentChunk;
1315
2352
  }
1316
- function after(code) {
2353
+ function after(code2) {
1317
2354
  effects.exit("mathFlow");
1318
- return ok3(code);
2355
+ return ok3(code2);
1319
2356
  }
1320
2357
  function tokenizeClosingFence(effects2, ok4, nok2) {
1321
2358
  let size = 0;
1322
2359
  return factorySpace(effects2, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
1323
- function beforeSequenceClose(code) {
2360
+ function beforeSequenceClose(code2) {
1324
2361
  effects2.enter("mathFlowFence");
1325
2362
  effects2.enter("mathFlowFenceSequence");
1326
- return sequenceClose(code);
2363
+ return sequenceClose(code2);
1327
2364
  }
1328
- function sequenceClose(code) {
1329
- if (code === 36) {
2365
+ function sequenceClose(code2) {
2366
+ if (code2 === 36) {
1330
2367
  size++;
1331
- effects2.consume(code);
2368
+ effects2.consume(code2);
1332
2369
  return sequenceClose;
1333
2370
  }
1334
2371
  if (size < sizeOpen) {
1335
- return nok2(code);
2372
+ return nok2(code2);
1336
2373
  }
1337
2374
  effects2.exit("mathFlowFenceSequence");
1338
- return factorySpace(effects2, afterSequenceClose, "whitespace")(code);
2375
+ return factorySpace(effects2, afterSequenceClose, "whitespace")(code2);
1339
2376
  }
1340
- function afterSequenceClose(code) {
1341
- if (code === null || markdownLineEnding(code)) {
2377
+ function afterSequenceClose(code2) {
2378
+ if (code2 === null || markdownLineEnding(code2)) {
1342
2379
  effects2.exit("mathFlowFence");
1343
- return ok4(code);
2380
+ return ok4(code2);
1344
2381
  }
1345
- return nok2(code);
2382
+ return nok2(code2);
1346
2383
  }
1347
2384
  }
1348
2385
  }
1349
2386
  function tokenizeNonLazyContinuation2(effects, ok3, nok) {
1350
2387
  const self = this;
1351
2388
  return start;
1352
- function start(code) {
1353
- if (code === null) {
1354
- return ok3(code);
2389
+ function start(code2) {
2390
+ if (code2 === null) {
2391
+ return ok3(code2);
1355
2392
  }
1356
2393
  effects.enter("lineEnding");
1357
- effects.consume(code);
2394
+ effects.consume(code2);
1358
2395
  effects.exit("lineEnding");
1359
2396
  return lineStart;
1360
2397
  }
1361
- function lineStart(code) {
1362
- return self.parser.lazy[self.now().line] ? nok(code) : ok3(code);
2398
+ function lineStart(code2) {
2399
+ return self.parser.lazy[self.now().line] ? nok(code2) : ok3(code2);
1363
2400
  }
1364
2401
  }
1365
2402
 
@@ -1382,68 +2419,68 @@ function mathText(options) {
1382
2419
  let size;
1383
2420
  let token;
1384
2421
  return start;
1385
- function start(code) {
2422
+ function start(code2) {
1386
2423
  effects.enter("mathText");
1387
2424
  effects.enter("mathTextSequence");
1388
- return sequenceOpen(code);
2425
+ return sequenceOpen(code2);
1389
2426
  }
1390
- function sequenceOpen(code) {
1391
- if (code === 36) {
1392
- effects.consume(code);
2427
+ function sequenceOpen(code2) {
2428
+ if (code2 === 36) {
2429
+ effects.consume(code2);
1393
2430
  sizeOpen++;
1394
2431
  return sequenceOpen;
1395
2432
  }
1396
2433
  if (sizeOpen < 2 && !single) {
1397
- return nok(code);
2434
+ return nok(code2);
1398
2435
  }
1399
2436
  effects.exit("mathTextSequence");
1400
- return between(code);
2437
+ return between(code2);
1401
2438
  }
1402
- function between(code) {
1403
- if (code === null) {
1404
- return nok(code);
2439
+ function between(code2) {
2440
+ if (code2 === null) {
2441
+ return nok(code2);
1405
2442
  }
1406
- if (code === 36) {
2443
+ if (code2 === 36) {
1407
2444
  token = effects.enter("mathTextSequence");
1408
2445
  size = 0;
1409
- return sequenceClose(code);
2446
+ return sequenceClose(code2);
1410
2447
  }
1411
- if (code === 32) {
2448
+ if (code2 === 32) {
1412
2449
  effects.enter("space");
1413
- effects.consume(code);
2450
+ effects.consume(code2);
1414
2451
  effects.exit("space");
1415
2452
  return between;
1416
2453
  }
1417
- if (markdownLineEnding(code)) {
2454
+ if (markdownLineEnding(code2)) {
1418
2455
  effects.enter("lineEnding");
1419
- effects.consume(code);
2456
+ effects.consume(code2);
1420
2457
  effects.exit("lineEnding");
1421
2458
  return between;
1422
2459
  }
1423
2460
  effects.enter("mathTextData");
1424
- return data(code);
2461
+ return data(code2);
1425
2462
  }
1426
- function data(code) {
1427
- if (code === null || code === 32 || code === 36 || markdownLineEnding(code)) {
2463
+ function data(code2) {
2464
+ if (code2 === null || code2 === 32 || code2 === 36 || markdownLineEnding(code2)) {
1428
2465
  effects.exit("mathTextData");
1429
- return between(code);
2466
+ return between(code2);
1430
2467
  }
1431
- effects.consume(code);
2468
+ effects.consume(code2);
1432
2469
  return data;
1433
2470
  }
1434
- function sequenceClose(code) {
1435
- if (code === 36) {
1436
- effects.consume(code);
2471
+ function sequenceClose(code2) {
2472
+ if (code2 === 36) {
2473
+ effects.consume(code2);
1437
2474
  size++;
1438
2475
  return sequenceClose;
1439
2476
  }
1440
2477
  if (size === sizeOpen) {
1441
2478
  effects.exit("mathTextSequence");
1442
2479
  effects.exit("mathText");
1443
- return ok3(code);
2480
+ return ok3(code2);
1444
2481
  }
1445
2482
  token.type = "mathTextData";
1446
- return data(code);
2483
+ return data(code2);
1447
2484
  }
1448
2485
  }
1449
2486
  }
@@ -1484,8 +2521,8 @@ function resolveMathText(events) {
1484
2521
  }
1485
2522
  return events;
1486
2523
  }
1487
- function previous(code) {
1488
- return code !== 36 || this.events[this.events.length - 1][1].type === "characterEscape";
2524
+ function previous(code2) {
2525
+ return code2 !== 36 || this.events[this.events.length - 1][1].type === "characterEscape";
1489
2526
  }
1490
2527
 
1491
2528
  // node_modules/micromark-extension-math/lib/syntax.js
@@ -1504,30 +2541,6 @@ function math(options) {
1504
2541
  function ok2() {
1505
2542
  }
1506
2543
 
1507
- // node_modules/longest-streak/index.js
1508
- function longestStreak(value, substring) {
1509
- const source = String(value);
1510
- let index = source.indexOf(substring);
1511
- let expected = index;
1512
- let count = 0;
1513
- let max = 0;
1514
- if (typeof substring !== "string") {
1515
- throw new TypeError("Expected substring");
1516
- }
1517
- while (index !== -1) {
1518
- if (index === expected) {
1519
- if (++count > max) {
1520
- max = count;
1521
- }
1522
- } else {
1523
- count = 1;
1524
- }
1525
- expected = index + substring.length;
1526
- index = source.indexOf(substring, expected);
1527
- }
1528
- return max;
1529
- }
1530
-
1531
2544
  // node_modules/mdast-util-math/lib/index.js
1532
2545
  function mathFromMarkdown() {
1533
2546
  return {
@@ -1546,7 +2559,7 @@ function mathFromMarkdown() {
1546
2559
  }
1547
2560
  };
1548
2561
  function enterMathFlow(token) {
1549
- const code = {
2562
+ const code2 = {
1550
2563
  type: "element",
1551
2564
  tagName: "code",
1552
2565
  properties: { className: ["language-math", "math-display"] },
@@ -1557,7 +2570,7 @@ function mathFromMarkdown() {
1557
2570
  type: "math",
1558
2571
  meta: null,
1559
2572
  value: "",
1560
- data: { hName: "pre", hChildren: [code] }
2573
+ data: { hName: "pre", hChildren: [code2] }
1561
2574
  },
1562
2575
  token
1563
2576
  );
@@ -1567,9 +2580,9 @@ function mathFromMarkdown() {
1567
2580
  }
1568
2581
  function exitMathFlowMeta() {
1569
2582
  const data = this.resume();
1570
- const node = this.stack[this.stack.length - 1];
1571
- ok2(node.type === "math");
1572
- node.meta = data;
2583
+ const node2 = this.stack[this.stack.length - 1];
2584
+ ok2(node2.type === "math");
2585
+ node2.meta = data;
1573
2586
  }
1574
2587
  function exitMathFlowFence() {
1575
2588
  if (this.data.mathFlowInside) return;
@@ -1578,17 +2591,17 @@ function mathFromMarkdown() {
1578
2591
  }
1579
2592
  function exitMathFlow(token) {
1580
2593
  const data = this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
1581
- const node = this.stack[this.stack.length - 1];
1582
- ok2(node.type === "math");
2594
+ const node2 = this.stack[this.stack.length - 1];
2595
+ ok2(node2.type === "math");
1583
2596
  this.exit(token);
1584
- node.value = data;
1585
- const code = (
2597
+ node2.value = data;
2598
+ const code2 = (
1586
2599
  /** @type {HastElement} */
1587
- node.data.hChildren[0]
2600
+ node2.data.hChildren[0]
1588
2601
  );
1589
- ok2(code.type === "element");
1590
- ok2(code.tagName === "code");
1591
- code.children.push({ type: "text", value: data });
2602
+ ok2(code2.type === "element");
2603
+ ok2(code2.tagName === "code");
2604
+ code2.children.push({ type: "text", value: data });
1592
2605
  this.data.mathFlowInside = void 0;
1593
2606
  }
1594
2607
  function enterMathText(token) {
@@ -1608,14 +2621,14 @@ function mathFromMarkdown() {
1608
2621
  }
1609
2622
  function exitMathText(token) {
1610
2623
  const data = this.resume();
1611
- const node = this.stack[this.stack.length - 1];
1612
- ok2(node.type === "inlineMath");
2624
+ const node2 = this.stack[this.stack.length - 1];
2625
+ ok2(node2.type === "inlineMath");
1613
2626
  this.exit(token);
1614
- node.value = data;
2627
+ node2.value = data;
1615
2628
  const children = (
1616
2629
  /** @type {Array<HastElementContent>} */
1617
2630
  // @ts-expect-error: we defined it in `enterMathFlow`.
1618
- node.data.hChildren
2631
+ node2.data.hChildren
1619
2632
  );
1620
2633
  children.push({ type: "text", value: data });
1621
2634
  }
@@ -1644,16 +2657,16 @@ function mathToMarkdown(options) {
1644
2657
  ],
1645
2658
  handlers: { math: math2, inlineMath }
1646
2659
  };
1647
- function math2(node, _, state, info) {
1648
- const raw = node.value || "";
2660
+ function math2(node2, _, state, info) {
2661
+ const raw = node2.value || "";
1649
2662
  const tracker = state.createTracker(info);
1650
2663
  const sequence = "$".repeat(Math.max(longestStreak(raw, "$") + 1, 2));
1651
2664
  const exit = state.enter("mathFlow");
1652
2665
  let value = tracker.move(sequence);
1653
- if (node.meta) {
2666
+ if (node2.meta) {
1654
2667
  const subexit = state.enter("mathFlowMeta");
1655
2668
  value += tracker.move(
1656
- state.safe(node.meta, {
2669
+ state.safe(node2.meta, {
1657
2670
  after: "\n",
1658
2671
  before: value,
1659
2672
  encode: ["$"],
@@ -1670,8 +2683,8 @@ function mathToMarkdown(options) {
1670
2683
  exit();
1671
2684
  return value;
1672
2685
  }
1673
- function inlineMath(node, _, state) {
1674
- let value = node.value || "";
2686
+ function inlineMath(node2, _, state) {
2687
+ let value = node2.value || "";
1675
2688
  let size = 1;
1676
2689
  if (!single) size++;
1677
2690
  while (new RegExp("(^|[^$])" + "\\$".repeat(size) + "([^$]|$)").test(value)) {
@@ -1747,6 +2760,9 @@ function remarkObsidian(userOpts) {
1747
2760
  data.fromMarkdownExtensions.push(mathFromMarkdown());
1748
2761
  data.toMarkdownExtensions.push(mathToMarkdown());
1749
2762
  }
2763
+ if (opts.customTaskChars) {
2764
+ data.toMarkdownExtensions.push(taskCharToMarkdown());
2765
+ }
1750
2766
  const needsTransform = opts.comments || opts.customTaskChars;
1751
2767
  if (!needsTransform) return void 0;
1752
2768
  return (tree, file) => {
@@ -1780,6 +2796,7 @@ export {
1780
2796
  tagFromMarkdown,
1781
2797
  tagSyntax,
1782
2798
  tagToMarkdown,
2799
+ taskCharToMarkdown,
1783
2800
  wikilinkFromMarkdown,
1784
2801
  wikilinkSyntax,
1785
2802
  wikilinkToMarkdown