带有 nuxt-content 的 Nuxt v3:如何在 Markdown 中渲染数学方程?

问题描述 投票:0回答:2

我有一个使用 Nuxt 的新 nuxt 内容网站([email protected] 和 @nuxt/[email protected]),并且希望使用常用的

$...$
语法从我的 Markdown 文件中渲染数学方程。我需要添加什么才能获得 katex(或任何)数学渲染?

nuxtjs3 katex nuxt-content
2个回答
0
投票

你能找到什么吗?我也在寻找这个解决方案。


-1
投票

一个简单的解决方案可能是使用 MDC(Markdown 组件),这样您就可以在 Markdown 中渲染任何 Vue 组件。创建一个通用的 MathRender.Vue 组件,然后传递 md 文件中的所有数据并根据您的意愿在 Vue 文件中渲染。

文档链接

示例.md 文件

::card
The content of the card
::

卡.vue

<template>
  <div class="p-6 border bg-white dark:bg-black dark:border-gray-700 rounded">
    <slot />
  </div>
</template>
© www.soinside.com 2019 - 2024. All rights reserved.