Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
feat: arnog#387 (cont.) Added replace() method
Browse files Browse the repository at this point in the history
  • Loading branch information
arnog committed Nov 17, 2020
1 parent c721fbe commit 8729088
Show file tree
Hide file tree
Showing 15 changed files with 684 additions and 237 deletions.
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,27 @@
the fractions in the expression:

```javascript
mf.find(new RegExp(/^\\frac{[^}]_}{[^}]_}\$/)).forEach((x) =>
mf.applyStyle({backgroundColor: "yellow"}, x, {
suppressChangeNotifications: true
mf.find(/^\\frac{[^}]*}{[^}]*}\$/).forEach((x) => {
mf.applyStyle({ backgroundColor: 'yellow' }, x, {
suppressChangeNotifications: true,
});
});
```

- **#387** `replace()` method to replace fragments of an expression.

This method is similar to the `replace()` method of the `String` class.
The search pattern can be specified using a string or regular expression, and
the replacement pattern can be a string or a function.
If using a regular expression, it can contain capture groups, and those
can be references in the replacement pattern.

The following snippet will invert fractions in a formula:

```javascript
mf.replace(/^\\frac{([^}]*)}{([^}]*)}$/, '\\frac{$2}{$1}');
```

- New **Latex Mode**

This mode replaces the previous **Command Mode**. While the **Command Mode**
Expand Down
Loading

0 comments on commit 8729088

Please sign in to comment.