1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Update to KaTeX v0.5.1

This commit is contained in:
Jermolene 2015-09-08 10:37:33 +01:00
parent 026c84197f
commit f405a89b28
49 changed files with 16 additions and 12 deletions

View File

@ -70,7 +70,7 @@ For more flexibility the KaTeX widget can also be used via the full widget synta
! Error Handling
An warning message is displayed if KaTeX detects a problem with the ~LaTeX syntax. For example:
Any LaTeX syntax errors are flagged with the problematic syntax highlighted. For example:
```
$$\displaystyle f(x) = \int_{-\infty}^\infinity\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$

View File

@ -59,7 +59,7 @@ See [[Alice in Wonderland]] for an example. Try opening it without a network con
!! Hackability Improvements
* Updated to KaTeX v0.5.0, with [[several new features|https://github.com/Khan/KaTeX/releases/tag/v0.5.0]]
* Updated to KaTeX v0.5.1, with [[several new features|https://github.com/Khan/KaTeX/releases]]
* [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/c4397792f5d396288048bcc3bb4ee8e95dbc2c5e]] added [[recent Operator]]
* [[Added|https://github.com/Jermolene/TiddlyWiki5/commit/e0aacc84d5f084ff7a53153c590fbff3d24f2e2c]] `publishFilter` to default save template
* [[Allow|https://github.com/Jermolene/TiddlyWiki5/commit/7dddc925ae93725552b98bc348a07572895da96c]] ''delete'' button to be used in the tiddler view-mode toolbar

View File

@ -44,6 +44,8 @@ Make sure to include the CSS and font files, but there is no need to include the
You can provide an object of options as the last argument to `katex.render` and `katex.renderToString`. Available options are:
- `displayMode`: `boolean`. If `true` the math will be rendered in display mode, which will put the math in display style (so `\int` and `\sum` are large, for example), and will center the math on the page on its own line. If `false` the math will be rendered in inline mode. (default: `false`)
- `throwOnError`: `boolean`. If `true`, KaTeX will throw a `ParseError` when it encounters an unsupported command. If `false`, KaTeX will render the unsupported command as text in the color given by `errorColor`. (default: `true`)
- `errorColor`: `string`. A color string given in the format `"#XXX"` or `"#XXXXXX"`. This option determines the color which unsupported commands are rendered in. (default: `#cc0000`)
For example:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -35,12 +35,13 @@ KaTeXWidget.prototype.render = function(parent,nextSibling) {
// Get the source text
var text = this.getAttribute("text",this.parseTreeNode.text || "");
// Render it into a span
var span = this.document.createElement("span");
var span = this.document.createElement("span"),
options = {throwOnError: false};
try {
if(!this.document.isTiddlyWikiFakeDom) {
katex.render(text,span);
katex.render(text,span,options);
} else {
span.innerHTML = katex.renderToString(text);
span.innerHTML = katex.renderToString(text,options);
}
} catch(ex) {
span.className = "tc-error";