fix: render equations in markdown preview (#5745)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user