zhaoshenzhai / obsidian-mathlinks

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

Fixed the bug where a link is not added to the state field when the cursor is overlapping with it #58

Closed RyotaUshio closed 1 year ago

RyotaUshio commented 1 year ago

Steps to reproduce

  1. Turn off MathLinks
  2. In Live preview, place the cursor on a link and turn on MathLinks
  3. The link that the cursor was put on is not rendered until the next document change (i.e. text insertion/deletion)

This happened because in the buildField function, a link that has an overlap with the current cursor is not added to the range set. This kind of cursor handling is done separately by the view plugin, so this wasn't necessary.