1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-13 22:28:58 +09:00

Add Temml math formula rendering

This commit is contained in:
yuriha-chan 2023-07-01 14:01:39 +09:00 committed by NoriDev
parent b269abdb04
commit 1ad9b74848
3 changed files with 9 additions and 13 deletions

View File

@ -136,6 +136,7 @@
"storybook": "7.0.18", "storybook": "7.0.18",
"storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme", "storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme",
"summaly": "github:misskey-dev/summaly", "summaly": "github:misskey-dev/summaly",
"temml": "0.10.3",
"vite-plugin-turbosnap": "1.0.2", "vite-plugin-turbosnap": "1.0.2",
"vitest": "0.32.2", "vitest": "0.32.2",
"vitest-fetch-mock": "0.2.2", "vitest-fetch-mock": "0.2.2",

View File

@ -2,6 +2,7 @@
import 'vite/modulepreload-polyfill'; import 'vite/modulepreload-polyfill';
import '@/style.scss'; import '@/style.scss';
import 'temml/dist/Temml-Latin-Modern.css';
import { mainBoot } from './boot/main-boot'; import { mainBoot } from './boot/main-boot';
import { subBoot } from './boot/sub-boot'; import { subBoot } from './boot/sub-boot';

View File

@ -1,12 +1,12 @@
import { VNode, h } from 'vue'; import { VNode, h } from 'vue';
import * as mfm from 'cherrypick-mfm-js'; import * as mfm from 'cherrypick-mfm-js';
import * as Misskey from 'cherrypick-js'; import * as Misskey from 'cherrypick-js';
import temml from 'temml';
import MkUrl from '@/components/global/MkUrl.vue'; import MkUrl from '@/components/global/MkUrl.vue';
import MkLink from '@/components/MkLink.vue'; import MkLink from '@/components/MkLink.vue';
import MkMention from '@/components/MkMention.vue'; import MkMention from '@/components/MkMention.vue';
import MkEmoji from '@/components/global/MkEmoji.vue'; import MkEmoji from '@/components/global/MkEmoji.vue';
import MkCustomEmoji from '@/components/global/MkCustomEmoji.vue'; import MkCustomEmoji from '@/components/global/MkCustomEmoji.vue';
import MkFormula from '@/components/MkFormula.vue';
import MkCode from '@/components/MkCode.vue'; import MkCode from '@/components/MkCode.vue';
import MkGoogle from '@/components/MkGoogle.vue'; import MkGoogle from '@/components/MkGoogle.vue';
import MkSparkle from '@/components/MkSparkle.vue'; import MkSparkle from '@/components/MkSparkle.vue';
@ -350,21 +350,15 @@ export default function(props: {
} }
case 'mathInline': { case 'mathInline': {
// return [h('code', token.props.formula)]; const ret = h('math');
return [h(MkFormula, { temml.render(token.props.formula, ret)
key: Math.random(), return [ret];
formula: token.props.formula,
block: false,
})];
} }
case 'mathBlock': { case 'mathBlock': {
// return [h('code', token.props.formula)]; const ret = h('math');
return [h(MkFormula, { temml.render(token.props.formula, ret, { displayMode: true });
key: Math.random(), return [ret];
formula: token.props.formula,
block: true,
})];
} }
case 'search': { case 'search': {