mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-20 01:58:41 +00:00
KaTeX website & documentation (#1484)
* website/docs: initial commit * Change secondaryColor * Fix index.css not being copied and included on global stylesheet * Fix stylesheet link [skip ci] * Change documentation link to API(Usage) [skip ci] * Add `Libraries` in usage [skip ci] * Remove documentation from `README.md` and add link to the site [skip ci] * Use KaTeX in the parent directory to build Markdown [skip ci] * Revise function support page. Avoid error msgs. * General edit to function support page
This commit is contained in:
committed by
Kevin Barabash
parent
83e8eac0a5
commit
8a38035855
32
website/static/js/index.js
Normal file
32
website/static/js/index.js
Normal file
@@ -0,0 +1,32 @@
|
||||
window.startup = function() {
|
||||
var tex = document.getElementsByClassName("tex");
|
||||
Array.prototype.forEach.call(tex, function(el) {
|
||||
katex.render(el.getAttribute("data-expr"), el);
|
||||
});
|
||||
|
||||
var demoInput = document.getElementById("demo-input");
|
||||
var demoOutput = document.getElementById("demo-output");
|
||||
|
||||
function doDemo() {
|
||||
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() {
|
||||
doDemo();
|
||||
});
|
||||
|
||||
doDemo();
|
||||
};
|
Reference in New Issue
Block a user