zhaoshenzhai / obsidian-mathlinks

An Obsidian.md plugin to render MathJax in your links.
MIT License
60 stars 4 forks source link

Dynamic update is broken in ver. 0.4.2 for reading mode #35

Closed RyotaUshio closed 1 year ago

RyotaUshio commented 1 year ago

Hi, it seems that the dynamic update introduced in ver. 0.4.1 is not working for reading mode in ver. 0.4.2. (live preview seems to be fine)

I will inspect it when I have time, but it seems like this is caused by the modified implementation of MathLinksRenderChild.update().

As a quick fix, i tried

        if (mathLink) {
            console.log("new mathlink:", mathLink);
            this.containerEl = addMathLink(mathLink, this.containerEl, true);
            // addMathLink(mathLink, this.containerEl, true);
        } else {
            this.containerEl = addMathLink(this.displayText, this.containerEl, true);
            // addMathLink(this.displayText, this.containerEl, true);
        }

in the last part of update(), and it worked. But I feel this might induce another problem... (I'm not sure though) So keep in mind this is just experimental.

zhaoshenzhai commented 1 year ago

Hi! Thanks for pointing it out, it appears I haven't tested it thouroughly Also, I should've consulted this change with you before releasing it; apologies for the headache.

I will address the solutions you proposed in their respective PRs.

RyotaUshio commented 1 year ago

Thanks for the quick reply, as always. No need for apologies! This is your plugin.