Search result highlighting does not work properly in the preview mode

Steps to reproduce

  1. create a list
  2. create a backlink in the list
  3. go on writing something in the list
  4. turn on the preview mode
  5. in the search panel, search for the backlink that has been used in this page.

Expected result

the exact list item containing the backlink item is highlighted.

Actual result

the whole list is highlighted.


  • Operating system: MacOS 10.15.7
  • Obsidian version: 0.9.3

Additional information

Oct-14-2020 19-58-39


Since the block reference has been introduced since the v0.9.5, I think the preview mode and search function may attract more attention. And hope this bug can be put into graveyard soon.

I have upgraded to v0.9.6, the similar bug affects also the block-reference.

Oct-27-2020 21-13-22

The search in preview points to the markdown block not to the specific line.

Yes, I think you explained the cause of the observation.

As shown in the last GIF, the item can be referred by a block-reference.
In this way, I guess it is natural for the user to think that the item is a block. And by clicking this block-reference(linking to one item in the list), it should be the item(as a block), rather than the entire list highlighted. Only in this way, the logic within Obsidian looks self-consistent.

Considering that there is a todo list containing 100 items or sub-items. Now, I use 3-4 block-references pointing to some of the items, and I use the automatically generated block id. Noticing that in the preview mode, the block-id is invisible, in this situation, I guess it is impossible to locate the items that are refereed by these block-ids, in preview mode. And in this case, these block-references are almost useless.

I know that locating the correct items works fine in editing mode(that’s the reason why i used the wording almost above). And if you think this is the behavior that is expected, you may move this thread to the feature request area.

But if you also think this is the inconsistency in the logic introduced by using block-reference, I hope you can take this as a bug need to be fixed.

1 Like

Putting in a +1 for this. This definitely feels like a bug for me because when I ctrl click the reference to a block reference (which opens the note in edit mode), it’s only the single list item that gets highlighted. This gives me the impression that it’s possible to highlight a single line but for some reason that logic isn’t transferring to preview mode :thinking:

I see in the Release note for the 0.9.11, it says:

Search in preview now automatically selects the first result.

Does it relate to the issue discussed here?

no, it doesn’t.

I am going to archive this. Please, open a related feature request for this.

Just for completeness, the feature request has been created in: Enhance the preview mode to support search result/link highlighting in line-level granularity