diff options
Diffstat (limited to 'src/components/Latex.astro')
| -rw-r--r-- | src/components/Latex.astro | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/components/Latex.astro b/src/components/Latex.astro new file mode 100644 index 0000000..f335189 --- /dev/null +++ b/src/components/Latex.astro @@ -0,0 +1,18 @@ +--- +import katex from 'katex'; + +const { formula = '' } = Astro.props; +const html = katex.renderToString(formula, {throwOnError: false}); +--- + +<div class="text-center"> + <span set:html={html} class="" /> +</div> + +<link + rel="stylesheet" + href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.css" + integrity="sha384-WsHMgfkABRyG494OmuiNmkAOk8nhO1qE+Y6wns6v+EoNoTNxrWxYpl5ZYWFOLPCM" + crossorigin="anonymous" +/> + |
