这是我的代码(Svelte 5、sveltekit、tailwind):
<script lang="ts">
import MarkdownIt from 'markdown-it';
import markdownItKatex from 'markdown-it-katex';
import 'katex/dist/katex.min.css';
const md = new MarkdownIt({ html: false, linkify: true, typographer: true });
md.use(markdownItKatex, { throwOnError: false, errorColor: ' #cc0000' });
function renderMarkdown(content: string) {
return md.render(content);
}
let content: string = '$a^2+b^2=c^2$';
</script>
<h1>markdown-it-katex</h1>
<div>{@html renderMarkdown(content)}</div>
<style>
</style>
我的输出是:
a2+b2=c2
但是数字 (2) 被降低了(下标)。我怎样才能使数字变成上标?