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
162 stars 6 forks source link

Markdown Links aren't rendered or created properly #175

Closed aidanlw505 closed 1 year ago

aidanlw505 commented 1 year ago

The first pair of links are ones I created by typing [[. One with the "Use [[WikiLinks]]" option disabled to use markdown links. The second pair are links created by typing \eqref, again with one created while not using wikilinks.

image

image

The first problem is that [](#^881de2) doesn't get rendered with equation number. The second issue is that when creating a reference using \eqref, the filename is added as linktext.

RyotaUshio commented 1 year ago

Thanks for reporting.

As for the first one ([](#^block-id)), this behavior is by the design of MathLinks (the plugin that Math Booster relies on when displaying links to equations/theorems). Roughly speaking, given a markdown link [A](B), MathLinks thinks that you want to use A as the displayed text for that link when A differs from B. In this case, it guesses you want to use an empty string "" rather than the equation number. So, it doesn't show you the equation number, respecting "your choice."

One possible solution to this issue will be to request MathLinks to treat the case where A is an empty string as an exception. Will it be useful? Personally, I don't use markdown links (except for external links), so I'm not sure if this makes things better or not. So please share your thoughts about it.

The second one ([note title](#^block-id)) seems to be an upstream bug of Obsidian API rather than this plugin. I've reported it on the forum.

RyotaUshio commented 1 year ago

A currently available workaround for this problem is to put #^blockID in the [ ], as shown in the image below.

image

I know it's not a clean solution, but this way you can display equation numbers even when using markdown links.

image

But seemingly, it only works in live preview. MathLinks might have a bug in the reading view. I will take a look at it later.

RyotaUshio commented 1 year ago

Update: From the next release on, \ref & \eqref will insert wikilinks regardless of the user's Use [[Wikilinks]] setting. Please use this auto-completion for theorems or equations if you want to keep using markdown links for other links.

It would be great if this plugin (and MathLinks) could support markdown links, but they are not suitable in this case because they are bad (or terrible) at dynamic updates.