@rohal12/spindle 0.64.8 → 0.64.10

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.
@@ -54,6 +54,19 @@ var NameSet = class {
54
54
  this.names.clear();
55
55
  }
56
56
  };
57
+ /** Text-only bodies recognize their own end tag, never nested HTML tags. */
58
+ var HTML_TEXT_ELEMENTS$1 = /* @__PURE__ */ new Set([
59
+ .../* @__PURE__ */ new Set([
60
+ "script",
61
+ "style",
62
+ "xmp",
63
+ "iframe",
64
+ "noembed",
65
+ "noframes"
66
+ ]),
67
+ "textarea",
68
+ "title"
69
+ ]);
57
70
  // src/markup/tokens.ts
58
71
  /** Variable sigils: story ($), temporary (_), local (@), transient (%). */
59
72
  var SIGIL_SCOPES = {
@@ -82,12 +95,13 @@ function withSelectors$1(target, from) {
82
95
  */
83
96
  var grammar_shared_default = {
84
97
  SIGIL_SCOPES,
85
- withSelectors: withSelectors$1
98
+ withSelectors: withSelectors$1,
99
+ HTML_TEXT_ELEMENTS: HTML_TEXT_ELEMENTS$1
86
100
  };
87
101
  // src/markup/spindle.peggy
88
102
  var LB = String.fromCharCode(123);
89
103
  var RB = String.fromCharCode(125);
90
- var { SIGIL_SCOPES: SIGIL_SCOPES$1, withSelectors } = grammar_shared_default;
104
+ var { SIGIL_SCOPES: SIGIL_SCOPES$1, withSelectors, HTML_TEXT_ELEMENTS } = grammar_shared_default;
91
105
  var VOID_TAGS = /* @__PURE__ */ new Set([
92
106
  "area",
93
107
  "base",
@@ -629,79 +643,96 @@ function peg$parse(input, options) {
629
643
  return joinText(items);
630
644
  }
631
645
  function peg$f1() {
632
- return !textMode;
646
+ return !htmlTextTag;
633
647
  }
634
648
  function peg$f2() {
635
- return !textMode;
649
+ return !htmlTextTag;
636
650
  }
637
- function peg$f3(tag) {
638
- return tag;
651
+ function peg$f3() {
652
+ return !htmlTextTag;
639
653
  }
640
654
  function peg$f4() {
655
+ return !textMode && !htmlTextTag;
656
+ }
657
+ function peg$f5() {
658
+ return !textMode && !htmlTextTag;
659
+ }
660
+ function peg$f6(tag) {
661
+ if (!tag.isSelfClose && HTML_TEXT_ELEMENTS.has(tag.lower)) htmlTextTag = tag.lower;
662
+ return tag;
663
+ }
664
+ function peg$f7() {
641
665
  return !textMode;
642
666
  }
643
- function peg$f5(tag) {
667
+ function peg$f8(tag) {
668
+ return !htmlTextTag || tag.lower === htmlTextTag;
669
+ }
670
+ function peg$f9(tag) {
671
+ htmlTextTag = "";
644
672
  return VOID_TAGS.has(tag.lower) ? null : tag;
645
673
  }
646
- function peg$f6(tag) {
674
+ function peg$f10(tag) {
647
675
  rawName = tag.lower;
648
676
  return tag.kind === "open" && hooks.isRaw(rawName);
649
677
  }
650
- function peg$f7(tag, b) {
678
+ function peg$f11(tag, b) {
651
679
  return b;
652
680
  }
653
- function peg$f8(tag, body) {
681
+ function peg$f12(tag, body) {
654
682
  return body ? [tag, body] : tag;
655
683
  }
656
- function peg$f9(tag) {
684
+ function peg$f13(tag) {
657
685
  return tag.kind === "close";
658
686
  }
659
- function peg$f10(tag) {
687
+ function peg$f14(tag) {
660
688
  return tag;
661
689
  }
662
- function peg$f11() {
690
+ function peg$f15() {
663
691
  return !textMode;
664
692
  }
665
- function peg$f12(tag) {
693
+ function peg$f16(tag) {
666
694
  return tag;
667
695
  }
668
- function peg$f13(start) {
696
+ function peg$f17(start) {
669
697
  return skipTo(hooks.rawBodyEnd(input, start, rawName));
670
698
  }
671
- function peg$f14(start) {
699
+ function peg$f18(start) {
672
700
  return skipEnd - offset();
673
701
  }
674
- function peg$f15(start, body, end) {
702
+ function peg$f19(start, body, end) {
675
703
  const loc = {
676
704
  start: { offset: start },
677
705
  end: { offset: start + body.length }
678
706
  };
679
707
  return [body ? lexeme("text", loc, { value: body }) : null, end];
680
708
  }
681
- function peg$f16() {
709
+ function peg$f20() {
682
710
  return completionMode;
683
711
  }
684
- function peg$f17(body) {
712
+ function peg$f21(body) {
685
713
  return lexeme("text", location(), { value: body });
686
714
  }
687
- function peg$f18() {
715
+ function peg$f22() {
688
716
  return offset();
689
717
  }
690
- function peg$f19(value) {
718
+ function peg$f23(value) {
691
719
  return lexeme("text", location(), { value });
692
720
  }
693
- function peg$f20(value) {
721
+ function peg$f24() {
722
+ return completionMode || offset() <= lastCommentClose;
723
+ }
724
+ function peg$f25(value) {
694
725
  const node = lexeme("text", location(), { value });
695
726
  node.comment = true;
696
727
  return node;
697
728
  }
698
- function peg$f21(bs) {
729
+ function peg$f26(bs) {
699
730
  return bs.length % 2 === 1;
700
731
  }
701
- function peg$f22(bs, c) {
732
+ function peg$f27(bs, c) {
702
733
  return c;
703
734
  }
704
- function peg$f23(bs, brace) {
735
+ function peg$f28(bs, brace) {
705
736
  const loc = location();
706
737
  const next = input.charAt(loc.end.offset);
707
738
  if (textMode) {
@@ -718,48 +749,48 @@ function peg$parse(input, options) {
718
749
  escaped.escape = true;
719
750
  return bs.length > 1 ? [before, escaped] : escaped;
720
751
  }
721
- function peg$f24() {
752
+ function peg$f29() {
722
753
  return lexeme("text", location(), { value: LB });
723
754
  }
724
- function peg$f25() {
725
- return !textMode;
755
+ function peg$f30() {
756
+ return !textMode && !htmlTextTag;
726
757
  }
727
- function peg$f26() {
758
+ function peg$f31() {
728
759
  return lexeme("text", location(), { value: "<" });
729
760
  }
730
- function peg$f27() {
761
+ function peg$f32() {
731
762
  return lexeme("text", location(), { value: "[" });
732
763
  }
733
- function peg$f28() {
764
+ function peg$f33() {
734
765
  return !textMode;
735
766
  }
736
- function peg$f29(ss, s, at, inner) {
767
+ function peg$f34(ss, s, at, inner) {
737
768
  const link = lexeme("link", location(), parseLink(inner, at, (separator) => linkSeparatorIndex(inner, at, separator)));
738
769
  link.selectorSpan = selectorSpan(s, ss, at);
739
770
  return withSelectors(link, s);
740
771
  }
741
- function peg$f30() {
772
+ function peg$f35() {
742
773
  return !textMode;
743
774
  }
744
- function peg$f31() {
775
+ function peg$f36() {
745
776
  fail("Unclosed link: [[ without ]]", location(), "unclosed-link");
746
777
  }
747
- function peg$f32(parts) {
778
+ function peg$f37(parts) {
748
779
  return selectorsOf(parts);
749
780
  }
750
- function peg$f33() {
781
+ function peg$f38() {
751
782
  return NO_SELECTORS;
752
783
  }
753
- function peg$f34(s, end) {
784
+ function peg$f39(s, end) {
754
785
  return {
755
786
  ...s,
756
787
  end
757
788
  };
758
789
  }
759
- function peg$f35(prefix, name) {
790
+ function peg$f40(prefix, name) {
760
791
  return [prefix, name];
761
792
  }
762
- function peg$f36(ss, s, sigil, nameStart, name) {
793
+ function peg$f41(ss, s, sigil, nameStart, name) {
763
794
  const variable = lexeme("variable", location(), {
764
795
  name,
765
796
  nameStart,
@@ -769,7 +800,7 @@ function peg$parse(input, options) {
769
800
  variable.selectorSpan = selectorSpan(s, ss, nameStart - 1);
770
801
  return withSelectors(variable, s);
771
802
  }
772
- function peg$f37(ss, s, after, expression) {
803
+ function peg$f42(ss, s, after, expression) {
773
804
  const node = lexeme("expression", location(), {
774
805
  expression,
775
806
  expressionStart: after,
@@ -778,33 +809,33 @@ function peg$parse(input, options) {
778
809
  node.selectorSpan = selectorSpan(s, ss, after);
779
810
  return withSelectors(node, s);
780
811
  }
781
- function peg$f38() {
812
+ function peg$f43() {
782
813
  fail("Unclosed {" + input.substr(location().end.offset, 1) + "…: no } ends it", location(), "unclosed-expression");
783
814
  }
784
- function peg$f39(start) {
815
+ function peg$f44(start) {
785
816
  const end = hooks.closeBrace(input, start, start);
786
817
  return skipTo(end < 0 && completionMode ? input.length : end);
787
818
  }
788
- function peg$f40(start) {
819
+ function peg$f45(start) {
789
820
  return skipEnd - offset();
790
821
  }
791
- function peg$f41(start, code) {
822
+ function peg$f46(start, code) {
792
823
  return code;
793
824
  }
794
- function peg$f42() {
825
+ function peg$f47() {
795
826
  return completionMode;
796
827
  }
797
- function peg$f43(ss, s, start, close, name, nameEnd) {
828
+ function peg$f48(ss, s, start, close, name, nameEnd) {
798
829
  const end = hooks.closeBrace(input, nameEnd, start);
799
830
  return skipTo(end < 0 && completionMode ? input.length : end);
800
831
  }
801
- function peg$f44(ss, s, start, close, name, nameEnd) {
832
+ function peg$f49(ss, s, start, close, name, nameEnd) {
802
833
  return skipEnd - offset();
803
834
  }
804
- function peg$f45(ss, s, start, close, name, nameEnd, args) {
835
+ function peg$f50(ss, s, start, close, name, nameEnd, args) {
805
836
  return args;
806
837
  }
807
- function peg$f46(ss, s, start, close, name, nameEnd, tail) {
838
+ function peg$f51(ss, s, start, close, name, nameEnd, tail) {
808
839
  const loc = location();
809
840
  const lower = name.toLowerCase();
810
841
  const tag = lexeme("macro", loc, {
@@ -830,19 +861,19 @@ function peg$parse(input, options) {
830
861
  }
831
862
  return tag;
832
863
  }
833
- function peg$f47(s) {
864
+ function peg$f52(s) {
834
865
  fail("A closing tag starts with a letter after {/", location(), "invalid-closer");
835
866
  }
836
- function peg$f48(value) {
867
+ function peg$f53(value) {
837
868
  return EMAIL_AUTOLINK.test(value);
838
869
  }
839
- function peg$f49(value) {
870
+ function peg$f54(value) {
840
871
  return lexeme("text", location(), { value });
841
872
  }
842
- function peg$f50(value) {
873
+ function peg$f55(value) {
843
874
  return lexeme("text", location(), { value });
844
875
  }
845
- function peg$f51(tagStart, tag, list, slash) {
876
+ function peg$f56(tagStart, tag, list, slash) {
846
877
  const lower = tag.toLowerCase();
847
878
  return lexeme("html", location(), {
848
879
  tag,
@@ -855,7 +886,7 @@ function peg$parse(input, options) {
855
886
  isSelfClose: !!slash || VOID_TAGS.has(lower)
856
887
  });
857
888
  }
858
- function peg$f52(tag, bad) {
889
+ function peg$f57(tag, bad) {
859
890
  const c = input.charAt(bad);
860
891
  if (!c) fail("Unclosed tag <" + tag + ": no > ends it (write &lt; for a < that starts no tag)", location(), "unclosed-tag");
861
892
  const at = {
@@ -873,7 +904,7 @@ function peg$parse(input, options) {
873
904
  };
874
905
  fail("Unexpected " + JSON.stringify(c) + " in the tag <" + tag + ">: expected an attribute, or > to end the tag", at, "unexpected-character");
875
906
  }
876
- function peg$f53(tagStart, tag) {
907
+ function peg$f58(tagStart, tag) {
877
908
  return lexeme("html", location(), {
878
909
  tag,
879
910
  lower: tag.toLowerCase(),
@@ -885,14 +916,14 @@ function peg$parse(input, options) {
885
916
  isSelfClose: false
886
917
  });
887
918
  }
888
- function peg$f54(nameStart, name) {
919
+ function peg$f59(nameStart, name) {
889
920
  attrCode = hooks.isCodeAttribute(name);
890
921
  return true;
891
922
  }
892
- function peg$f55(nameStart, name, v) {
923
+ function peg$f60(nameStart, name, v) {
893
924
  return v;
894
925
  }
895
- function peg$f56(nameStart, name, value) {
926
+ function peg$f61(nameStart, name, value) {
896
927
  const attribute = {
897
928
  name,
898
929
  value: value ? value.value : "",
@@ -906,7 +937,7 @@ function peg$parse(input, options) {
906
937
  }
907
938
  return attribute;
908
939
  }
909
- function peg$f57(start, value, end) {
940
+ function peg$f62(start, value, end) {
910
941
  return {
911
942
  value,
912
943
  start,
@@ -914,7 +945,7 @@ function peg$parse(input, options) {
914
945
  quote: "\""
915
946
  };
916
947
  }
917
- function peg$f58(start, value, end) {
948
+ function peg$f63(start, value, end) {
918
949
  return {
919
950
  value,
920
951
  start,
@@ -922,36 +953,36 @@ function peg$parse(input, options) {
922
953
  quote: "'"
923
954
  };
924
955
  }
925
- function peg$f59(q) {
956
+ function peg$f64(q) {
926
957
  fail("Unclosed attribute value: the " + q + " here has no closing " + q, location(), "unclosed-attribute");
927
958
  }
928
- function peg$f60(start, value, end) {
959
+ function peg$f65(start, value, end) {
929
960
  return {
930
961
  value,
931
962
  start,
932
963
  end
933
964
  };
934
965
  }
935
- function peg$f61() {
966
+ function peg$f66() {
936
967
  return !attrCode;
937
968
  }
938
- function peg$f62(bs) {
969
+ function peg$f67(bs) {
939
970
  return bs.length % 2 === 1;
940
971
  }
941
- function peg$f63() {
972
+ function peg$f68() {
942
973
  return !attrCode;
943
974
  }
944
- function peg$f64(start, nameEnd) {
975
+ function peg$f69(start, nameEnd) {
945
976
  const end = hooks.closeBrace(input, nameEnd, start);
946
977
  return skipTo(end < 0 && completionMode ? input.length : end);
947
978
  }
948
- function peg$f65(start, nameEnd) {
979
+ function peg$f70(start, nameEnd) {
949
980
  return skipEnd - offset();
950
981
  }
951
- function peg$f66() {
982
+ function peg$f71() {
952
983
  return !attrCode;
953
984
  }
954
- function peg$f67() {
985
+ function peg$f72() {
955
986
  return attrCode;
956
987
  }
957
988
  let peg$currPos = options.peg$currPos | 0;
@@ -1087,15 +1118,66 @@ function peg$parse(input, options) {
1087
1118
  if (s0 === peg$FAILED) {
1088
1119
  s0 = peg$parseEscape();
1089
1120
  if (s0 === peg$FAILED) {
1090
- s0 = peg$parseComment();
1121
+ s0 = peg$currPos;
1122
+ peg$savedPos = peg$currPos;
1123
+ s1 = peg$f1();
1124
+ if (s1) s1 = void 0;
1125
+ else s1 = peg$FAILED;
1126
+ if (s1 !== peg$FAILED) {
1127
+ s2 = peg$parseComment();
1128
+ if (s2 !== peg$FAILED) {
1129
+ s1 = [s1, s2];
1130
+ s0 = s1;
1131
+ } else {
1132
+ peg$currPos = s0;
1133
+ s0 = peg$FAILED;
1134
+ }
1135
+ } else {
1136
+ peg$currPos = s0;
1137
+ s0 = peg$FAILED;
1138
+ }
1091
1139
  if (s0 === peg$FAILED) {
1092
- s0 = peg$parseLinkLexeme();
1140
+ s0 = peg$currPos;
1141
+ peg$savedPos = peg$currPos;
1142
+ s1 = peg$f2();
1143
+ if (s1) s1 = void 0;
1144
+ else s1 = peg$FAILED;
1145
+ if (s1 !== peg$FAILED) {
1146
+ s2 = peg$parseLinkLexeme();
1147
+ if (s2 !== peg$FAILED) {
1148
+ s1 = [s1, s2];
1149
+ s0 = s1;
1150
+ } else {
1151
+ peg$currPos = s0;
1152
+ s0 = peg$FAILED;
1153
+ }
1154
+ } else {
1155
+ peg$currPos = s0;
1156
+ s0 = peg$FAILED;
1157
+ }
1093
1158
  if (s0 === peg$FAILED) {
1094
- s0 = peg$parseEmailAutolink();
1159
+ s0 = peg$currPos;
1160
+ peg$savedPos = peg$currPos;
1161
+ s1 = peg$f3();
1162
+ if (s1) s1 = void 0;
1163
+ else s1 = peg$FAILED;
1164
+ if (s1 !== peg$FAILED) {
1165
+ s2 = peg$parseEmailAutolink();
1166
+ if (s2 !== peg$FAILED) {
1167
+ s1 = [s1, s2];
1168
+ s0 = s1;
1169
+ } else {
1170
+ peg$currPos = s0;
1171
+ s0 = peg$FAILED;
1172
+ }
1173
+ } else {
1174
+ peg$currPos = s0;
1175
+ s0 = peg$FAILED;
1176
+ }
1095
1177
  if (s0 === peg$FAILED) {
1096
1178
  s0 = peg$currPos;
1097
1179
  peg$savedPos = peg$currPos;
1098
- s1 = peg$f1();
1180
+ s1 = peg$f4();
1099
1181
  if (s1) s1 = void 0;
1100
1182
  else s1 = peg$FAILED;
1101
1183
  if (s1 !== peg$FAILED) {
@@ -1114,14 +1196,14 @@ function peg$parse(input, options) {
1114
1196
  if (s0 === peg$FAILED) {
1115
1197
  s0 = peg$currPos;
1116
1198
  peg$savedPos = peg$currPos;
1117
- s1 = peg$f2();
1199
+ s1 = peg$f5();
1118
1200
  if (s1) s1 = void 0;
1119
1201
  else s1 = peg$FAILED;
1120
1202
  if (s1 !== peg$FAILED) {
1121
1203
  s2 = peg$parseHtmlOpen();
1122
1204
  if (s2 !== peg$FAILED) {
1123
1205
  peg$savedPos = s0;
1124
- s0 = peg$f3(s2);
1206
+ s0 = peg$f6(s2);
1125
1207
  } else {
1126
1208
  peg$currPos = s0;
1127
1209
  s0 = peg$FAILED;
@@ -1133,14 +1215,23 @@ function peg$parse(input, options) {
1133
1215
  if (s0 === peg$FAILED) {
1134
1216
  s0 = peg$currPos;
1135
1217
  peg$savedPos = peg$currPos;
1136
- s1 = peg$f4();
1218
+ s1 = peg$f7();
1137
1219
  if (s1) s1 = void 0;
1138
1220
  else s1 = peg$FAILED;
1139
1221
  if (s1 !== peg$FAILED) {
1140
1222
  s2 = peg$parseHtmlClose();
1141
1223
  if (s2 !== peg$FAILED) {
1142
- peg$savedPos = s0;
1143
- s0 = peg$f5(s2);
1224
+ peg$savedPos = peg$currPos;
1225
+ s3 = peg$f8(s2);
1226
+ if (s3) s3 = void 0;
1227
+ else s3 = peg$FAILED;
1228
+ if (s3 !== peg$FAILED) {
1229
+ peg$savedPos = s0;
1230
+ s0 = peg$f9(s2);
1231
+ } else {
1232
+ peg$currPos = s0;
1233
+ s0 = peg$FAILED;
1234
+ }
1144
1235
  } else {
1145
1236
  peg$currPos = s0;
1146
1237
  s0 = peg$FAILED;
@@ -1157,14 +1248,14 @@ function peg$parse(input, options) {
1157
1248
  if (s1 !== peg$FAILED) {
1158
1249
  s2 = peg$currPos;
1159
1250
  peg$savedPos = peg$currPos;
1160
- s3 = peg$f6(s1);
1251
+ s3 = peg$f10(s1);
1161
1252
  if (s3) s3 = void 0;
1162
1253
  else s3 = peg$FAILED;
1163
1254
  if (s3 !== peg$FAILED) {
1164
1255
  s4 = peg$parseRawTokens();
1165
1256
  if (s4 !== peg$FAILED) {
1166
1257
  peg$savedPos = s2;
1167
- s2 = peg$f7(s1, s4);
1258
+ s2 = peg$f11(s1, s4);
1168
1259
  } else {
1169
1260
  peg$currPos = s2;
1170
1261
  s2 = peg$FAILED;
@@ -1175,7 +1266,7 @@ function peg$parse(input, options) {
1175
1266
  }
1176
1267
  if (s2 === peg$FAILED) s2 = null;
1177
1268
  peg$savedPos = s0;
1178
- s0 = peg$f8(s1, s2);
1269
+ s0 = peg$f12(s1, s2);
1179
1270
  } else {
1180
1271
  peg$currPos = s0;
1181
1272
  s0 = peg$FAILED;
@@ -1198,12 +1289,12 @@ function peg$parse(input, options) {
1198
1289
  s1 = peg$parseMacroTag();
1199
1290
  if (s1 !== peg$FAILED) {
1200
1291
  peg$savedPos = peg$currPos;
1201
- s2 = peg$f9(s1);
1292
+ s2 = peg$f13(s1);
1202
1293
  if (s2) s2 = void 0;
1203
1294
  else s2 = peg$FAILED;
1204
1295
  if (s2 !== peg$FAILED) {
1205
1296
  peg$savedPos = s0;
1206
- s0 = peg$f10(s1);
1297
+ s0 = peg$f14(s1);
1207
1298
  } else {
1208
1299
  peg$currPos = s0;
1209
1300
  s0 = peg$FAILED;
@@ -1215,14 +1306,14 @@ function peg$parse(input, options) {
1215
1306
  if (s0 === peg$FAILED) {
1216
1307
  s0 = peg$currPos;
1217
1308
  peg$savedPos = peg$currPos;
1218
- s1 = peg$f11();
1309
+ s1 = peg$f15();
1219
1310
  if (s1) s1 = void 0;
1220
1311
  else s1 = peg$FAILED;
1221
1312
  if (s1 !== peg$FAILED) {
1222
1313
  s2 = peg$parseHtmlClose();
1223
1314
  if (s2 !== peg$FAILED) {
1224
1315
  peg$savedPos = s0;
1225
- s0 = peg$f12(s2);
1316
+ s0 = peg$f16(s2);
1226
1317
  } else {
1227
1318
  peg$currPos = s0;
1228
1319
  s0 = peg$FAILED;
@@ -1239,12 +1330,12 @@ function peg$parse(input, options) {
1239
1330
  s0 = peg$currPos;
1240
1331
  s1 = peg$parseHere();
1241
1332
  peg$savedPos = peg$currPos;
1242
- s2 = peg$f13(s1);
1333
+ s2 = peg$f17(s1);
1243
1334
  if (s2) s2 = void 0;
1244
1335
  else s2 = peg$FAILED;
1245
1336
  if (s2 !== peg$FAILED) {
1246
1337
  s3 = peg$currPos;
1247
- s4 = peg$f14(s1);
1338
+ s4 = peg$f18(s1);
1248
1339
  s5 = peg$currPos;
1249
1340
  s6 = [];
1250
1341
  if (s6.length >= (s4 | 0)) s7 = peg$FAILED;
@@ -1277,7 +1368,7 @@ function peg$parse(input, options) {
1277
1368
  s4 = peg$parseCloseTag();
1278
1369
  if (s4 !== peg$FAILED) {
1279
1370
  peg$savedPos = s0;
1280
- s0 = peg$f15(s1, s3, s4);
1371
+ s0 = peg$f19(s1, s3, s4);
1281
1372
  } else {
1282
1373
  peg$currPos = s0;
1283
1374
  s0 = peg$FAILED;
@@ -1293,7 +1384,7 @@ function peg$parse(input, options) {
1293
1384
  if (s0 === peg$FAILED) {
1294
1385
  s0 = peg$currPos;
1295
1386
  peg$savedPos = peg$currPos;
1296
- s1 = peg$f16();
1387
+ s1 = peg$f20();
1297
1388
  if (s1) s1 = void 0;
1298
1389
  else s1 = peg$FAILED;
1299
1390
  if (s1 !== peg$FAILED) {
@@ -1318,7 +1409,7 @@ function peg$parse(input, options) {
1318
1409
  }
1319
1410
  s2 = input.substring(s2, peg$currPos);
1320
1411
  peg$savedPos = s0;
1321
- s0 = peg$f17(s2);
1412
+ s0 = peg$f21(s2);
1322
1413
  } else {
1323
1414
  peg$currPos = s0;
1324
1415
  s0 = peg$FAILED;
@@ -1331,7 +1422,7 @@ function peg$parse(input, options) {
1331
1422
  s0 = peg$currPos;
1332
1423
  s1 = "";
1333
1424
  peg$savedPos = s0;
1334
- s1 = peg$f18();
1425
+ s1 = peg$f22();
1335
1426
  s0 = s1;
1336
1427
  return s0;
1337
1428
  }
@@ -1360,13 +1451,13 @@ function peg$parse(input, options) {
1360
1451
  else s1 = s2;
1361
1452
  if (s1 !== peg$FAILED) {
1362
1453
  peg$savedPos = s0;
1363
- s1 = peg$f19(s1);
1454
+ s1 = peg$f23(s1);
1364
1455
  }
1365
1456
  s0 = s1;
1366
1457
  return s0;
1367
1458
  }
1368
1459
  function peg$parseComment() {
1369
- let s0, s1, s2, s3, s4, s5, s6, s7, s8;
1460
+ let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
1370
1461
  s0 = peg$currPos;
1371
1462
  s1 = peg$currPos;
1372
1463
  s2 = peg$currPos;
@@ -1395,91 +1486,104 @@ function peg$parse(input, options) {
1395
1486
  }
1396
1487
  if (s4 === peg$FAILED) {
1397
1488
  s4 = peg$currPos;
1398
- s5 = [];
1399
- s6 = peg$currPos;
1400
- s7 = peg$currPos;
1401
- peg$silentFails++;
1402
- if (input.substr(peg$currPos, 3) === peg$c3) {
1403
- s8 = peg$c3;
1404
- peg$currPos += 3;
1405
- } else {
1406
- s8 = peg$FAILED;
1407
- if (peg$silentFails === 0) peg$fail(peg$e5);
1408
- }
1409
- peg$silentFails--;
1410
- if (s8 === peg$FAILED) s7 = void 0;
1411
- else {
1412
- peg$currPos = s7;
1413
- s7 = peg$FAILED;
1414
- }
1415
- if (s7 !== peg$FAILED) {
1416
- if (input.length > peg$currPos) {
1417
- s8 = input.charAt(peg$currPos);
1418
- peg$currPos++;
1419
- } else {
1420
- s8 = peg$FAILED;
1421
- if (peg$silentFails === 0) peg$fail(peg$e0);
1422
- }
1423
- if (s8 !== peg$FAILED) {
1424
- s7 = [s7, s8];
1425
- s6 = s7;
1426
- } else {
1427
- peg$currPos = s6;
1428
- s6 = peg$FAILED;
1429
- }
1430
- } else {
1431
- peg$currPos = s6;
1432
- s6 = peg$FAILED;
1433
- }
1434
- while (s6 !== peg$FAILED) {
1435
- s5.push(s6);
1436
- s6 = peg$currPos;
1489
+ peg$savedPos = peg$currPos;
1490
+ s5 = peg$f24();
1491
+ if (s5) s5 = void 0;
1492
+ else s5 = peg$FAILED;
1493
+ if (s5 !== peg$FAILED) {
1494
+ s6 = [];
1437
1495
  s7 = peg$currPos;
1496
+ s8 = peg$currPos;
1438
1497
  peg$silentFails++;
1439
1498
  if (input.substr(peg$currPos, 3) === peg$c3) {
1440
- s8 = peg$c3;
1499
+ s9 = peg$c3;
1441
1500
  peg$currPos += 3;
1442
1501
  } else {
1443
- s8 = peg$FAILED;
1502
+ s9 = peg$FAILED;
1444
1503
  if (peg$silentFails === 0) peg$fail(peg$e5);
1445
1504
  }
1446
1505
  peg$silentFails--;
1447
- if (s8 === peg$FAILED) s7 = void 0;
1506
+ if (s9 === peg$FAILED) s8 = void 0;
1448
1507
  else {
1449
- peg$currPos = s7;
1450
- s7 = peg$FAILED;
1508
+ peg$currPos = s8;
1509
+ s8 = peg$FAILED;
1451
1510
  }
1452
- if (s7 !== peg$FAILED) {
1511
+ if (s8 !== peg$FAILED) {
1453
1512
  if (input.length > peg$currPos) {
1454
- s8 = input.charAt(peg$currPos);
1513
+ s9 = input.charAt(peg$currPos);
1455
1514
  peg$currPos++;
1456
1515
  } else {
1457
- s8 = peg$FAILED;
1516
+ s9 = peg$FAILED;
1458
1517
  if (peg$silentFails === 0) peg$fail(peg$e0);
1459
1518
  }
1519
+ if (s9 !== peg$FAILED) {
1520
+ s8 = [s8, s9];
1521
+ s7 = s8;
1522
+ } else {
1523
+ peg$currPos = s7;
1524
+ s7 = peg$FAILED;
1525
+ }
1526
+ } else {
1527
+ peg$currPos = s7;
1528
+ s7 = peg$FAILED;
1529
+ }
1530
+ while (s7 !== peg$FAILED) {
1531
+ s6.push(s7);
1532
+ s7 = peg$currPos;
1533
+ s8 = peg$currPos;
1534
+ peg$silentFails++;
1535
+ if (input.substr(peg$currPos, 3) === peg$c3) {
1536
+ s9 = peg$c3;
1537
+ peg$currPos += 3;
1538
+ } else {
1539
+ s9 = peg$FAILED;
1540
+ if (peg$silentFails === 0) peg$fail(peg$e5);
1541
+ }
1542
+ peg$silentFails--;
1543
+ if (s9 === peg$FAILED) s8 = void 0;
1544
+ else {
1545
+ peg$currPos = s8;
1546
+ s8 = peg$FAILED;
1547
+ }
1460
1548
  if (s8 !== peg$FAILED) {
1461
- s7 = [s7, s8];
1462
- s6 = s7;
1549
+ if (input.length > peg$currPos) {
1550
+ s9 = input.charAt(peg$currPos);
1551
+ peg$currPos++;
1552
+ } else {
1553
+ s9 = peg$FAILED;
1554
+ if (peg$silentFails === 0) peg$fail(peg$e0);
1555
+ }
1556
+ if (s9 !== peg$FAILED) {
1557
+ s8 = [s8, s9];
1558
+ s7 = s8;
1559
+ } else {
1560
+ peg$currPos = s7;
1561
+ s7 = peg$FAILED;
1562
+ }
1463
1563
  } else {
1464
- peg$currPos = s6;
1465
- s6 = peg$FAILED;
1564
+ peg$currPos = s7;
1565
+ s7 = peg$FAILED;
1466
1566
  }
1567
+ }
1568
+ if (input.substr(peg$currPos, 3) === peg$c3) {
1569
+ s7 = peg$c3;
1570
+ peg$currPos += 3;
1467
1571
  } else {
1468
- peg$currPos = s6;
1469
- s6 = peg$FAILED;
1572
+ s7 = peg$FAILED;
1573
+ if (peg$silentFails === 0) peg$fail(peg$e5);
1574
+ }
1575
+ if (s7 === peg$FAILED) s7 = peg$parseOpenEnd();
1576
+ if (s7 !== peg$FAILED) {
1577
+ s5 = [
1578
+ s5,
1579
+ s6,
1580
+ s7
1581
+ ];
1582
+ s4 = s5;
1583
+ } else {
1584
+ peg$currPos = s4;
1585
+ s4 = peg$FAILED;
1470
1586
  }
1471
- }
1472
- if (input.substr(peg$currPos, 3) === peg$c3) {
1473
- s6 = peg$c3;
1474
- peg$currPos += 3;
1475
- } else {
1476
- s6 = peg$FAILED;
1477
- if (peg$silentFails === 0) peg$fail(peg$e5);
1478
- }
1479
- if (s6 === peg$FAILED) s6 = peg$parseOpenEnd();
1480
- if (s6 !== peg$FAILED) {
1481
- s5 = [s5, s6];
1482
- s4 = s5;
1483
1587
  } else {
1484
1588
  peg$currPos = s4;
1485
1589
  s4 = peg$FAILED;
@@ -1501,7 +1605,7 @@ function peg$parse(input, options) {
1501
1605
  else s1 = s2;
1502
1606
  if (s1 !== peg$FAILED) {
1503
1607
  peg$savedPos = s0;
1504
- s1 = peg$f20(s1);
1608
+ s1 = peg$f25(s1);
1505
1609
  }
1506
1610
  s0 = s1;
1507
1611
  return s0;
@@ -1534,7 +1638,7 @@ function peg$parse(input, options) {
1534
1638
  if (s1 !== peg$FAILED) {
1535
1639
  s2 = peg$currPos;
1536
1640
  peg$savedPos = peg$currPos;
1537
- s3 = peg$f21(s1);
1641
+ s3 = peg$f26(s1);
1538
1642
  if (s3) s3 = void 0;
1539
1643
  else s3 = peg$FAILED;
1540
1644
  if (s3 !== peg$FAILED) {
@@ -1546,7 +1650,7 @@ function peg$parse(input, options) {
1546
1650
  }
1547
1651
  if (s4 !== peg$FAILED) {
1548
1652
  peg$savedPos = s2;
1549
- s2 = peg$f22(s1, s4);
1653
+ s2 = peg$f27(s1, s4);
1550
1654
  } else {
1551
1655
  peg$currPos = s2;
1552
1656
  s2 = peg$FAILED;
@@ -1557,7 +1661,7 @@ function peg$parse(input, options) {
1557
1661
  }
1558
1662
  if (s2 === peg$FAILED) s2 = null;
1559
1663
  peg$savedPos = s0;
1560
- s0 = peg$f23(s1, s2);
1664
+ s0 = peg$f28(s1, s2);
1561
1665
  } else {
1562
1666
  peg$currPos = s0;
1563
1667
  s0 = peg$FAILED;
@@ -1605,7 +1709,7 @@ function peg$parse(input, options) {
1605
1709
  }
1606
1710
  if (s2 !== peg$FAILED) {
1607
1711
  peg$savedPos = s0;
1608
- s0 = peg$f24();
1712
+ s0 = peg$f29();
1609
1713
  } else {
1610
1714
  peg$currPos = s0;
1611
1715
  s0 = peg$FAILED;
@@ -1620,7 +1724,7 @@ function peg$parse(input, options) {
1620
1724
  peg$silentFails++;
1621
1725
  s2 = peg$currPos;
1622
1726
  peg$savedPos = peg$currPos;
1623
- s3 = peg$f25();
1727
+ s3 = peg$f30();
1624
1728
  if (s3) s3 = void 0;
1625
1729
  else s3 = peg$FAILED;
1626
1730
  if (s3 !== peg$FAILED) {
@@ -1652,7 +1756,7 @@ function peg$parse(input, options) {
1652
1756
  }
1653
1757
  if (s2 !== peg$FAILED) {
1654
1758
  peg$savedPos = s0;
1655
- s0 = peg$f26();
1759
+ s0 = peg$f31();
1656
1760
  } else {
1657
1761
  peg$currPos = s0;
1658
1762
  s0 = peg$FAILED;
@@ -1672,7 +1776,7 @@ function peg$parse(input, options) {
1672
1776
  }
1673
1777
  if (s1 !== peg$FAILED) {
1674
1778
  peg$savedPos = s0;
1675
- s1 = peg$f27();
1779
+ s1 = peg$f32();
1676
1780
  }
1677
1781
  s0 = s1;
1678
1782
  }
@@ -1683,7 +1787,7 @@ function peg$parse(input, options) {
1683
1787
  let s0, s1, s2, s3, s4, s5, s6, s7;
1684
1788
  s0 = peg$currPos;
1685
1789
  peg$savedPos = peg$currPos;
1686
- s1 = peg$f28();
1790
+ s1 = peg$f33();
1687
1791
  if (s1) s1 = void 0;
1688
1792
  else s1 = peg$FAILED;
1689
1793
  if (s1 !== peg$FAILED) {
@@ -1712,7 +1816,7 @@ function peg$parse(input, options) {
1712
1816
  if (s7 === peg$FAILED) s7 = peg$parseOpenEnd();
1713
1817
  if (s7 !== peg$FAILED) {
1714
1818
  peg$savedPos = s0;
1715
- s0 = peg$f29(s3, s4, s5, s6);
1819
+ s0 = peg$f34(s3, s4, s5, s6);
1716
1820
  } else {
1717
1821
  peg$currPos = s0;
1718
1822
  s0 = peg$FAILED;
@@ -1732,7 +1836,7 @@ function peg$parse(input, options) {
1732
1836
  if (s0 === peg$FAILED) {
1733
1837
  s0 = peg$currPos;
1734
1838
  peg$savedPos = peg$currPos;
1735
- s1 = peg$f30();
1839
+ s1 = peg$f35();
1736
1840
  if (s1) s1 = void 0;
1737
1841
  else s1 = peg$FAILED;
1738
1842
  if (s1 !== peg$FAILED) {
@@ -1745,7 +1849,7 @@ function peg$parse(input, options) {
1745
1849
  }
1746
1850
  if (s2 !== peg$FAILED) {
1747
1851
  peg$savedPos = s0;
1748
- s0 = peg$f31();
1852
+ s0 = peg$f36();
1749
1853
  } else {
1750
1854
  peg$currPos = s0;
1751
1855
  s0 = peg$FAILED;
@@ -1873,7 +1977,7 @@ function peg$parse(input, options) {
1873
1977
  }
1874
1978
  if (s2 === peg$FAILED) s2 = null;
1875
1979
  peg$savedPos = s0;
1876
- s0 = peg$f32(s1);
1980
+ s0 = peg$f37(s1);
1877
1981
  } else {
1878
1982
  peg$currPos = s0;
1879
1983
  s0 = peg$FAILED;
@@ -1882,7 +1986,7 @@ function peg$parse(input, options) {
1882
1986
  s0 = peg$currPos;
1883
1987
  s1 = "";
1884
1988
  peg$savedPos = s0;
1885
- s1 = peg$f33();
1989
+ s1 = peg$f38();
1886
1990
  s0 = s1;
1887
1991
  }
1888
1992
  return s0;
@@ -1912,7 +2016,7 @@ function peg$parse(input, options) {
1912
2016
  }
1913
2017
  }
1914
2018
  peg$savedPos = s0;
1915
- s0 = peg$f34(s1, s2);
2019
+ s0 = peg$f39(s1, s2);
1916
2020
  } else {
1917
2021
  peg$currPos = s0;
1918
2022
  s0 = peg$FAILED;
@@ -1938,7 +2042,7 @@ function peg$parse(input, options) {
1938
2042
  }
1939
2043
  s2 = input.substring(s2, peg$currPos);
1940
2044
  peg$savedPos = s0;
1941
- s0 = peg$f35(s1, s2);
2045
+ s0 = peg$f40(s1, s2);
1942
2046
  } else {
1943
2047
  peg$currPos = s0;
1944
2048
  s0 = peg$FAILED;
@@ -2059,7 +2163,7 @@ function peg$parse(input, options) {
2059
2163
  s7 = peg$parseBraceEnd();
2060
2164
  if (s7 !== peg$FAILED) {
2061
2165
  peg$savedPos = s0;
2062
- s0 = peg$f36(s2, s3, s4, s5, s6);
2166
+ s0 = peg$f41(s2, s3, s4, s5, s6);
2063
2167
  } else {
2064
2168
  peg$currPos = s0;
2065
2169
  s0 = peg$FAILED;
@@ -2109,7 +2213,7 @@ function peg$parse(input, options) {
2109
2213
  s7 = peg$parseBraceEnd();
2110
2214
  if (s7 !== peg$FAILED) {
2111
2215
  peg$savedPos = s0;
2112
- s0 = peg$f37(s2, s3, s4, s6);
2216
+ s0 = peg$f42(s2, s3, s4, s6);
2113
2217
  } else {
2114
2218
  peg$currPos = s0;
2115
2219
  s0 = peg$FAILED;
@@ -2157,7 +2261,7 @@ function peg$parse(input, options) {
2157
2261
  } else s3 = peg$FAILED;
2158
2262
  if (s3 !== peg$FAILED) {
2159
2263
  peg$savedPos = s0;
2160
- s0 = peg$f38();
2264
+ s0 = peg$f43();
2161
2265
  } else {
2162
2266
  peg$currPos = s0;
2163
2267
  s0 = peg$FAILED;
@@ -2179,12 +2283,12 @@ function peg$parse(input, options) {
2179
2283
  s0 = peg$currPos;
2180
2284
  s1 = peg$parseHere();
2181
2285
  peg$savedPos = peg$currPos;
2182
- s2 = peg$f39(s1);
2286
+ s2 = peg$f44(s1);
2183
2287
  if (s2) s2 = void 0;
2184
2288
  else s2 = peg$FAILED;
2185
2289
  if (s2 !== peg$FAILED) {
2186
2290
  s3 = peg$currPos;
2187
- s4 = peg$f40(s1);
2291
+ s4 = peg$f45(s1);
2188
2292
  s5 = peg$currPos;
2189
2293
  s6 = [];
2190
2294
  if (s6.length >= (s4 | 0)) s7 = peg$FAILED;
@@ -2215,7 +2319,7 @@ function peg$parse(input, options) {
2215
2319
  else s3 = s4;
2216
2320
  if (s3 !== peg$FAILED) {
2217
2321
  peg$savedPos = s0;
2218
- s0 = peg$f41(s1, s3);
2322
+ s0 = peg$f46(s1, s3);
2219
2323
  } else {
2220
2324
  peg$currPos = s0;
2221
2325
  s0 = peg$FAILED;
@@ -2230,7 +2334,7 @@ function peg$parse(input, options) {
2230
2334
  let s0, s1, s2, s3;
2231
2335
  s0 = peg$currPos;
2232
2336
  peg$savedPos = peg$currPos;
2233
- s1 = peg$f42();
2337
+ s1 = peg$f47();
2234
2338
  if (s1) s1 = void 0;
2235
2339
  else s1 = peg$FAILED;
2236
2340
  if (s1 !== peg$FAILED) {
@@ -2302,12 +2406,12 @@ function peg$parse(input, options) {
2302
2406
  s7 = peg$parseHere();
2303
2407
  s8 = peg$currPos;
2304
2408
  peg$savedPos = peg$currPos;
2305
- s9 = peg$f43(s2, s3, s4, s5, s6, s7);
2409
+ s9 = peg$f48(s2, s3, s4, s5, s6, s7);
2306
2410
  if (s9) s9 = void 0;
2307
2411
  else s9 = peg$FAILED;
2308
2412
  if (s9 !== peg$FAILED) {
2309
2413
  s10 = peg$currPos;
2310
- s11 = peg$f44(s2, s3, s4, s5, s6, s7);
2414
+ s11 = peg$f49(s2, s3, s4, s5, s6, s7);
2311
2415
  s12 = peg$currPos;
2312
2416
  s13 = [];
2313
2417
  if (s13.length >= (s11 | 0)) s14 = peg$FAILED;
@@ -2340,7 +2444,7 @@ function peg$parse(input, options) {
2340
2444
  s11 = peg$parseBraceEnd();
2341
2445
  if (s11 !== peg$FAILED) {
2342
2446
  peg$savedPos = s8;
2343
- s8 = peg$f45(s2, s3, s4, s5, s6, s7, s10);
2447
+ s8 = peg$f50(s2, s3, s4, s5, s6, s7, s10);
2344
2448
  } else {
2345
2449
  peg$currPos = s8;
2346
2450
  s8 = peg$FAILED;
@@ -2355,7 +2459,7 @@ function peg$parse(input, options) {
2355
2459
  }
2356
2460
  if (s8 === peg$FAILED) s8 = null;
2357
2461
  peg$savedPos = s0;
2358
- s0 = peg$f46(s2, s3, s4, s5, s6, s7, s8);
2462
+ s0 = peg$f51(s2, s3, s4, s5, s6, s7, s8);
2359
2463
  } else {
2360
2464
  peg$currPos = s0;
2361
2465
  s0 = peg$FAILED;
@@ -2389,7 +2493,7 @@ function peg$parse(input, options) {
2389
2493
  }
2390
2494
  if (s3 !== peg$FAILED) {
2391
2495
  peg$savedPos = s0;
2392
- s0 = peg$f47(s2);
2496
+ s0 = peg$f52(s2);
2393
2497
  } else {
2394
2498
  peg$currPos = s0;
2395
2499
  s0 = peg$FAILED;
@@ -2539,12 +2643,12 @@ function peg$parse(input, options) {
2539
2643
  else s1 = s2;
2540
2644
  if (s1 !== peg$FAILED) {
2541
2645
  peg$savedPos = peg$currPos;
2542
- s2 = peg$f48(s1);
2646
+ s2 = peg$f53(s1);
2543
2647
  if (s2) s2 = void 0;
2544
2648
  else s2 = peg$FAILED;
2545
2649
  if (s2 !== peg$FAILED) {
2546
2650
  peg$savedPos = s0;
2547
- s0 = peg$f49(s1);
2651
+ s0 = peg$f54(s1);
2548
2652
  } else {
2549
2653
  peg$currPos = s0;
2550
2654
  s0 = peg$FAILED;
@@ -2721,7 +2825,7 @@ function peg$parse(input, options) {
2721
2825
  else s1 = s2;
2722
2826
  if (s1 !== peg$FAILED) {
2723
2827
  peg$savedPos = s0;
2724
- s1 = peg$f50(s1);
2828
+ s1 = peg$f55(s1);
2725
2829
  }
2726
2830
  s0 = s1;
2727
2831
  return s0;
@@ -2765,7 +2869,7 @@ function peg$parse(input, options) {
2765
2869
  if (s7 === peg$FAILED) s7 = peg$parseOpenEnd();
2766
2870
  if (s7 !== peg$FAILED) {
2767
2871
  peg$savedPos = s0;
2768
- s0 = peg$f51(s2, s3, s4, s6);
2872
+ s0 = peg$f56(s2, s3, s4, s6);
2769
2873
  } else {
2770
2874
  peg$currPos = s0;
2771
2875
  s0 = peg$FAILED;
@@ -2830,7 +2934,7 @@ function peg$parse(input, options) {
2830
2934
  s5 = peg$parse_();
2831
2935
  s6 = peg$parseHere();
2832
2936
  peg$savedPos = s0;
2833
- s0 = peg$f52(s2, s6);
2937
+ s0 = peg$f57(s2, s6);
2834
2938
  } else {
2835
2939
  peg$currPos = s0;
2836
2940
  s0 = peg$FAILED;
@@ -2870,7 +2974,7 @@ function peg$parse(input, options) {
2870
2974
  }
2871
2975
  if (s5 !== peg$FAILED) {
2872
2976
  peg$savedPos = s0;
2873
- s0 = peg$f53(s2, s3);
2977
+ s0 = peg$f58(s2, s3);
2874
2978
  } else {
2875
2979
  peg$currPos = s0;
2876
2980
  s0 = peg$FAILED;
@@ -3005,7 +3109,7 @@ function peg$parse(input, options) {
3005
3109
  else s3 = s4;
3006
3110
  if (s3 !== peg$FAILED) {
3007
3111
  peg$savedPos = peg$currPos;
3008
- s4 = peg$f54(s2, s3);
3112
+ s4 = peg$f59(s2, s3);
3009
3113
  if (s4) s4 = void 0;
3010
3114
  else s4 = peg$FAILED;
3011
3115
  if (s4 !== peg$FAILED) {
@@ -3023,7 +3127,7 @@ function peg$parse(input, options) {
3023
3127
  s9 = peg$parseAttrValue();
3024
3128
  if (s9 !== peg$FAILED) {
3025
3129
  peg$savedPos = s5;
3026
- s5 = peg$f55(s2, s3, s9);
3130
+ s5 = peg$f60(s2, s3, s9);
3027
3131
  } else {
3028
3132
  peg$currPos = s5;
3029
3133
  s5 = peg$FAILED;
@@ -3034,7 +3138,7 @@ function peg$parse(input, options) {
3034
3138
  }
3035
3139
  if (s5 === peg$FAILED) s5 = null;
3036
3140
  peg$savedPos = s0;
3037
- s0 = peg$f56(s2, s3, s5);
3141
+ s0 = peg$f61(s2, s3, s5);
3038
3142
  } else {
3039
3143
  peg$currPos = s0;
3040
3144
  s0 = peg$FAILED;
@@ -3092,7 +3196,7 @@ function peg$parse(input, options) {
3092
3196
  if (s5 === peg$FAILED) s5 = peg$parseOpenEnd();
3093
3197
  if (s5 !== peg$FAILED) {
3094
3198
  peg$savedPos = s0;
3095
- s0 = peg$f57(s2, s3, s4);
3199
+ s0 = peg$f62(s2, s3, s4);
3096
3200
  } else {
3097
3201
  peg$currPos = s0;
3098
3202
  s0 = peg$FAILED;
@@ -3147,7 +3251,7 @@ function peg$parse(input, options) {
3147
3251
  if (s5 === peg$FAILED) s5 = peg$parseOpenEnd();
3148
3252
  if (s5 !== peg$FAILED) {
3149
3253
  peg$savedPos = s0;
3150
- s0 = peg$f58(s2, s3, s4);
3254
+ s0 = peg$f63(s2, s3, s4);
3151
3255
  } else {
3152
3256
  peg$currPos = s0;
3153
3257
  s0 = peg$FAILED;
@@ -3166,7 +3270,7 @@ function peg$parse(input, options) {
3166
3270
  }
3167
3271
  if (s1 !== peg$FAILED) {
3168
3272
  peg$savedPos = s0;
3169
- s1 = peg$f59(s1);
3273
+ s1 = peg$f64(s1);
3170
3274
  }
3171
3275
  s0 = s1;
3172
3276
  if (s0 === peg$FAILED) {
@@ -3192,7 +3296,7 @@ function peg$parse(input, options) {
3192
3296
  s2 = input.substring(s2, peg$currPos);
3193
3297
  s3 = peg$parseHere();
3194
3298
  peg$savedPos = s0;
3195
- s0 = peg$f60(s1, s2, s3);
3299
+ s0 = peg$f65(s1, s2, s3);
3196
3300
  }
3197
3301
  }
3198
3302
  }
@@ -3202,7 +3306,7 @@ function peg$parse(input, options) {
3202
3306
  let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
3203
3307
  s0 = peg$currPos;
3204
3308
  peg$savedPos = peg$currPos;
3205
- s1 = peg$f61();
3309
+ s1 = peg$f66();
3206
3310
  if (s1) s1 = void 0;
3207
3311
  else s1 = peg$FAILED;
3208
3312
  if (s1 !== peg$FAILED) {
@@ -3231,7 +3335,7 @@ function peg$parse(input, options) {
3231
3335
  if (s2 !== peg$FAILED) {
3232
3336
  s3 = peg$currPos;
3233
3337
  peg$savedPos = peg$currPos;
3234
- s4 = peg$f62(s2);
3338
+ s4 = peg$f67(s2);
3235
3339
  if (s4) s4 = void 0;
3236
3340
  else s4 = peg$FAILED;
3237
3341
  if (s4 !== peg$FAILED) {
@@ -3270,7 +3374,7 @@ function peg$parse(input, options) {
3270
3374
  if (s0 === peg$FAILED) {
3271
3375
  s0 = peg$currPos;
3272
3376
  peg$savedPos = peg$currPos;
3273
- s1 = peg$f63();
3377
+ s1 = peg$f68();
3274
3378
  if (s1) s1 = void 0;
3275
3379
  else s1 = peg$FAILED;
3276
3380
  if (s1 !== peg$FAILED) {
@@ -3297,12 +3401,12 @@ function peg$parse(input, options) {
3297
3401
  if (s6 !== peg$FAILED) {
3298
3402
  s7 = peg$parseHere();
3299
3403
  peg$savedPos = peg$currPos;
3300
- s8 = peg$f64(s4, s7);
3404
+ s8 = peg$f69(s4, s7);
3301
3405
  if (s8) s8 = void 0;
3302
3406
  else s8 = peg$FAILED;
3303
3407
  if (s8 !== peg$FAILED) {
3304
3408
  s9 = peg$currPos;
3305
- s10 = peg$f65(s4, s7);
3409
+ s10 = peg$f70(s4, s7);
3306
3410
  s11 = peg$currPos;
3307
3411
  s12 = [];
3308
3412
  if (s12.length >= (s10 | 0)) s13 = peg$FAILED;
@@ -3378,7 +3482,7 @@ function peg$parse(input, options) {
3378
3482
  if (s0 === peg$FAILED) {
3379
3483
  s0 = peg$currPos;
3380
3484
  peg$savedPos = peg$currPos;
3381
- s1 = peg$f66();
3485
+ s1 = peg$f71();
3382
3486
  if (s1) s1 = void 0;
3383
3487
  else s1 = peg$FAILED;
3384
3488
  if (s1 !== peg$FAILED) {
@@ -3463,7 +3567,7 @@ function peg$parse(input, options) {
3463
3567
  if (s0 === peg$FAILED) {
3464
3568
  s0 = peg$currPos;
3465
3569
  peg$savedPos = peg$currPos;
3466
- s1 = peg$f67();
3570
+ s1 = peg$f72();
3467
3571
  if (s1) s1 = void 0;
3468
3572
  else s1 = peg$FAILED;
3469
3573
  if (s1 !== peg$FAILED) {
@@ -3549,12 +3653,15 @@ function peg$parse(input, options) {
3549
3653
  const textMode = options.text === true;
3550
3654
  const completionMode = options.completion === true;
3551
3655
  const hooks = options.hooks;
3656
+ const lastCommentClose = input.lastIndexOf("-->");
3552
3657
  /** End of the stretch a `.|n|` repetition consumes (see skipTo). */
3553
3658
  let skipEnd = -1;
3554
3659
  /** Whether the attribute whose value is being read holds code. */
3555
3660
  let attrCode = false;
3556
3661
  /** The macro whose raw body is being read. */
3557
3662
  let rawName = "";
3663
+ /** The HTML text-only body being read; its own closer ends this context. */
3664
+ let htmlTextTag = "";
3558
3665
  /**
3559
3666
  * The index in `inner` (at `at` in the input) of the first `separator` that
3560
3667
  * is not inside a {…} of the label: its code (`{if $a || $b}`, a string with
@@ -25069,6 +25176,149 @@ function markdownOptions(options) {
25069
25176
  htmlExtensions: [gfmTableHtml(), gfmStrikethroughHtml()]
25070
25177
  };
25071
25178
  }
25179
+ /** Share bounded tokenization with scans that need source token offsets. */
25180
+ function boundedMarkdownOptions(text, options) {
25181
+ const base = markdownOptions(options);
25182
+ return {
25183
+ ...base,
25184
+ extensions: [
25185
+ ...base.extensions ?? [],
25186
+ unclosedHtml(text),
25187
+ textData
25188
+ ]
25189
+ };
25190
+ }
25191
+ /** Join a data token just read to a data token right before it. */
25192
+ var joinData = (events) => {
25193
+ const at = events.length - 2;
25194
+ const before = events[at - 1];
25195
+ if (before && before[0] === "exit" && before[1].type === "data") {
25196
+ before[1].end = events[at][1].end;
25197
+ events.length = at;
25198
+ }
25199
+ return events;
25200
+ };
25201
+ /**
25202
+ * Text that no construct takes, read as data joined to the data before it.
25203
+ *
25204
+ * Where every text construct fails at a character (a `!` without `[`, a `]`
25205
+ * without a label, a `\` before a letter, an unclosed `<!--`), micromark
25206
+ * reads it, on to the next character a construct may start at, as a new data
25207
+ * token. Runs of data tokens are joined only after the paragraph is read,
25208
+ * each run by splicing the paragraph's whole list of events: time quadratic
25209
+ * in the number of runs where other tokens part them (`\]a!` repeated: an
25210
+ * escape, data `a`, data `!`), and erratically so, as the cost of moving
25211
+ * the list's elements depends on where the garbage collector keeps it.
25212
+ *
25213
+ * Tried where micromark's text tries constructs, after all of them (as a
25214
+ * construct of every character), this reads that data as micromark would
25215
+ * and joins it to the data before it at once, at the end of the list.
25216
+ */
25217
+ var textData = { text: { null: {
25218
+ name: "textData",
25219
+ tokenize(effects, ok) {
25220
+ const self = this;
25221
+ const constructs = this.parser.constructs.text;
25222
+ /** Whether a construct may start at `code`, as micromark's text asks. */
25223
+ function atBreak(code) {
25224
+ if (code === null) return true;
25225
+ const list = constructs[code] ?? [];
25226
+ return (Array.isArray(list) ? list : [list]).some((item) => !item.previous || item.previous.call(self, self.previous));
25227
+ }
25228
+ function data(code) {
25229
+ if (atBreak(code)) {
25230
+ effects.exit("data");
25231
+ return ok(code);
25232
+ }
25233
+ effects.consume(code);
25234
+ return data;
25235
+ }
25236
+ return (code) => {
25237
+ effects.enter("data");
25238
+ effects.consume(code);
25239
+ return data;
25240
+ };
25241
+ },
25242
+ resolveTo: joinData
25243
+ } } };
25244
+ /** Characters of an email autolink's local part (micromark's `asciiAtext`). */
25245
+ var ATEXT = /[#-'*+\--9=?A-Z^-~]/;
25246
+ var ALPHANUMERIC = /[0-9A-Za-z]/;
25247
+ var ALPHA = /[A-Za-z]/;
25248
+ /**
25249
+ * Inline raw HTML that can't be closed in `text`, read as the text it is.
25250
+ *
25251
+ * At a `<` opening a comment (`<!--`), a processing instruction (`<?`), a
25252
+ * CDATA section (`<![CDATA[`) or a declaration (`<!` and a letter), micromark
25253
+ * reads on for the closer (`-->`, `?>`, `]]>`, `>`) to the end of the
25254
+ * paragraph, and without one the `<` is text. Many such openers took time
25255
+ * quadratic in their number. Where no closer comes later in the whole text,
25256
+ * this construct, tried at each `<` before micromark's own, takes the `<`
25257
+ * as text at once, as micromark would end up doing.
25258
+ *
25259
+ * It is tried exactly where micromark tries raw HTML: not in code, link
25260
+ * destinations or HTML blocks (which start at a line start and run to their
25261
+ * end condition or the end of the document), whose output stays micromark's.
25262
+ * A `<?` may begin an email autolink (`<?a@b.c>`, tried before raw HTML),
25263
+ * which it then leaves to micromark.
25264
+ */
25265
+ function unclosedHtml(text) {
25266
+ const shift = text.charCodeAt(0) === 65279 ? 1 : 0;
25267
+ const comment = text.lastIndexOf("-->");
25268
+ const instruction = text.lastIndexOf("?>");
25269
+ const cdata = text.lastIndexOf("]]>");
25270
+ const declaration = text.lastIndexOf(">");
25271
+ /** Whether the raw HTML opening at `p` can't be closed. */
25272
+ function unclosed(p) {
25273
+ if (text[p] !== "<") return false;
25274
+ if (text.startsWith("<!--", p)) return comment < p + 2;
25275
+ if (text.startsWith("<![CDATA[", p)) return cdata < p + 9;
25276
+ if (text[p + 1] === "!" && ALPHA.test(text[p + 2] ?? "")) return declaration < p + 3;
25277
+ if (text[p + 1] === "?") return instruction < p + 2 && !emailAutolink(p);
25278
+ return false;
25279
+ }
25280
+ /** Whether an email autolink opens at `p`, as micromark reads one. */
25281
+ function emailAutolink(p) {
25282
+ let i = p + 1;
25283
+ while (ATEXT.test(text[i] ?? "")) i++;
25284
+ if (text[i] !== "@") return false;
25285
+ i++;
25286
+ let size = 0;
25287
+ let state = "atSignOrDot";
25288
+ for (;;) {
25289
+ const c = text[i] ?? "";
25290
+ if (state === "atSignOrDot") {
25291
+ if (!ALPHANUMERIC.test(c)) return false;
25292
+ state = "label";
25293
+ } else if (state === "label") {
25294
+ if (c === ">") return true;
25295
+ if (c === ".") {
25296
+ i++;
25297
+ size = 0;
25298
+ state = "atSignOrDot";
25299
+ } else state = "value";
25300
+ } else {
25301
+ if (!((c === "-" || ALPHANUMERIC.test(c)) && size++ < 63)) return false;
25302
+ i++;
25303
+ state = c === "-" ? "value" : "label";
25304
+ }
25305
+ }
25306
+ }
25307
+ return { text: { 60: {
25308
+ name: "unclosedHtml",
25309
+ resolveTo: joinData,
25310
+ tokenize(effects, ok, nok) {
25311
+ const at = this.now().offset + shift;
25312
+ return (code) => {
25313
+ if (code !== 60 || !unclosed(at)) return nok(code);
25314
+ effects.enter("data");
25315
+ effects.consume(code);
25316
+ effects.exit("data");
25317
+ return ok;
25318
+ };
25319
+ }
25320
+ } } };
25321
+ }
25072
25322
  // src/format/source-lines.ts
25073
25323
  /** Index a source once; locate zero-based lines without rescanning its prefixes. */
25074
25324
  function sourceLines(source) {
@@ -25098,7 +25348,7 @@ function markdownLines(source, isBlock, types) {
25098
25348
  for (const branch of node.body.branches) visit(branch.children);
25099
25349
  }
25100
25350
  }
25101
- const events = postprocess(parse(markdownOptions()).document().write(preprocess()(markdown, void 0, true)));
25351
+ const events = postprocess(parse(boundedMarkdownOptions(markdown)).document().write(preprocess()(markdown, void 0, true)));
25102
25352
  for (const [event, token] of events) {
25103
25353
  if (event !== "enter" || !types.has(token.type)) continue;
25104
25354
  let low = 0;