I would like to use KATEX to convert a Latex expression into a HTML element. I just want the HTML element and no window. I have found that the pywebview library is a lightweight webviewer that is capable of evaluating javascript expressions.
From the documentation, instantiating a webview always results in a window. Is it possible to run the webview in windowless mode so that a javascript funtion from the KATEX library can be called?
The javascript function would be something like:
var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", {
throwOnError: false
});
The files main.py and demo1.html are below:
#main.py
import webview
window = webview.create_window('Hello world', 'demo1.html')
webview.start()
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="katex/katex.css" >
<script defer src="katex/katex.min.js" ></script>
</head>
<body>
</body>
</html>