RyotaUshio / obsidian-latex-theorem-equation-referencer

A powerful indexing & referencing system for theorems & equations in your Obsidian vault.
https://ryotaushio.github.io/obsidian-latex-theorem-equation-referencer/
MIT License
147 stars 6 forks source link

2.0.0-beta4: Live preview fails to auto-number theorems correctly when note is long enough #192

Closed RyotaUshio closed 7 months ago

RyotaUshio commented 7 months ago

This is because CodeMirror doesn't render elements outside the viewport. They're not just not updated, they do not exist in the first place.

RyotaUshio commented 7 months ago

One obvious solution would be holding a state field representing the position of theorem callouts at each moment. (The index data cannot be used because it might be outdated by 2 sec)

RyotaUshio commented 7 months ago

Another solution is counting auto-numbered theorem callouts outside (or more specifically, before) the viewport from the index. While the viewport can change rapidly, the position of theorem callouts located before the viewport can be expected not to change, maybe?

This approach is not acceptable since it is possible that exactly the same document is opened in two different panes and one adds a theorem far outside the viewport of the other.

(it's ok if we can tolerate a small lag < 2 sec)