Files
KaTeX/static/module.html
ylemkimon fdb155aa97 Build ECMAScript modules (#1479)
* Separate type import statement from module import statement

* Remove extension from import statements

* Build ECMAScript modules

* Add `cross-env` devDependency

* Use `babel-plugin-import-rename` instead of custom plugin

* Improve `.babelrc` style and add comments

* Update README.md

* Change file extension to `.mjs`

Comply with Node.js spec. Use extensionless package:main.

* Enforce only ESM compatible imports

* Dedupe packages

* Add `unicodeMake.js` to overrides:excludedFiles

* Fix .eslintrc merge conflict

* Use rollup to bundle ES module

* Remove `eslint-plugin-import`

* Change build directory to `dist`

* Change build directory to `dist`

* Change build directory

* Move docs from README.md to browser.md

* Update update-sri.js

* Revert update-sri.js

* Revert update-sri.js

* Update .eslintrc

* Remove SSH key testing
2018-08-13 13:06:40 +09:00

43 lines
1.4 KiB
HTML

<!DOCTYPE html>
<!--To test ECMA modules, run `npm run build` and then `npm start`
in the root KaTeX directory and then visit with a web browser
which supports modules: http://localhost:7936/module.html
-->
<html>
<head>
<meta charset="UTF-8">
<title>KaTeX Test</title>
<link rel="stylesheet" type="text/css" href="/dist/katex.css">
<link rel="stylesheet" type="text/css" href="/main.css">
<script type="module" type="text/javascript">
import katex from '/dist/katex.mjs';
const input = document.getElementById("input");
const math = document.getElementById("math");
input.addEventListener("input", reprocess, false);
reprocess();
function reprocess() {
try {
katex.render(input.value, math, {displayMode: true, throwOnError: false, macros: {}});
} catch (e) {
if (e.__proto__ === katex.ParseError.prototype) {
console.error(e);
} else {
throw e;
}
}
}
</script>
</head>
<body>
<textarea id="input" rows="5">
\left( x \right) \left( x^2 \right) % comment
\left( \frac{a}{b} \right) \left( \frac{a^2}{b} \right)
\left( \dfrac{a}{b} \right) \left( \dfrac{a^2}{b} \right)
</textarea>
<div id="math"></div>
</body>
</html>