mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 11:48:41 +00:00
Escaping TeX in JSON as query strings is a pain: you have to double all the \\, you have to escape the & and the #, you can't easily include line breaks for readability, and so on. YAML solves most of these problems for most of the situations. Now each test case can be structured, while simple test cases only consist of a line of verbatim TeX code, with no escaping. The most troublesome items remaining are lines starting in { since in YAML these would denote inline mapping types. We use block notation for these.
36 lines
1.0 KiB
HTML
36 lines
1.0 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>Screenshotter test</title>
|
|
<script src="/katex.js" type="text/javascript"></script>
|
|
<link href="/katex.css" rel="stylesheet" type="text/css">
|
|
<style type="text/css">
|
|
#math, #pre, #post {
|
|
font-size: 4em;
|
|
}
|
|
body {
|
|
font-family: "DejaVu Serif",serif;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<span id="pre"></span>
|
|
<span id="math"></span>
|
|
<span id="post"></span>
|
|
<script type="text/javascript">
|
|
var query = {};
|
|
var re = /(?:^\?|&)([^&=]+)(?:=([^&]+))?/g;
|
|
var match;
|
|
while (match = re.exec(window.location.search)) {
|
|
query[match[1]] = decodeURIComponent(match[2]);
|
|
}
|
|
var mathNode = document.getElementById("math");
|
|
katex.render(query["tex"], mathNode, {
|
|
displayMode: !!query["display"]
|
|
});
|
|
document.getElementById("pre").innerHTML = query["pre"] || "";
|
|
document.getElementById("post").innerHTML = query["post"] || "";
|
|
</script>
|
|
</body>
|
|
</html>
|