mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 11:48:41 +00:00
As babelify is slow, it may be desriable to not run it during development. This is OK if the browser is recent enough to understand ES6 natively. (This does not include current Firefox due to it having problems with for(const … in …), https://bugzilla.mozilla.org/show_bug.cgi?id=1094995.) For older browsers, or to check issues possibly introduced by babelify, adding /babel as the first component of the path will switch to a version which has been processed by babelify. This is also used for screenshots.
57 lines
1.6 KiB
HTML
57 lines
1.6 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;
|
|
}
|
|
@font-face {
|
|
font-family: "Mincho";
|
|
src: url("unicode-fonts/mincho/font_1_honokamin.ttf") format("truetype");
|
|
}
|
|
@font-face {
|
|
font-family: "Batang";
|
|
src: url("unicode-fonts/batang/batang.ttf") format("truetype");
|
|
}
|
|
.katex .cjk_fallback {
|
|
font-family: "Mincho",serif;
|
|
}
|
|
.katex .hangul_fallback {
|
|
font-family: "Batang",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");
|
|
|
|
var settings = {
|
|
displayMode: !!query["display"],
|
|
throwOnError: !query["noThrow"]
|
|
};
|
|
if (query["errorColor"]) {
|
|
settings.errorColor = query["errorColor"];
|
|
}
|
|
|
|
katex.render(query["tex"], mathNode, settings);
|
|
document.getElementById("pre").innerHTML = query["pre"] || "";
|
|
document.getElementById("post").innerHTML = query["post"] || "";
|
|
</script>
|
|
</body>
|
|
</html>
|