anki/ts/editable/Mathjax.svelte

27 lines
617 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;
export let block: boolean;
2021-08-04 04:21:35 +02:00
$: converted = convertMathjax(mathjax);
$: encoded = encodeURIComponent(converted);
2021-08-04 01:55:39 +02:00
</script>
2021-08-05 22:18:40 +02:00
<img src="data:image/svg+xml,{encoded}" class:block alt="Mathjax" data-anki="mathjax" />
2021-08-04 05:13:42 +02:00
<style lang="scss">
img {
vertical-align: middle;
&.block {
display: block;
margin: auto;
}
2021-08-04 05:13:42 +02:00
}
</style>