marked-katex-extension 1.0.2 → 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.
- package/README.md +6 -6
- package/lib/index.cjs +56 -0
- package/lib/index.umd.js +98 -90
- package/package.json +29 -18
- package/.editorconfig +0 -16
- package/.eslintignore +0 -2
- package/.eslintrc.json +0 -26
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/automerge.yml +0 -39
- package/.github/workflows/main.yml +0 -74
- package/babel.config.json +0 -3
- package/jest.config.js +0 -21
- package/release.config.cjs +0 -10
- package/rollup.config.umd.js +0 -11
- package/spec/__snapshots__/index.test.js.snap +0 -105
- package/spec/index.test.js +0 -55
package/README.md
CHANGED
|
@@ -23,12 +23,12 @@ You will still need to include the css in your html document to allow katex styl
|
|
|
23
23
|
# Usage
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
import {marked} from "marked";
|
|
27
|
+
import markedKatex from "marked-katex-extension";
|
|
28
28
|
|
|
29
|
-
// or
|
|
30
|
-
//
|
|
31
|
-
//
|
|
29
|
+
// or UMD script
|
|
30
|
+
// <script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
|
|
31
|
+
// <script src="https://cdn.jsdelivr.net/npm/marked-katex-extension/lib/index.umd.js"></script>
|
|
32
32
|
|
|
33
33
|
const options = {
|
|
34
34
|
throwOnError: false
|
|
@@ -36,7 +36,7 @@ const options = {
|
|
|
36
36
|
|
|
37
37
|
marked.use(markedKatex(options));
|
|
38
38
|
|
|
39
|
-
marked("katex: $c = \\pm\\sqrt{a^2 + b^2}$");
|
|
39
|
+
marked.parse("katex: $c = \\pm\\sqrt{a^2 + b^2}$");
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|

|
package/lib/index.cjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var katex = require('katex');
|
|
4
|
+
|
|
5
|
+
function index(options = {}) {
|
|
6
|
+
return {
|
|
7
|
+
extensions: [
|
|
8
|
+
inlineKatex(options),
|
|
9
|
+
blockKatex(options)
|
|
10
|
+
]
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function inlineKatex(options) {
|
|
15
|
+
return {
|
|
16
|
+
name: 'inlineKatex',
|
|
17
|
+
level: 'inline',
|
|
18
|
+
start(src) { return src.indexOf('$'); },
|
|
19
|
+
tokenizer(src, tokens) {
|
|
20
|
+
const match = src.match(/^\$+([^$\n]+?)\$+/);
|
|
21
|
+
if (match) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'inlineKatex',
|
|
24
|
+
raw: match[0],
|
|
25
|
+
text: match[1].trim()
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
renderer(token) {
|
|
30
|
+
return katex.renderToString(token.text, options);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function blockKatex(options) {
|
|
36
|
+
return {
|
|
37
|
+
name: 'blockKatex',
|
|
38
|
+
level: 'block',
|
|
39
|
+
start(src) { return src.indexOf('\n$$'); },
|
|
40
|
+
tokenizer(src, tokens) {
|
|
41
|
+
const match = src.match(/^\$\$+\n([^$]+?)\n\$\$+\n/);
|
|
42
|
+
if (match) {
|
|
43
|
+
return {
|
|
44
|
+
type: 'blockKatex',
|
|
45
|
+
raw: match[0],
|
|
46
|
+
text: match[1].trim()
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
renderer(token) {
|
|
51
|
+
return `<p>${katex.renderToString(token.text, options)}</p>`;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = index;
|
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
|
|
747
|
-
// The
|
|
748
|
-
// Think of variable
|
|
749
|
-
// The detour begins at the lower left of the area labeled
|
|
750
|
-
// The detour proceeds one
|
|
751
|
-
// displacing the radiused corner between surd and
|
|
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
|
|
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
|
-
/*
|
|
756
|
+
/* vinculum
|
|
757
757
|
/
|
|
758
|
-
/▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒←
|
|
759
|
-
/ █████████████████████←0.04em (40 unit) std
|
|
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(
|
|
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 +
|
|
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(
|
|
771
|
+
var sqrtSize1 = function sqrtSize1(extraVinculum, hLinePad) {
|
|
772
772
|
// size1 is from glyph U221A in the font KaTeX_Size1-Regular
|
|
773
|
-
return "M263," + (601 +
|
|
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(
|
|
776
|
+
var sqrtSize2 = function sqrtSize2(extraVinculum, hLinePad) {
|
|
777
777
|
// size2 is from glyph U221A in the font KaTeX_Size2-Regular
|
|
778
|
-
return "M983 " + (10 +
|
|
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(
|
|
781
|
+
var sqrtSize3 = function sqrtSize3(extraVinculum, hLinePad) {
|
|
782
782
|
// size3 is from glyph U221A in the font KaTeX_Size3-Regular
|
|
783
|
-
return "M424," + (2398 +
|
|
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(
|
|
786
|
+
var sqrtSize4 = function sqrtSize4(extraVinculum, hLinePad) {
|
|
787
787
|
// size4 is from glyph U221A in the font KaTeX_Size4-Regular
|
|
788
|
-
return "M473," + (2713 +
|
|
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(
|
|
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
|
|
800
|
-
// to a point near (14 units) the bottom of the surd. The
|
|
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 -
|
|
803
|
-
return "M702 " + (
|
|
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,
|
|
807
|
-
|
|
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(
|
|
813
|
+
path = sqrtMain(extraVinculum, hLinePad);
|
|
814
814
|
break;
|
|
815
815
|
|
|
816
816
|
case "sqrtSize1":
|
|
817
|
-
path = sqrtSize1(
|
|
817
|
+
path = sqrtSize1(extraVinculum, hLinePad);
|
|
818
818
|
break;
|
|
819
819
|
|
|
820
820
|
case "sqrtSize2":
|
|
821
|
-
path = sqrtSize2(
|
|
821
|
+
path = sqrtSize2(extraVinculum, hLinePad);
|
|
822
822
|
break;
|
|
823
823
|
|
|
824
824
|
case "sqrtSize3":
|
|
825
|
-
path = sqrtSize3(
|
|
825
|
+
path = sqrtSize3(extraVinculum, hLinePad);
|
|
826
826
|
break;
|
|
827
827
|
|
|
828
828
|
case "sqrtSize4":
|
|
829
|
-
path = sqrtSize4(
|
|
829
|
+
path = sqrtSize4(extraVinculum, hLinePad);
|
|
830
830
|
break;
|
|
831
831
|
|
|
832
832
|
case "sqrtTall":
|
|
833
|
-
path = sqrtTall(
|
|
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
|
|
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
|
|
3142
|
+
// provided in the arrays below, in that order.
|
|
3143
3143
|
//
|
|
3144
|
-
// The font metrics are stored in fonts cmsy10, cmsy7, and cmsy5
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
//
|
|
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
|
-
} //
|
|
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
|
|
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,
|
|
9244
|
-
var path = sqrtPath(sqrtName,
|
|
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
|
|
9268
|
-
// If Settings.minRuleThickness is larger than that, we add
|
|
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
|
|
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
|
|
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 *
|
|
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 +
|
|
9294
|
-
texHeight = (1.00 +
|
|
9295
|
-
span = sqrtSvg("sqrtMain", spanHeight, viewBoxHeight,
|
|
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] +
|
|
9302
|
-
spanHeight = (sizeToMaxHeight[delim.size] +
|
|
9303
|
-
span = sqrtSvg("sqrtSize" + delim.size, spanHeight, viewBoxHeight,
|
|
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 +
|
|
9310
|
-
texHeight = height +
|
|
9311
|
-
viewBoxHeight = Math.floor(1000 * height +
|
|
9312
|
-
span = sqrtSvg("sqrtTall", spanHeight, viewBoxHeight,
|
|
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 +
|
|
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
|
|
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
|
|
10863
|
-
// similar to LaTeX and in which content does not interfere with \
|
|
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
|
|
16326
|
-
*
|
|
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
|
|
16329
|
-
*
|
|
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
|
|
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
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
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
|
-
|
|
16421
|
-
|
|
16419
|
+
|
|
16420
|
+
if (token.treatAsRelax) {
|
|
16421
|
+
token.text = "\\relax";
|
|
16422
16422
|
}
|
|
16423
16423
|
|
|
16424
|
-
return
|
|
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
|
-
|
|
16455
|
-
|
|
16454
|
+
// Expand only expandable tokens
|
|
16455
|
+
if (this.expandOnce(true) === false) {
|
|
16456
|
+
// fully expanded
|
|
16457
|
+
var token = this.stack.pop();
|
|
16456
16458
|
|
|
16457
|
-
|
|
16458
|
-
if (expanded.treatAsRelax) {
|
|
16459
|
+
if (token.treatAsRelax) {
|
|
16459
16460
|
// the expansion of \noexpand is the token itself
|
|
16460
|
-
|
|
16461
|
-
|
|
16461
|
+
token.noexpand = false;
|
|
16462
|
+
token.treatAsRelax = false;
|
|
16462
16463
|
}
|
|
16463
16464
|
|
|
16464
|
-
output.push(
|
|
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
|
|
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.
|
|
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,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marked-katex-extension",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "MarkedJS extesion to render katex",
|
|
5
|
-
"main": "./
|
|
5
|
+
"main": "./lib/index.cjs",
|
|
6
|
+
"module": "./src/index.js",
|
|
6
7
|
"browser": "./lib/index.umd.js",
|
|
7
8
|
"type": "module",
|
|
8
9
|
"keywords": [
|
|
@@ -10,11 +11,21 @@
|
|
|
10
11
|
"katex",
|
|
11
12
|
"extension"
|
|
12
13
|
],
|
|
14
|
+
"files": [
|
|
15
|
+
"lib/",
|
|
16
|
+
"src/"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./src/index.js",
|
|
21
|
+
"require": "./lib/index.cjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
13
24
|
"scripts": {
|
|
14
25
|
"test": "jest --verbose",
|
|
15
26
|
"test:cover": "jest --coverage",
|
|
16
27
|
"lint": "eslint .",
|
|
17
|
-
"build": "rollup -c rollup.config.
|
|
28
|
+
"build": "rollup -c rollup.config.js"
|
|
18
29
|
},
|
|
19
30
|
"repository": {
|
|
20
31
|
"type": "git",
|
|
@@ -27,30 +38,30 @@
|
|
|
27
38
|
},
|
|
28
39
|
"homepage": "https://github.com/UziTech/marked-katex-extension#readme",
|
|
29
40
|
"peerDependencies": {
|
|
30
|
-
"marked": "^4.
|
|
41
|
+
"marked": "^4.3.0"
|
|
31
42
|
},
|
|
32
43
|
"devDependencies": {
|
|
33
|
-
"@babel/core": "^7.
|
|
34
|
-
"@babel/preset-env": "^7.
|
|
35
|
-
"@rollup/plugin-node-resolve": "^15.0.
|
|
36
|
-
"@semantic-release/changelog": "^6.0.
|
|
44
|
+
"@babel/core": "^7.21.4",
|
|
45
|
+
"@babel/preset-env": "^7.21.4",
|
|
46
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
47
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
37
48
|
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
38
49
|
"@semantic-release/git": "^10.0.1",
|
|
39
50
|
"@semantic-release/github": "^8.0.7",
|
|
40
|
-
"@semantic-release/npm": "^
|
|
51
|
+
"@semantic-release/npm": "^10.0.3",
|
|
41
52
|
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
42
|
-
"babel-jest": "^29.
|
|
43
|
-
"eslint": "^8.
|
|
53
|
+
"babel-jest": "^29.5.0",
|
|
54
|
+
"eslint": "^8.38.0",
|
|
44
55
|
"eslint-config-standard": "^17.0.0",
|
|
45
|
-
"eslint-plugin-import": "^2.
|
|
46
|
-
"eslint-plugin-n": "^15.
|
|
56
|
+
"eslint-plugin-import": "^2.27.5",
|
|
57
|
+
"eslint-plugin-n": "^15.7.0",
|
|
47
58
|
"eslint-plugin-promise": "^6.1.1",
|
|
48
|
-
"jest-cli": "^29.
|
|
49
|
-
"marked": "^4.
|
|
50
|
-
"rollup": "^3.
|
|
51
|
-
"semantic-release": "^
|
|
59
|
+
"jest-cli": "^29.5.0",
|
|
60
|
+
"marked": "^4.3.0",
|
|
61
|
+
"rollup": "^3.20.4",
|
|
62
|
+
"semantic-release": "^21.0.1"
|
|
52
63
|
},
|
|
53
64
|
"dependencies": {
|
|
54
|
-
"katex": "^0.16.
|
|
65
|
+
"katex": "^0.16.6"
|
|
55
66
|
}
|
|
56
67
|
}
|
package/.editorconfig
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*.{json,js}]
|
|
4
|
-
charset = utf-8
|
|
5
|
-
end_of_line = lf
|
|
6
|
-
insert_final_newline = true
|
|
7
|
-
indent_style = space
|
|
8
|
-
indent_size = 2
|
|
9
|
-
|
|
10
|
-
[*.md]
|
|
11
|
-
charset = utf-8
|
|
12
|
-
end_of_line = lf
|
|
13
|
-
insert_final_newline = true
|
|
14
|
-
trim_trailing_whitespace = true
|
|
15
|
-
indent_style = tab
|
|
16
|
-
indent_size = 4
|
package/.eslintignore
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "standard",
|
|
3
|
-
"rules": {
|
|
4
|
-
"semi": ["error", "always"],
|
|
5
|
-
"indent": ["error", 2, {
|
|
6
|
-
"SwitchCase": 1,
|
|
7
|
-
"VariableDeclarator": { "var": 2 },
|
|
8
|
-
"outerIIFEBody": 0
|
|
9
|
-
}],
|
|
10
|
-
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
|
|
11
|
-
"space-before-function-paren": ["error", "never"],
|
|
12
|
-
"no-cond-assign": "off",
|
|
13
|
-
"no-useless-escape": "off",
|
|
14
|
-
"one-var": "off",
|
|
15
|
-
"no-control-regex": "off",
|
|
16
|
-
"no-prototype-builtins": "off",
|
|
17
|
-
"no-extra-semi": "error",
|
|
18
|
-
|
|
19
|
-
"prefer-const": "error",
|
|
20
|
-
"no-var": "error"
|
|
21
|
-
},
|
|
22
|
-
"env": {
|
|
23
|
-
"node": true,
|
|
24
|
-
"jest": true
|
|
25
|
-
}
|
|
26
|
-
}
|
package/.github/dependabot.yml
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
name: "Automerge"
|
|
2
|
-
on:
|
|
3
|
-
workflow_run:
|
|
4
|
-
workflows:
|
|
5
|
-
- CI
|
|
6
|
-
types:
|
|
7
|
-
- completed
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
Automerge:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
if: |
|
|
13
|
-
github.event.workflow_run.event == 'pull_request' &&
|
|
14
|
-
github.event.workflow_run.conclusion == 'success'
|
|
15
|
-
steps:
|
|
16
|
-
- name: 'Merge PR'
|
|
17
|
-
uses: actions/github-script@v6
|
|
18
|
-
with:
|
|
19
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
-
script: |
|
|
21
|
-
const pr = await github.rest.pulls.get({
|
|
22
|
-
owner: context.repo.owner,
|
|
23
|
-
repo: context.repo.repo,
|
|
24
|
-
pull_number: context.payload.workflow_run.pull_requests[0].number,
|
|
25
|
-
});
|
|
26
|
-
if (!pr.data.title.startsWith('chore(deps-dev):')) {
|
|
27
|
-
console.log('Not Merged 🚫');
|
|
28
|
-
console.log(`Title '${pr.data.title}' does not start with 'chore(deps-dev):'`);
|
|
29
|
-
} else if (pr.data.user.login !== 'dependabot[bot]') {
|
|
30
|
-
console.log('Not Merged 🚫');
|
|
31
|
-
console.log(`User '${pr.data.user.login}' does not equal 'dependabot[bot]'`);
|
|
32
|
-
} else {
|
|
33
|
-
await github.rest.pulls.merge({
|
|
34
|
-
owner: context.repo.owner,
|
|
35
|
-
repo: context.repo.repo,
|
|
36
|
-
pull_number: context.payload.workflow_run.pull_requests[0].number,
|
|
37
|
-
});
|
|
38
|
-
console.log('Merged 🎉');
|
|
39
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
name: "CI"
|
|
2
|
-
on:
|
|
3
|
-
pull_request:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
|
|
10
|
-
Test:
|
|
11
|
-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout Code
|
|
15
|
-
uses: actions/checkout@v3
|
|
16
|
-
- name: Install Node
|
|
17
|
-
uses: dcodeIO/setup-node-nvm@master
|
|
18
|
-
with:
|
|
19
|
-
node-version: node
|
|
20
|
-
- name: Install Dependencies
|
|
21
|
-
run: npm ci
|
|
22
|
-
- name: Run Tests 👩🏽💻
|
|
23
|
-
run: npm run test
|
|
24
|
-
|
|
25
|
-
Coverage:
|
|
26
|
-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
27
|
-
runs-on: ubuntu-latest
|
|
28
|
-
steps:
|
|
29
|
-
- name: Checkout Code
|
|
30
|
-
uses: actions/checkout@v3
|
|
31
|
-
- name: Install Node
|
|
32
|
-
uses: dcodeIO/setup-node-nvm@master
|
|
33
|
-
with:
|
|
34
|
-
node-version: 'lts/*'
|
|
35
|
-
- name: Install Dependencies
|
|
36
|
-
run: npm ci
|
|
37
|
-
- name: Run Tests 👩🏽💻
|
|
38
|
-
run: npm run test:cover
|
|
39
|
-
|
|
40
|
-
Lint:
|
|
41
|
-
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
42
|
-
runs-on: ubuntu-latest
|
|
43
|
-
steps:
|
|
44
|
-
- name: Checkout Code
|
|
45
|
-
uses: actions/checkout@v3
|
|
46
|
-
- name: Install Dependencies
|
|
47
|
-
run: npm ci
|
|
48
|
-
- name: Lint ✨
|
|
49
|
-
run: npm run lint
|
|
50
|
-
|
|
51
|
-
Release:
|
|
52
|
-
needs: [Test, Coverage, Lint]
|
|
53
|
-
if: |
|
|
54
|
-
github.ref == 'refs/heads/main' &&
|
|
55
|
-
github.event.repository.fork == false
|
|
56
|
-
runs-on: ubuntu-latest
|
|
57
|
-
steps:
|
|
58
|
-
- name: Checkout Code
|
|
59
|
-
uses: actions/checkout@v3
|
|
60
|
-
- name: Install Dependencies
|
|
61
|
-
run: npm ci
|
|
62
|
-
- name: Build 🗜️
|
|
63
|
-
run: |
|
|
64
|
-
npm run build
|
|
65
|
-
if ! git diff --quiet; then
|
|
66
|
-
git config --global user.email "<>"
|
|
67
|
-
git config --global user.name "CI Build"
|
|
68
|
-
git commit -am "🗜️ build [skip ci]"
|
|
69
|
-
fi
|
|
70
|
-
- name: Release 🎉
|
|
71
|
-
env:
|
|
72
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
73
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
74
|
-
run: npx semantic-release
|
package/babel.config.json
DELETED
package/jest.config.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
restoreMocks: true,
|
|
3
|
-
clearMocks: true,
|
|
4
|
-
// collectCoverage: true,
|
|
5
|
-
collectCoverageFrom: [
|
|
6
|
-
'src/index.js'
|
|
7
|
-
],
|
|
8
|
-
coverageDirectory: 'coverage',
|
|
9
|
-
coverageThreshold: {
|
|
10
|
-
global: {
|
|
11
|
-
branches: 100,
|
|
12
|
-
functions: 100,
|
|
13
|
-
lines: 100,
|
|
14
|
-
statements: 100
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
testRegex: /\.test\.js$/.source,
|
|
18
|
-
transform: {
|
|
19
|
-
'\\.[jt]sx?$': 'babel-jest'
|
|
20
|
-
}
|
|
21
|
-
};
|
package/release.config.cjs
DELETED
package/rollup.config.umd.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`marked-katex-extension block katex 1`] = `
|
|
4
|
-
"<p>This is block level katex:</p>
|
|
5
|
-
<p><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mo>=</mo><mo>±</mo><msqrt><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></msqrt></mrow><annotation encoding="application/x-tex">c = \\pm\\sqrt{a^2 + b^2}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.04em;vertical-align:-0.1266em;"></span><span class="mord">±</span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9134em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord"><span class="mord mathnormal">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span><span style="top:-2.8734em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
|
|
6
|
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
7
|
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
8
|
-
c44.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
|
|
9
|
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
|
10
|
-
c69,-144,104.5,-217.7,106.5,-221
|
|
11
|
-
l0 -0
|
|
12
|
-
c5.3,-9.3,12,-14,20,-14
|
|
13
|
-
H400000v40H845.2724
|
|
14
|
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
|
15
|
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
|
16
|
-
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.1266em;"><span></span></span></span></span></span></span></span></span></p>"
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
exports[`marked-katex-extension block katex 1 $ 1`] = `
|
|
20
|
-
"<p>This is block level katex:</p>
|
|
21
|
-
<p>$
|
|
22
|
-
c = \\pm\\sqrt{a^2 + b^2}
|
|
23
|
-
$</p>
|
|
24
|
-
"
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`marked-katex-extension block katex more $ 1`] = `
|
|
28
|
-
"<p>This is block level katex:</p>
|
|
29
|
-
<p><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mo>=</mo><mo>±</mo><msqrt><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></msqrt></mrow><annotation encoding="application/x-tex">c = \\pm\\sqrt{a^2 + b^2}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.04em;vertical-align:-0.1266em;"></span><span class="mord">±</span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9134em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord"><span class="mord mathnormal">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span><span style="top:-2.8734em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
|
|
30
|
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
31
|
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
32
|
-
c44.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
|
|
33
|
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
|
34
|
-
c69,-144,104.5,-217.7,106.5,-221
|
|
35
|
-
l0 -0
|
|
36
|
-
c5.3,-9.3,12,-14,20,-14
|
|
37
|
-
H400000v40H845.2724
|
|
38
|
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
|
39
|
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
|
40
|
-
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.1266em;"><span></span></span></span></span></span></span></span></span></p>"
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
exports[`marked-katex-extension inline katex 1`] = `
|
|
44
|
-
"<p>This is inline katex: <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mo>=</mo><mo>±</mo><msqrt><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></msqrt></mrow><annotation encoding="application/x-tex">c = \\pm\\sqrt{a^2 + b^2}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.04em;vertical-align:-0.1266em;"></span><span class="mord">±</span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9134em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord"><span class="mord mathnormal">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span><span style="top:-2.8734em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
|
|
45
|
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
46
|
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
47
|
-
c44.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
|
|
48
|
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
|
49
|
-
c69,-144,104.5,-217.7,106.5,-221
|
|
50
|
-
l0 -0
|
|
51
|
-
c5.3,-9.3,12,-14,20,-14
|
|
52
|
-
H400000v40H845.2724
|
|
53
|
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
|
54
|
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
|
55
|
-
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.1266em;"><span></span></span></span></span></span></span></span></span></p>
|
|
56
|
-
"
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
exports[`marked-katex-extension inline katex 2`] = `
|
|
60
|
-
"<p>This is inline katex: <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mo>=</mo><mo>±</mo><msqrt><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></msqrt></mrow><annotation encoding="application/x-tex">c = \\pm\\sqrt{a^2 + b^2}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.04em;vertical-align:-0.1266em;"></span><span class="mord">±</span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9134em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord"><span class="mord mathnormal">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span><span style="top:-2.8734em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
|
|
61
|
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
62
|
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
63
|
-
c44.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
|
|
64
|
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
|
65
|
-
c69,-144,104.5,-217.7,106.5,-221
|
|
66
|
-
l0 -0
|
|
67
|
-
c5.3,-9.3,12,-14,20,-14
|
|
68
|
-
H400000v40H845.2724
|
|
69
|
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
|
70
|
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
|
71
|
-
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.1266em;"><span></span></span></span></span></span></span></span></span></p>
|
|
72
|
-
"
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
exports[`marked-katex-extension inline katex more $ 1`] = `
|
|
76
|
-
"<p>This is inline katex: <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mo>=</mo><mo>±</mo><msqrt><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></msqrt></mrow><annotation encoding="application/x-tex">c = \\pm\\sqrt{a^2 + b^2}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.04em;vertical-align:-0.1266em;"></span><span class="mord">±</span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9134em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord"><span class="mord mathnormal">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span><span style="top:-2.8734em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
|
|
77
|
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
78
|
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
79
|
-
c44.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
|
|
80
|
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
|
81
|
-
c69,-144,104.5,-217.7,106.5,-221
|
|
82
|
-
l0 -0
|
|
83
|
-
c5.3,-9.3,12,-14,20,-14
|
|
84
|
-
H400000v40H845.2724
|
|
85
|
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
|
86
|
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
|
87
|
-
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.1266em;"><span></span></span></span></span></span></span></span></span></p>
|
|
88
|
-
"
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
exports[`marked-katex-extension readme example 1`] = `
|
|
92
|
-
"<p>katex: <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mo>=</mo><mo>±</mo><msqrt><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mrow></msqrt></mrow><annotation encoding="application/x-tex">c = \\pm\\sqrt{a^2 + b^2}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.04em;vertical-align:-0.1266em;"></span><span class="mord">±</span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9134em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord"><span class="mord mathnormal">a</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span><span style="top:-2.8734em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
|
|
93
|
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
|
94
|
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
|
95
|
-
c44.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
|
|
96
|
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
|
97
|
-
c69,-144,104.5,-217.7,106.5,-221
|
|
98
|
-
l0 -0
|
|
99
|
-
c5.3,-9.3,12,-14,20,-14
|
|
100
|
-
H400000v40H845.2724
|
|
101
|
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
|
102
|
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
|
103
|
-
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.1266em;"><span></span></span></span></span></span></span></span></span></p>
|
|
104
|
-
"
|
|
105
|
-
`;
|
package/spec/index.test.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { marked } from 'marked';
|
|
2
|
-
import markedKatex from '../src/index.js';
|
|
3
|
-
|
|
4
|
-
describe('marked-katex-extension', () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
marked.setOptions(marked.getDefaults());
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const snapshots = {
|
|
10
|
-
'readme example': 'katex: $c = \\pm\\sqrt{a^2 + b^2}$',
|
|
11
|
-
'inline katex': `
|
|
12
|
-
This is inline katex: $c = \\pm\\sqrt{a^2 + b^2}$
|
|
13
|
-
`,
|
|
14
|
-
'block katex': `
|
|
15
|
-
This is block level katex:
|
|
16
|
-
|
|
17
|
-
$$
|
|
18
|
-
c = \\pm\\sqrt{a^2 + b^2}
|
|
19
|
-
$$
|
|
20
|
-
`,
|
|
21
|
-
'inline katex more $': `
|
|
22
|
-
This is inline katex: $$c = \\pm\\sqrt{a^2 + b^2}$$
|
|
23
|
-
`,
|
|
24
|
-
'block katex more $': `
|
|
25
|
-
This is block level katex:
|
|
26
|
-
|
|
27
|
-
$$$
|
|
28
|
-
c = \\pm\\sqrt{a^2 + b^2}
|
|
29
|
-
$$$
|
|
30
|
-
`,
|
|
31
|
-
'block katex 1 $': `
|
|
32
|
-
This is block level katex:
|
|
33
|
-
|
|
34
|
-
$
|
|
35
|
-
c = \\pm\\sqrt{a^2 + b^2}
|
|
36
|
-
$
|
|
37
|
-
`
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
for (const name in snapshots) {
|
|
41
|
-
test(name, () => {
|
|
42
|
-
marked.use(markedKatex());
|
|
43
|
-
const md = snapshots[name];
|
|
44
|
-
expect(marked(md)).toMatchSnapshot();
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
test('inline katex', () => {
|
|
49
|
-
marked.use(markedKatex());
|
|
50
|
-
const md = `
|
|
51
|
-
This is inline katex: $c = \\pm\\sqrt{a^2 + b^2}$
|
|
52
|
-
`;
|
|
53
|
-
expect(marked(md)).toMatchSnapshot();
|
|
54
|
-
});
|
|
55
|
-
});
|