marked-katex-extension 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.umd.js +98 -90
  2. package/package.json +3 -3
package/lib/index.umd.js CHANGED
@@ -743,49 +743,49 @@
743
743
  * It's a storehouse of path geometry for SVG images.
744
744
  */
745
745
  // In all paths below, the viewBox-to-em scale is 1000:1.
746
- var hLinePad = 80; // padding above a sqrt viniculum. Prevents image cropping.
747
- // The viniculum of a \sqrt can be made thicker by a KaTeX rendering option.
748
- // Think of variable extraViniculum as two detours in the SVG path.
749
- // The detour begins at the lower left of the area labeled extraViniculum below.
750
- // The detour proceeds one extraViniculum distance up and slightly to the right,
751
- // displacing the radiused corner between surd and viniculum. The radius is
746
+ var hLinePad = 80; // padding above a sqrt vinculum. Prevents image cropping.
747
+ // The vinculum of a \sqrt can be made thicker by a KaTeX rendering option.
748
+ // Think of variable extraVinculum as two detours in the SVG path.
749
+ // The detour begins at the lower left of the area labeled extraVinculum below.
750
+ // The detour proceeds one extraVinculum distance up and slightly to the right,
751
+ // displacing the radiused corner between surd and vinculum. The radius is
752
752
  // traversed as usual, then the detour resumes. It goes right, to the end of
753
- // the very long viniculumn, then down one extraViniculum distance,
753
+ // the very long vinculum, then down one extraVinculum distance,
754
754
  // after which it resumes regular path geometry for the radical.
755
755
 
756
- /* viniculum
756
+ /* vinculum
757
757
  /
758
- /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraViniculum
759
- / █████████████████████←0.04em (40 unit) std viniculum thickness
758
+ /▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←extraVinculum
759
+ / █████████████████████←0.04em (40 unit) std vinculum thickness
760
760
  / /
761
761
  / /
762
762
  / /\
763
763
  / / surd
764
764
  */
765
765
 
766
- var sqrtMain = function sqrtMain(extraViniculum, hLinePad) {
766
+ var sqrtMain = function sqrtMain(extraVinculum, hLinePad) {
767
767
  // sqrtMain path geometry is from glyph U221A in the font KaTeX Main
768
- return "M95," + (622 + extraViniculum + hLinePad) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraViniculum / 2.075 + " -" + extraViniculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraViniculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
768
+ return "M95," + (622 + extraVinculum + hLinePad) + "\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl" + extraVinculum / 2.075 + " -" + extraVinculum + "\nc5.3,-9.3,12,-14,20,-14\nH400000v" + (40 + extraVinculum) + "H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM" + (834 + extraVinculum) + " " + hLinePad + "h400000v" + (40 + extraVinculum) + "h-400000z";
769
769
  };
770
770
 
771
- var sqrtSize1 = function sqrtSize1(extraViniculum, hLinePad) {
771
+ var sqrtSize1 = function sqrtSize1(extraVinculum, hLinePad) {
772
772
  // size1 is from glyph U221A in the font KaTeX_Size1-Regular
773
- return "M263," + (601 + extraViniculum + hLinePad) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraViniculum / 2.084 + " -" + extraViniculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraViniculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
773
+ return "M263," + (601 + extraVinculum + hLinePad) + "c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl" + extraVinculum / 2.084 + " -" + extraVinculum + "\nc4.7,-7.3,11,-11,19,-11\nH40000v" + (40 + extraVinculum) + "H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM" + (1001 + extraVinculum) + " " + hLinePad + "h400000v" + (40 + extraVinculum) + "h-400000z";
774
774
  };
775
775
 
776
- var sqrtSize2 = function sqrtSize2(extraViniculum, hLinePad) {
776
+ var sqrtSize2 = function sqrtSize2(extraVinculum, hLinePad) {
777
777
  // size2 is from glyph U221A in the font KaTeX_Size2-Regular
778
- return "M983 " + (10 + extraViniculum + hLinePad) + "\nl" + extraViniculum / 3.13 + " -" + extraViniculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraViniculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "h-400000z";
778
+ return "M983 " + (10 + extraVinculum + hLinePad) + "\nl" + extraVinculum / 3.13 + " -" + extraVinculum + "\nc4,-6.7,10,-10,18,-10 H400000v" + (40 + extraVinculum) + "\nH1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7\ns-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744\nc-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30\nc26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722\nc56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5\nc53.7,-170.3,84.5,-266.8,92.5,-289.5z\nM" + (1001 + extraVinculum) + " " + hLinePad + "h400000v" + (40 + extraVinculum) + "h-400000z";
779
779
  };
780
780
 
781
- var sqrtSize3 = function sqrtSize3(extraViniculum, hLinePad) {
781
+ var sqrtSize3 = function sqrtSize3(extraVinculum, hLinePad) {
782
782
  // size3 is from glyph U221A in the font KaTeX_Size3-Regular
783
- return "M424," + (2398 + extraViniculum + hLinePad) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraViniculum / 4.223 + " -" + extraViniculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraViniculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraViniculum) + " " + hLinePad + "\nh400000v" + (40 + extraViniculum) + "h-400000z";
783
+ return "M424," + (2398 + extraVinculum + hLinePad) + "\nc-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514\nc0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20\ns-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121\ns209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081\nl" + extraVinculum / 4.223 + " -" + extraVinculum + "c4,-6.7,10,-10,18,-10 H400000\nv" + (40 + extraVinculum) + "H1014.6\ns-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185\nc-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2z M" + (1001 + extraVinculum) + " " + hLinePad + "\nh400000v" + (40 + extraVinculum) + "h-400000z";
784
784
  };
785
785
 
786
- var sqrtSize4 = function sqrtSize4(extraViniculum, hLinePad) {
786
+ var sqrtSize4 = function sqrtSize4(extraVinculum, hLinePad) {
787
787
  // size4 is from glyph U221A in the font KaTeX_Size4-Regular
788
- return "M473," + (2713 + extraViniculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraViniculum / 5.298 + " -" + extraViniculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraViniculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraViniculum) + " " + hLinePad + "h400000v" + (40 + extraViniculum) + "H1017.7z";
788
+ return "M473," + (2713 + extraVinculum + hLinePad) + "\nc339.3,-1799.3,509.3,-2700,510,-2702 l" + extraVinculum / 5.298 + " -" + extraVinculum + "\nc3.3,-7.3,9.3,-11,18,-11 H400000v" + (40 + extraVinculum) + "H1017.7\ns-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9\nc-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200\nc0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26\ns76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,\n606zM" + (1001 + extraVinculum) + " " + hLinePad + "h400000v" + (40 + extraVinculum) + "H1017.7z";
789
789
  };
790
790
 
791
791
  var phasePath = function phasePath(y) {
@@ -794,43 +794,43 @@
794
794
  return "M400000 " + y + " H0 L" + x + " 0 l65 45 L145 " + (y - 80) + " H400000z";
795
795
  };
796
796
 
797
- var sqrtTall = function sqrtTall(extraViniculum, hLinePad, viewBoxHeight) {
797
+ var sqrtTall = function sqrtTall(extraVinculum, hLinePad, viewBoxHeight) {
798
798
  // sqrtTall is from glyph U23B7 in the font KaTeX_Size4-Regular
799
- // One path edge has a variable length. It runs vertically from the viniculumn
800
- // to a point near (14 units) the bottom of the surd. The viniculum
799
+ // One path edge has a variable length. It runs vertically from the vinculum
800
+ // to a point near (14 units) the bottom of the surd. The vinculum
801
801
  // is normally 40 units thick. So the length of the line in question is:
802
- var vertSegment = viewBoxHeight - 54 - hLinePad - extraViniculum;
803
- return "M702 " + (extraViniculum + hLinePad) + "H400000" + (40 + extraViniculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad + "H400000v" + (40 + extraViniculum) + "H742z";
802
+ var vertSegment = viewBoxHeight - 54 - hLinePad - extraVinculum;
803
+ return "M702 " + (extraVinculum + hLinePad) + "H400000" + (40 + extraVinculum) + "\nH742v" + vertSegment + "l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1\nh-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170\nc-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667\n219 661 l218 661zM702 " + hLinePad + "H400000v" + (40 + extraVinculum) + "H742z";
804
804
  };
805
805
 
806
- var sqrtPath = function sqrtPath(size, extraViniculum, viewBoxHeight) {
807
- extraViniculum = 1000 * extraViniculum; // Convert from document ems to viewBox.
806
+ var sqrtPath = function sqrtPath(size, extraVinculum, viewBoxHeight) {
807
+ extraVinculum = 1000 * extraVinculum; // Convert from document ems to viewBox.
808
808
 
809
809
  var path = "";
810
810
 
811
811
  switch (size) {
812
812
  case "sqrtMain":
813
- path = sqrtMain(extraViniculum, hLinePad);
813
+ path = sqrtMain(extraVinculum, hLinePad);
814
814
  break;
815
815
 
816
816
  case "sqrtSize1":
817
- path = sqrtSize1(extraViniculum, hLinePad);
817
+ path = sqrtSize1(extraVinculum, hLinePad);
818
818
  break;
819
819
 
820
820
  case "sqrtSize2":
821
- path = sqrtSize2(extraViniculum, hLinePad);
821
+ path = sqrtSize2(extraVinculum, hLinePad);
822
822
  break;
823
823
 
824
824
  case "sqrtSize3":
825
- path = sqrtSize3(extraViniculum, hLinePad);
825
+ path = sqrtSize3(extraVinculum, hLinePad);
826
826
  break;
827
827
 
828
828
  case "sqrtSize4":
829
- path = sqrtSize4(extraViniculum, hLinePad);
829
+ path = sqrtSize4(extraVinculum, hLinePad);
830
830
  break;
831
831
 
832
832
  case "sqrtTall":
833
- path = sqrtTall(extraViniculum, hLinePad, viewBoxHeight);
833
+ path = sqrtTall(extraVinculum, hLinePad, viewBoxHeight);
834
834
  }
835
835
 
836
836
  return path;
@@ -936,7 +936,7 @@
936
936
  widecheck4: "M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",
937
937
  // The next ten paths support reaction arrows from the mhchem package.
938
938
  // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX
939
- // baraboveleftarrow is mostly from from glyph U+2190 in font KaTeX Main
939
+ // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main
940
940
  baraboveleftarrow: "M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",
941
941
  // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main
942
942
  rightarrowabovebar: "M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",
@@ -3139,9 +3139,9 @@
3139
3139
  // In TeX, there are actually three sets of dimensions, one for each of
3140
3140
  // textstyle (size index 5 and higher: >=9pt), scriptstyle (size index 3 and 4:
3141
3141
  // 7-8pt), and scriptscriptstyle (size index 1 and 2: 5-6pt). These are
3142
- // provided in the the arrays below, in that order.
3142
+ // provided in the arrays below, in that order.
3143
3143
  //
3144
- // The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respsectively.
3144
+ // The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5 respectively.
3145
3145
  // This was determined by running the following script:
3146
3146
  //
3147
3147
  // latex -interaction=nonstopmode \
@@ -3151,7 +3151,7 @@
3151
3151
  // '\expandafter\show\the\scriptscriptfont2' \
3152
3152
  // '\stop'
3153
3153
  //
3154
- // The metrics themselves were retreived using the following commands:
3154
+ // The metrics themselves were retrieved using the following commands:
3155
3155
  //
3156
3156
  // tftopl cmsy10
3157
3157
  // tftopl cmsy7
@@ -3358,7 +3358,7 @@
3358
3358
  // So if the character is in a script we support but we
3359
3359
  // don't have metrics for it, just use the metrics for
3360
3360
  // the Latin capital letter M. This is close enough because
3361
- // we (currently) only care about the height of the glpyh
3361
+ // we (currently) only care about the height of the glyph
3362
3362
  // not its width.
3363
3363
  if (supportedCodepoint(ch)) {
3364
3364
  metrics = fontMetricsData[font][77]; // 77 is the charcode for 'M'
@@ -6569,7 +6569,7 @@
6569
6569
  * since we're mainly using MathML to improve accessibility, we don't manage
6570
6570
  * any of the styling state that the plain DOM nodes do.
6571
6571
  *
6572
- * The `toNode` and `toMarkup` functions work simlarly to how they do in
6572
+ * The `toNode` and `toMarkup` functions work similarly to how they do in
6573
6573
  * domTree.js, creating namespaced DOM nodes and HTML text markup respectively.
6574
6574
  */
6575
6575
  function newDocumentFragment(children) {
@@ -6700,7 +6700,7 @@
6700
6700
  }
6701
6701
  /**
6702
6702
  * Converts the text node into a string
6703
- * (representing the text iteself).
6703
+ * (representing the text itself).
6704
6704
  */
6705
6705
 
6706
6706
 
@@ -6795,7 +6795,7 @@
6795
6795
  };
6796
6796
 
6797
6797
  /**
6798
- * This file converts a parse tree into a cooresponding MathML tree. The main
6798
+ * This file converts a parse tree into a corresponding MathML tree. The main
6799
6799
  * entry point is the `buildMathML` function, which takes a parse tree from the
6800
6800
  * parser.
6801
6801
  */
@@ -6870,7 +6870,7 @@
6870
6870
  } else if (font === "mathfrak") {
6871
6871
  return "fraktur";
6872
6872
  } else if (font === "mathscr" || font === "mathcal") {
6873
- // MathML makes no distinction between script and caligrahpic
6873
+ // MathML makes no distinction between script and calligraphic
6874
6874
  return "script";
6875
6875
  } else if (font === "mathsf") {
6876
6876
  return "sans-serif";
@@ -7786,7 +7786,7 @@
7786
7786
  },
7787
7787
 
7788
7788
  // Flow is unable to correctly infer the type of `group`, even though it's
7789
- // unamibiguously determined from the passed-in `type` above.
7789
+ // unambiguously determined from the passed-in `type` above.
7790
7790
  htmlBuilder(group, options) {
7791
7791
  var style = options.style; // Build the argument groups in the appropriate style.
7792
7792
  // Ref: amsmath.dtx: \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}%
@@ -9148,7 +9148,7 @@
9148
9148
  var middleMetrics = getMetrics(middle, font, mode);
9149
9149
  middleHeightTotal = middleMetrics.height + middleMetrics.depth;
9150
9150
  middleFactor = 2; // repeat symmetrically above and below middle
9151
- } // Calcuate the minimal height that the delimiter can have.
9151
+ } // Calculate the minimal height that the delimiter can have.
9152
9152
  // It is at least the size of the top, bottom, and optional middle combined.
9153
9153
 
9154
9154
 
@@ -9232,7 +9232,7 @@
9232
9232
  children: stack
9233
9233
  }, newOptions);
9234
9234
  return styleWrap(buildCommon.makeSpan(["delimsizing", "mult"], [inner], newOptions), Style$1.TEXT, options, classes);
9235
- }; // All surds have 0.08em padding above the viniculum inside the SVG.
9235
+ }; // All surds have 0.08em padding above the vinculum inside the SVG.
9236
9236
  // That keeps browser span height rounding error from pinching the line.
9237
9237
 
9238
9238
 
@@ -9240,8 +9240,8 @@
9240
9240
 
9241
9241
  var emPad = 0.08; // padding, in ems, measured in the document.
9242
9242
 
9243
- var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraViniculum, options) {
9244
- var path = sqrtPath(sqrtName, extraViniculum, viewBoxHeight);
9243
+ var sqrtSvg = function sqrtSvg(sqrtName, height, viewBoxHeight, extraVinculum, options) {
9244
+ var path = sqrtPath(sqrtName, extraVinculum, viewBoxHeight);
9245
9245
  var pathNode = new PathNode(sqrtName, path);
9246
9246
  var svg = new SvgNode([pathNode], {
9247
9247
  // Note: 1000:1 ratio of viewBox to document em width.
@@ -9264,10 +9264,10 @@
9264
9264
 
9265
9265
  var delim = traverseSequence("\\surd", height * newOptions.sizeMultiplier, stackLargeDelimiterSequence, newOptions);
9266
9266
  var sizeMultiplier = newOptions.sizeMultiplier; // default
9267
- // The standard sqrt SVGs each have a 0.04em thick viniculum.
9268
- // If Settings.minRuleThickness is larger than that, we add extraViniculum.
9267
+ // The standard sqrt SVGs each have a 0.04em thick vinculum.
9268
+ // If Settings.minRuleThickness is larger than that, we add extraVinculum.
9269
9269
 
9270
- var extraViniculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol.
9270
+ var extraVinculum = Math.max(0, options.minRuleThickness - options.fontMetrics().sqrtRuleThickness); // Create a span containing an SVG image of a sqrt symbol.
9271
9271
 
9272
9272
  var span;
9273
9273
  var spanHeight = 0;
@@ -9275,14 +9275,14 @@
9275
9275
  var viewBoxHeight = 0;
9276
9276
  var advanceWidth; // We create viewBoxes with 80 units of "padding" above each surd.
9277
9277
  // Then browser rounding error on the parent span height will not
9278
- // encroach on the ink of the viniculum. But that padding is not
9278
+ // encroach on the ink of the vinculum. But that padding is not
9279
9279
  // included in the TeX-like `height` used for calculation of
9280
9280
  // vertical alignment. So texHeight = span.height < span.style.height.
9281
9281
 
9282
9282
  if (delim.type === "small") {
9283
9283
  // Get an SVG that is derived from glyph U+221A in font KaTeX-Main.
9284
9284
  // 1000 unit normal glyph height.
9285
- viewBoxHeight = 1000 + 1000 * extraViniculum + vbPad;
9285
+ viewBoxHeight = 1000 + 1000 * extraVinculum + vbPad;
9286
9286
 
9287
9287
  if (height < 1.0) {
9288
9288
  sizeMultiplier = 1.0; // mimic a \textfont radical
@@ -9290,26 +9290,26 @@
9290
9290
  sizeMultiplier = 0.7; // mimic a \scriptfont radical
9291
9291
  }
9292
9292
 
9293
- spanHeight = (1.0 + extraViniculum + emPad) / sizeMultiplier;
9294
- texHeight = (1.00 + extraViniculum) / sizeMultiplier;
9295
- span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraViniculum, options);
9293
+ spanHeight = (1.0 + extraVinculum + emPad) / sizeMultiplier;
9294
+ texHeight = (1.00 + extraVinculum) / sizeMultiplier;
9295
+ span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight, extraVinculum, options);
9296
9296
  span.style.minWidth = "0.853em";
9297
9297
  advanceWidth = 0.833 / sizeMultiplier; // from the font.
9298
9298
  } else if (delim.type === "large") {
9299
9299
  // These SVGs come from fonts: KaTeX_Size1, _Size2, etc.
9300
9300
  viewBoxHeight = (1000 + vbPad) * sizeToMaxHeight[delim.size];
9301
- texHeight = (sizeToMaxHeight[delim.size] + extraViniculum) / sizeMultiplier;
9302
- spanHeight = (sizeToMaxHeight[delim.size] + extraViniculum + emPad) / sizeMultiplier;
9303
- span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraViniculum, options);
9301
+ texHeight = (sizeToMaxHeight[delim.size] + extraVinculum) / sizeMultiplier;
9302
+ spanHeight = (sizeToMaxHeight[delim.size] + extraVinculum + emPad) / sizeMultiplier;
9303
+ span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight, extraVinculum, options);
9304
9304
  span.style.minWidth = "1.02em";
9305
9305
  advanceWidth = 1.0 / sizeMultiplier; // 1.0 from the font.
9306
9306
  } else {
9307
9307
  // Tall sqrt. In TeX, this would be stacked using multiple glyphs.
9308
9308
  // We'll use a single SVG to accomplish the same thing.
9309
- spanHeight = height + extraViniculum + emPad;
9310
- texHeight = height + extraViniculum;
9311
- viewBoxHeight = Math.floor(1000 * height + extraViniculum) + vbPad;
9312
- span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraViniculum, options);
9309
+ spanHeight = height + extraVinculum + emPad;
9310
+ texHeight = height + extraVinculum;
9311
+ viewBoxHeight = Math.floor(1000 * height + extraVinculum) + vbPad;
9312
+ span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight, extraVinculum, options);
9313
9313
  span.style.minWidth = "0.742em";
9314
9314
  advanceWidth = 1.056;
9315
9315
  }
@@ -9323,7 +9323,7 @@
9323
9323
  // This actually should depend on the chosen font -- e.g. \boldmath
9324
9324
  // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and
9325
9325
  // have thicker rules.
9326
- ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraViniculum) * sizeMultiplier
9326
+ ruleWidth: (options.fontMetrics().sqrtRuleThickness + extraVinculum) * sizeMultiplier
9327
9327
  };
9328
9328
  }; // There are three kinds of delimiters, delimiters that stack when they become
9329
9329
  // too large
@@ -9890,7 +9890,7 @@
9890
9890
  return middleDelim;
9891
9891
  },
9892
9892
  mathmlBuilder: (group, options) => {
9893
- // A Firefox \middle will strech a character vertically only if it
9893
+ // A Firefox \middle will stretch a character vertically only if it
9894
9894
  // is in the fence part of the operator dictionary at:
9895
9895
  // https://www.w3.org/TR/MathML3/appendixc.html.
9896
9896
  // So we need to avoid U+2223 and use plain "|" instead.
@@ -10859,8 +10859,8 @@
10859
10859
  // LaTeX \arraystretch multiplies the row baseline-to-baseline distance.
10860
10860
  // We simulate this by adding (arraystretch - 1)em to the gap. This
10861
10861
  // does a reasonable job of adjusting arrays containing 1 em tall content.
10862
- // The 0.16 and 0.09 values are found emprically. They produce an array
10863
- // similar to LaTeX and in which content does not interfere with \hines.
10862
+ // The 0.16 and 0.09 values are found empirically. They produce an array
10863
+ // similar to LaTeX and in which content does not interfere with \hlines.
10864
10864
 
10865
10865
  var gap = group.arraystretch === 0.5 ? 0.1 // {smallmatrix}, {subarray}
10866
10866
  : 0.16 + group.arraystretch - 1 + (group.addJot ? 0.09 : 0);
@@ -16322,15 +16322,15 @@
16322
16322
  * Expand the next token only once if possible.
16323
16323
  *
16324
16324
  * If the token is expanded, the resulting tokens will be pushed onto
16325
- * the stack in reverse order and will be returned as an array,
16326
- * also in reverse order.
16325
+ * the stack in reverse order, and the number of such tokens will be
16326
+ * returned. This number might be zero or positive.
16327
16327
  *
16328
- * If not, the next token will be returned without removing it
16329
- * from the stack. This case can be detected by a `Token` return value
16330
- * instead of an `Array` return value.
16328
+ * If not, the return value is `false`, and the next token remains at the
16329
+ * top of the stack.
16331
16330
  *
16332
16331
  * In either case, the next token will be on the top of the stack,
16333
- * or the stack will be empty.
16332
+ * or the stack will be empty (in case of empty expansion
16333
+ * and no other tokens).
16334
16334
  *
16335
16335
  * Used to implement `expandAfterFuture` and `expandNextToken`.
16336
16336
  *
@@ -16350,7 +16350,7 @@
16350
16350
  }
16351
16351
 
16352
16352
  this.pushToken(topToken);
16353
- return topToken;
16353
+ return false;
16354
16354
  }
16355
16355
 
16356
16356
  this.expansionCount++;
@@ -16391,7 +16391,7 @@
16391
16391
 
16392
16392
 
16393
16393
  this.pushTokens(tokens);
16394
- return tokens;
16394
+ return tokens.length;
16395
16395
  }
16396
16396
  /**
16397
16397
  * Expand the next token only once (if possible), and return the resulting
@@ -16412,16 +16412,16 @@
16412
16412
 
16413
16413
  expandNextToken() {
16414
16414
  for (;;) {
16415
- var expanded = this.expandOnce(); // expandOnce returns Token if and only if it's fully expanded.
16416
-
16417
- if (expanded instanceof Token) {
16418
- // the token after \noexpand is interpreted as if its meaning
16415
+ if (this.expandOnce() === false) {
16416
+ // fully expanded
16417
+ var token = this.stack.pop(); // the token after \noexpand is interpreted as if its meaning
16419
16418
  // were ‘\relax’
16420
- if (expanded.treatAsRelax) {
16421
- expanded.text = "\\relax";
16419
+
16420
+ if (token.treatAsRelax) {
16421
+ token.text = "\\relax";
16422
16422
  }
16423
16423
 
16424
- return this.stack.pop(); // === expanded
16424
+ return token;
16425
16425
  }
16426
16426
  } // Flow unable to figure out that this pathway is impossible.
16427
16427
  // https://github.com/facebook/flow/issues/4808
@@ -16451,17 +16451,18 @@
16451
16451
  this.pushTokens(tokens);
16452
16452
 
16453
16453
  while (this.stack.length > oldStackLength) {
16454
- var expanded = this.expandOnce(true); // expand only expandable tokens
16455
- // expandOnce returns Token if and only if it's fully expanded.
16454
+ // Expand only expandable tokens
16455
+ if (this.expandOnce(true) === false) {
16456
+ // fully expanded
16457
+ var token = this.stack.pop();
16456
16458
 
16457
- if (expanded instanceof Token) {
16458
- if (expanded.treatAsRelax) {
16459
+ if (token.treatAsRelax) {
16459
16460
  // the expansion of \noexpand is the token itself
16460
- expanded.noexpand = false;
16461
- expanded.treatAsRelax = false;
16461
+ token.noexpand = false;
16462
+ token.treatAsRelax = false;
16462
16463
  }
16463
16464
 
16464
- output.push(this.stack.pop());
16465
+ output.push(token);
16465
16466
  }
16466
16467
  }
16467
16468
 
@@ -17220,7 +17221,7 @@
17220
17221
  * Parses an "expression", which is a list of atoms.
17221
17222
  *
17222
17223
  * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This
17223
- * happens when functions have higher precendence han infix
17224
+ * happens when functions have higher precedence han infix
17224
17225
  * nodes in implicit parses.
17225
17226
  *
17226
17227
  * `breakOnTokenText`: The text of the token that the expression should end
@@ -18302,7 +18303,7 @@
18302
18303
  /**
18303
18304
  * Current KaTeX version
18304
18305
  */
18305
- version: "0.16.4",
18306
+ version: "0.16.6",
18306
18307
 
18307
18308
  /**
18308
18309
  * Renders the given LaTeX into an HTML+MathML combination, and adds
@@ -18367,6 +18368,13 @@
18367
18368
  */
18368
18369
  __defineSymbol: defineSymbol,
18369
18370
 
18371
+ /**
18372
+ * adds a new function to builtin function list,
18373
+ * which directly produce parse tree elements
18374
+ * and have their own html/mathml builders
18375
+ */
18376
+ __defineFunction: defineFunction,
18377
+
18370
18378
  /**
18371
18379
  * adds a new macro to builtin macro list
18372
18380
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marked-katex-extension",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "MarkedJS extesion to render katex",
5
5
  "main": "./lib/index.cjs",
6
6
  "module": "./src/index.js",
@@ -58,10 +58,10 @@
58
58
  "eslint-plugin-promise": "^6.1.1",
59
59
  "jest-cli": "^29.5.0",
60
60
  "marked": "^4.3.0",
61
- "rollup": "^3.20.2",
61
+ "rollup": "^3.20.4",
62
62
  "semantic-release": "^21.0.1"
63
63
  },
64
64
  "dependencies": {
65
- "katex": "^0.16.4"
65
+ "katex": "^0.16.6"
66
66
  }
67
67
  }