Merge pull request #628 from gagern/pagesUpdate

Webpage: update katex to 0.7.0, show error messages
This commit is contained in:
Kevin Barabash 2017-01-15 18:12:51 -05:00 committed by GitHub
commit a4f19a4ae5
7 changed files with 27 additions and 11 deletions

View File

@ -1,6 +1,6 @@
{
"name": "KaTeX",
"version": "0.6.0",
"version": "0.7.0",
"main": [
"dist/katex.min.js",
"dist/katex.min.css"

View File

@ -16,8 +16,8 @@ KaTeX supports all major browsers, including Chrome, Safari, Firefox, Opera, and
You can [download KaTeX](https://github.com/khan/katex/releases) and host it on your server or include the `katex.min.js` and `katex.min.css` files on your page directly from a CDN:
```html
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js"></script>
```
#### In-browser rendering

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -206,3 +206,7 @@ body {
.credits a {
color: white;
}
.errorMessage {
color: red;
}

15
main.js
View File

@ -8,7 +8,20 @@ window.startup = function() {
var demoOutput = document.getElementById("demo-output");
function doDemo() {
katex.render("\\displaystyle{" + demoInput.value + "}", demoOutput);
try {
katex.render(demoInput.value, demoOutput, {
displayMode: true
});
} catch(err) {
while(demoOutput.lastChild) {
demoOutput.removeChild(demoOutput.lastChild);
}
var msg = document.createTextNode(err.message);
var span = document.createElement("span");
span.appendChild(msg);
demoOutput.appendChild(span);
span.setAttribute("class", "errorMessage");
}
}
demoInput.addEventListener("input", function() {