mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-12-10 02:38:06 +00:00
Merge pull request #2154 from spelufo/katex-displaymode
Revert katex plugin to using `$$`. Use multiline for display mode.
This commit is contained in:
@@ -29,13 +29,13 @@ exports.types = {inline: true};
|
||||
exports.init = function(parser) {
|
||||
this.parser = parser;
|
||||
// Regexp to match
|
||||
this.matchRegExp = /\$\$\$?(?!\$)/mg;
|
||||
this.matchRegExp = /\$\$(?!\$)/mg;
|
||||
};
|
||||
|
||||
exports.parse = function() {
|
||||
// Move past the match
|
||||
this.parser.pos = this.matchRegExp.lastIndex;
|
||||
var reEnd = /\$\$\$?/mg;
|
||||
var reEnd = /\$\$/mg;
|
||||
// Look for the end marker
|
||||
reEnd.lastIndex = this.parser.pos;
|
||||
var match = reEnd.exec(this.parser.source),
|
||||
@@ -44,7 +44,7 @@ exports.parse = function() {
|
||||
// Process the text
|
||||
if(match) {
|
||||
text = this.parser.source.substring(this.parser.pos,match.index);
|
||||
displayMode = match.indexOf('$$$') != -1;
|
||||
displayMode = text.indexOf('\n') != -1;
|
||||
this.parser.pos = match.index + match[0].length;
|
||||
} else {
|
||||
text = this.parser.source.substr(this.parser.pos);
|
||||
|
||||
@@ -6,7 +6,7 @@ The usual way to include ~LaTeX is to use `$$`. For example:
|
||||
$$\displaystyle f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi$$
|
||||
```
|
||||
|
||||
To make math render in display mode, use `$$$` instead of `$$`.
|
||||
Single line equations will render in inline mode. If there are newlines between the `$$` delimiters, the equations will be rendered in display mode.
|
||||
|
||||
The underlying widget can also be used directly, giving more flexibility:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user