nothingislost/obsidian-hover-editor

Bug report: Block reference previews have poor support for long documents

DanShui-Yu opened this issue · 7 comments

When previewing a block reference link from a long document (over 100,000 words), it always shows the beginning of the document but not the block positioned by the blockID, regardless of whether I hold down the ctrl key and how long I wait.

pjeby commented

Can you upload a note that has the problem with step-by-step instructions for how to reproduce the issue? I'm having trouble understanding exactly what you mean. For example, you say "a block reference link from a long document", but some of what you say sounds like you mean a link to a block in a long document?

It also sort of sounds like maybe you're describing something that's an Obsidian problem - namely that while Hover Editor can ask for Obsidian to scroll to a heading or block, Obsidian sometimes has challenges with this in source/live preview mode because of the way it handles formatting, especially in long documents. So I need to know if you are in reading mode or editing mode, both in the document where you're hovering the link, and in your settings for how the Hover Preview is displayed. Thanks.

pjeby commented

(Also, to be clear, by "upload" I mean attaching a file to your reply, not pasting it in the comment -- I don't think Github will handle a 100k-word comment well. 😁 )

but some of what you say sounds like you mean a link to a block in a long document

Yes, that's what I mean, sorry for the poor expression.

So I need to know if you are in reading mode or editing mode

The results are the same in both modes. The reason why I think there is a bug in hover editor is because when I close hover editor but use only the native page preview core plug-in, I can locate the original block very quickly and accurately.

image

image

And these are the two files in the images above.

003-新修本草.md

天麻整理.md

Hover editor Settings are the default.

image

pjeby commented

Interesting. For me, it goes to the correct location after about 5 or 6 seconds (no need to hold Ctrl). If Hover Editor is set to Editing View as the default mode, however, it comes up instantly. What Obsidian version are you using? (I'm on 1.4.16)

For me, it goes to the correct location after about 5 or 6 seconds (no need to hold Ctrl).

I tried to wait longer, sorry about the "no matter how long" description, and it did go when I didn't hold Ctrl for more than half a minute (but the wait time was a little too long, and there wasn't any hint). I tested more links and it seemed that the wait time was related to the word count of the original document, with another block link from a document of over 1.3 million words taking two minutes to showed up.

Another strong correlation is the number of plug-ins. The above was tested in my sublibrary with single digits plugins, and when I tried to view the block link preview in my main library with 92 plugins, I waited for over an hour without jumping... (Too impatient to wait any longer)

If Hover Editor is set to Editing View as the default mode, however, it comes up instantly.

I tried it, and it did. But somehow some of the links are offset down a few lines, and I had to scroll to find them.

I'm on 1.4.16 too.

pjeby commented

So, I tried switching to Reading View and clicking on the problematic link rather than hovering it, and found that Obsidian navigates to the location just as slowly: i.e., this is a problem with navigating to a location in a large document open in Reading View in Obsidian, and as far as I can tell, entirely unrelated to Hover Editor.

I would suggest reporting this as an Obsidian bug/performance issue, since I would guess you'll be able to reproduce the problem in the sandbox without any plugins at all: just using the two notes and clicking between them. If the link click works without a delay, then Hover Editor should do the same.

(Note, by the way, that the reason it's fast in Obsidian's built-in preview is because when you preview a heading or block, Obsidian loads only that part of the note; Hover Editor on the other hand is just a floating tab, which means it behaves just like if you clicked on the link to open in a new tab, except that the tab is floating in its own pseudo-window. So it has exactly whatever features or bugs Obsidian would have upon clicking a link into a new tab.)