1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-16 23:58:54 +09:00
MisskeyIO/src/client/components/formula-core.vue

34 lines
563 B
Vue
Raw Normal View History

<template>
<div v-if="block" v-html="compiledFormula"></div>
<span v-else v-html="compiledFormula"></span>
</template>
<script lang="ts">
import Vue from 'vue';
import * as katex from 'katex';
export default Vue.extend({
props: {
formula: {
type: String,
required: true
},
block: {
type: Boolean,
required: true
}
},
computed: {
compiledFormula(): any {
2018-12-27 21:07:44 +09:00
return katex.renderToString(this.formula, {
2018-12-27 21:09:03 +09:00
throwOnError: false
2018-12-27 21:07:44 +09:00
} as any);
}
}
});
</script>
<style>
@import "../../../node_modules/katex/dist/katex.min.css";
</style>