[based on 0.4.1] Fix dynamic updates in reading mode & remove targetDisplay
in MathLinksRenderChild
#37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I propose two options for resolving #35.
targetDisplay
inMathLinksRenderChild
#36Please choose the one you prefer (if exists).
Common modification
Both 1 & 2 have the following modification in common:
In
MathLinksRenderChild.update()
,targetDisplay
should be replaced withthis.displayText
because the former is overwritten whenmathLink
is updated but the latter remains untouched.Having
targetDisplay
seems to do little harm for mathLinks registered via the YAML frontmatter, but it is problematic for API mathLinks.Changes specific to this PR
There's not much of it.
I'm not sure why the delay when opening files (the issue you've addressed in the latest release) is happening so there wasn't a lot that I can do for fixing it.
The only possible reason for the delay that I've came up with was that I was
await
ing for every piece of inline math inrenderTextWithMath
:obsidian-mathlinks/src/links.ts
Line 100 in af275b5
So I tried to change it so that it calls
finishRenderMath
only once:https://github.com/RyotaUshio/obsidian-mathlinks/blob/a2a5fff8118640bc206811ef30c3c36d0d12ea61/src/links.ts#L104
P.S. In this PR, there is no
mathLink-internal-link
/``original-internal-link"` classes, unlike in #36 .