web: add /kripke

This commit is contained in:
2025-02-18 05:24:54 +09:00
parent 6d262460f2
commit 7a81594a86
5 changed files with 75 additions and 5 deletions

View 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>