fix: render equations in markdown preview (#5745)

This commit is contained in:
NN708 authored and GitHub committed 2026-02-15 13:53:36 +01:00
1 parent 63a76ef18c
commit 0467326d5c
3 files changed
+35

No files matched your search

+6
View File
@@ -94,6 +94,7 @@ import { useFileStore } from "@/stores/file";
import { useLayoutStore } from "@/stores/layout";
import { getEditorTheme } from "@/utils/theme";
import { marked } from "marked";
import markedKatex from "marked-katex-extension";
import { inject, onBeforeUnmount, onMounted, ref, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
import { onBeforeRouteUpdate, useRoute, useRouter } from "vue-router";
@@ -118,6 +119,11 @@ const previewContent = ref("");
const isMarkdownFile =
fileStore.req?.name.endsWith(".md") ||
fileStore.req?.name.endsWith(".markdown");
const katexOptions = {
output: "mathml" as const,
throwOnError: false
};
marked.use(markedKatex(katexOptions));
const isSelectionEmpty = ref(true);