web: add /kripke
This commit is contained in:
20
apps/web/src/lib/components/katex.svelte
Normal file
20
apps/web/src/lib/components/katex.svelte
Normal file
@@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
import katex from "katex";
|
||||
import "katex/dist/katex.min.css";
|
||||
import type { HTMLAttributes } from "svelte/elements";
|
||||
|
||||
export interface KatexProps extends HTMLAttributes<HTMLDivElement> {
|
||||
displayMode?: boolean;
|
||||
math: string;
|
||||
}
|
||||
|
||||
let { displayMode, math, ...rest }: KatexProps = $props();
|
||||
|
||||
let katexString = $derived.by(() =>
|
||||
katex.renderToString(math, { displayMode, throwOnError: false }),
|
||||
);
|
||||
</script>
|
||||
|
||||
<div {...rest}>
|
||||
{@html katexString}
|
||||
</div>
|
||||
Reference in New Issue
Block a user