@pie-element/shared-math-rendering-mathjax 0.1.1-next.3 → 0.1.1-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter.d.ts +3 -2
- package/dist/index.js +10 -4
- package/package.json +1 -1
package/dist/adapter.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { MathjaxOptions } from './types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Create a MathJax renderer function.
|
|
4
4
|
*
|
|
5
|
-
* MathJax loads once per page, the first
|
|
6
|
-
*
|
|
5
|
+
* MathJax loads once per page, on the first render, from `srcUrl` or MathJax 4.1.3 on jsDelivr.
|
|
6
|
+
* A MathJax the page already has, or is loading, is used instead. A render waits on the load only
|
|
7
|
+
* when its element holds math.
|
|
7
8
|
*
|
|
8
9
|
* @param options - Renderer options
|
|
9
10
|
* @returns Renderer function that typesets math in an element
|
package/dist/index.js
CHANGED
|
@@ -86,10 +86,16 @@ function h(e) {
|
|
|
86
86
|
function g(e = {}) {
|
|
87
87
|
let t = e.useSingleDollar ?? !1;
|
|
88
88
|
return async (n) => {
|
|
89
|
-
if (typeof window > "u"
|
|
90
|
-
|
|
91
|
-
let r =
|
|
92
|
-
|
|
89
|
+
if (typeof window > "u") return;
|
|
90
|
+
l(n);
|
|
91
|
+
let r = h(e);
|
|
92
|
+
if (!u(n, t)) {
|
|
93
|
+
r.catch(() => {});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
await r;
|
|
97
|
+
let i = s();
|
|
98
|
+
await i?.startup?.promise, typeof i?.typesetPromise == "function" && await i.typesetPromise([n]);
|
|
93
99
|
};
|
|
94
100
|
}
|
|
95
101
|
function _() {
|