diff --git a/packages/frontend/package.json b/packages/frontend/package.json
index 071a8cfa8c..8f9eb55454 100644
--- a/packages/frontend/package.json
+++ b/packages/frontend/package.json
@@ -51,6 +51,7 @@
"insert-text-at-cursor": "0.3.0",
"is-file-animated": "1.0.2",
"json5": "2.2.3",
+ "katex": "^0.16.9",
"matter-js": "0.19.0",
"mfm-js": "0.23.3",
"misskey-js": "workspace:*",
diff --git a/packages/frontend/src/components/MkFormula.vue b/packages/frontend/src/components/MkFormula.vue
new file mode 100644
index 0000000000..f39a8db017
--- /dev/null
+++ b/packages/frontend/src/components/MkFormula.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/packages/frontend/src/components/MkFormulaCore.vue b/packages/frontend/src/components/MkFormulaCore.vue
new file mode 100644
index 0000000000..2db4c7d00d
--- /dev/null
+++ b/packages/frontend/src/components/MkFormulaCore.vue
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
diff --git a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts
index 7d55353d98..a7c5e1a9fd 100644
--- a/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts
+++ b/packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts
@@ -12,6 +12,7 @@ import MkLink from '@/components/MkLink.vue';
import MkMention from '@/components/MkMention.vue';
import MkEmoji from '@/components/global/MkEmoji.vue';
import MkCustomEmoji from '@/components/global/MkCustomEmoji.vue';
+import MkFormula from "@/components/MkFormula.vue";
import MkCode from '@/components/MkCode.vue';
import MkGoogle from '@/components/MkGoogle.vue';
import MkSparkle from '@/components/MkSparkle.vue';
@@ -389,12 +390,24 @@ export default function(props: MfmProps) {
})];
}
- case 'mathInline': {
- return [h('code', token.props.formula)];
+ case "mathInline": {
+ return [
+ h(MkFormula, {
+ key: Math.random(),
+ formula: token.props.formula,
+ block: false,
+ }),
+ ];
}
- case 'mathBlock': {
- return [h('code', token.props.formula)];
+ case "mathBlock": {
+ return [
+ h(MkFormula, {
+ key: Math.random(),
+ formula: token.props.formula,
+ block: true,
+ }),
+ ];
}
case 'search': {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8e750d5158..7c11ca2d39 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -753,6 +753,9 @@ importers:
json5:
specifier: 2.2.3
version: 2.2.3
+ katex:
+ specifier: ^0.16.9
+ version: 0.16.9
matter-js:
specifier: 0.19.0
version: 0.19.0