Skip to content

Commit

Permalink
All: Resolves #1105: Added support for macro persistence for Katex
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Feb 28, 2019
1 parent 1adbbd1 commit 4363005
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ReactNativeClient/lib/MdToHtml_Katex.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ class MdToHtml_Katex {
constructor() {
this.cache_ = {};
this.assetsLoaded_ = false;

// Keep macros that persist across Katex blocks to allow defining a macro
// in one block and re-using it later in other blocks.
// https://github.com/laurent22/joplin/issues/1105
this.macros_ = {};
}

name() {
Expand All @@ -24,6 +29,7 @@ class MdToHtml_Katex {
} else {
renderered = katex.renderToString(content, {
displayMode: tagType === 'block',
macros: this.macros_,
});
this.cache_[cacheKey] = renderered;
}
Expand Down

0 comments on commit 4363005

Please sign in to comment.