16 lines
408 B
Vue
16 lines
408 B
Vue
<script setup lang="ts">
|
|
import { renderMath } from 'comark/plugins/math';
|
|
|
|
const props = defineProps<{
|
|
content: string;
|
|
display: boolean;
|
|
}>();
|
|
|
|
const html = computed(() => renderMath(props.content, props.display, { throwOnError: false }));
|
|
</script>
|
|
|
|
<template>
|
|
<span v-if="!display" class="math-inline" v-html="html"></span>
|
|
<div v-else class="math-block" v-html="html"></div>
|
|
</template>
|