mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-16 23:17:33 -07:00
34 lines
618 B
Vue
34 lines
618 B
Vue
|
|
<template>
|
|
<div v-if="block" v-html="compiledFormula"></div>
|
|
<span v-else v-html="compiledFormula"></span>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent } from 'vue';
|
|
import * as katex from 'katex';import * as os from '@client/os';
|
|
|
|
export default defineComponent({
|
|
props: {
|
|
formula: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
block: {
|
|
type: Boolean,
|
|
required: true
|
|
}
|
|
},
|
|
computed: {
|
|
compiledFormula(): any {
|
|
return katex.renderToString(this.formula, {
|
|
throwOnError: false
|
|
} as any);
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style>
|
|
@import "../../../node_modules/katex/dist/katex.min.css";
|
|
</style>
|