mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Error handling for KaTeX plugin
This commit is contained in:
parent
61af1f9379
commit
b3df07ae3e
@ -63,3 +63,14 @@ For more flexibility the KaTeX widget can also be used via the full widget synta
|
||||
```
|
||||
|
||||
<$latex text="\displaystyle f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi"></$latex>
|
||||
|
||||
! Error Handling
|
||||
|
||||
An warning message is displayed if KaTeX detects a problem with the ~LaTeX syntax. For example:
|
||||
|
||||
```
|
||||
$$\displaystyle f(x) = \int_{-\infty}^\infinity\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$
|
||||
```
|
||||
|
||||
$$\displaystyle f(x) = \int_{-\infty}^\infinity\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$
|
||||
|
||||
|
@ -36,7 +36,12 @@ KaTeXWidget.prototype.render = function(parent,nextSibling) {
|
||||
var text = this.getAttribute("text",this.parseTreeNode.text || "");
|
||||
// Render it into a span
|
||||
var span = this.document.createElement("span");
|
||||
katex.render(text,span);
|
||||
try {
|
||||
katex.render(text,span);
|
||||
} catch(ex) {
|
||||
span.className = "tc-error";
|
||||
span.textContent = ex;
|
||||
}
|
||||
// Insert it into the DOM
|
||||
parent.insertBefore(span,nextSibling);
|
||||
this.domNodes.push(span);
|
||||
|
Loading…
Reference in New Issue
Block a user