@elmethis/core 1.0.0-alpha.165 → 1.0.0-alpha.166
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.
|
@@ -9,8 +9,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9
9
|
},
|
|
10
10
|
setup(__props) {
|
|
11
11
|
const props = __props;
|
|
12
|
-
const
|
|
13
|
-
const html = ref(props.expression);
|
|
12
|
+
const html = ref();
|
|
14
13
|
let katexRenderToString = null;
|
|
15
14
|
const loadKatex = async () => {
|
|
16
15
|
if (!katexRenderToString) {
|
|
@@ -23,12 +22,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
23
22
|
};
|
|
24
23
|
const render = async () => {
|
|
25
24
|
await loadKatex();
|
|
26
|
-
if (!
|
|
25
|
+
if (!html.value && katexRenderToString) {
|
|
27
26
|
try {
|
|
28
27
|
html.value = katexRenderToString(props.expression, {
|
|
29
28
|
displayMode: props.block
|
|
30
29
|
});
|
|
31
|
-
isRendered.value = true;
|
|
32
30
|
} catch (err) {
|
|
33
31
|
console.error("KaTeX rendering error:", err);
|
|
34
32
|
}
|
|
@@ -47,7 +45,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
47
45
|
})
|
|
48
46
|
}, {
|
|
49
47
|
default: withCtx(() => [
|
|
50
|
-
|
|
48
|
+
html.value ? (openBlock(), createElementBlock("span", {
|
|
51
49
|
key: 0,
|
|
52
50
|
innerHTML: html.value
|
|
53
51
|
}, null, 8, _hoisted_1)) : (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(_ctx.expression), 1))
|