anki/ts/editable/Mathjax.svelte

24 lines
584 B
Svelte
Raw Normal View History

2021-08-04 01:55:39 +02:00
<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import { convertMathjax } from "./mathjax";
export let mathjax: string;
2021-08-04 04:21:35 +02:00
export let type: "inline" | "block" | "chemistry";
$: delimiters = type === "inline" ? ["\\[", "\\]"] : ["\\(", "\\)"];
$: converted = convertMathjax(`${delimiters[0]}${mathjax}${delimiters[1]}`);
2021-08-04 01:55:39 +02:00
</script>
2021-08-04 05:13:42 +02:00
<div on:click={console.log}>
{@html converted}
</div>
<style lang="scss">
div {
display: contents;
}
</style>