Reputation: 1404
I can't setup KaTeX. It works if I load KaTeX remotely, but it refuses to work locally. Here is my code:
<!DOCTYPE html>
<html>
<head>
<link href="katex/katex.min.css" rel="stylesheet" type="text/css">
<script defer src="katex/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous"></script>
<script
defer
src="katex/auto-render.min.js"
integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI"
crossorigin="anonymous"
onload="renderMathInElement(document.body);"
></script>
</head>
<body>
<div id="el"><span>$$2+\frac{1}{x}$$</span></div>
</body>
</html>
What can be the reason for not working? If I paste paths of remote files of KaTeX, it works perfectly.
Upvotes: 2
Views: 631
Reputation:
Remove integrity
and crossorigin
. And by default the auto-render.min.js is located inside contrib folder, But you did not path it to katex/contrib/auto-render.min.js and you path it to katex/auto-render.min.js. So make sure where the auto-render.min.js is located. if auto-render.min.js is located inside the contrib folder the below code would work.
<!DOCTYPE html>
<html>
<head>
<link href="katex/katex.min.css" rel="stylesheet" type="text/css">
<script defer src="katex/katex.min.js"></script>
<script defer src="katex/contrib/auto-render.min.js"
onload="renderMathInElement(document.body);"></script>
</head>
<body>
<div id="el"><span>$$2+\frac{1}{x}$$</span></div>
</body>
</html>
Upvotes: 3