Enhance the preview mode to support search result/link highlighting in line-level granularity

This is a merged feature request(merging feature request from @malecjan at OnClick on search result: Scroll to matched text also in Preview mode )

Use case or problem

When doing the search, the content within the .md file corresponding to the the search result is highlighted.

In the edit mode, the exact line within the .md file corresponding to the the search result is highlighted.

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

This is annoying when one tries to locate an item in a long list, and this scenario is shown as in the following gif.

Oct-14-2020 19-58-39

Similar situation was also observed by @malecjan, in

Moreover, the backlinks in the preview mode are also victims, as you can alway not be able to locate the item in a list.

Oct-27-2020 21-13-22

And FYI:
@WhiteNoise suggested that this is better to be posted here as a new feature request.

Proposed solution

The search result/link highlighting in editor mode supports the line-level granularity. Some alignments may be performed.

Current workaround (optional)

Quit preview mode and using the editor mode.
And I have to say, this may impact the workflow: as the picture will not shown in the editor mode, additional switching actions are expected.

Related feature requests (optional)

3 Likes

Edit: @GLight Thank you for merging this with my related request / bug report.

To developers: when implementing this, please make sure to unfold the quotation of my report in the post above, or look directly at OnClick on search result: Scroll to matched text also in Preview mode. It shows issue of the matched text actually being scrolled out of view, which is exactly opposite of the intent to move it into view and highlight. That deserves fixing (after higher priorities). Thanks

Hi, @malecjan,

thank you for your suggestion.

I have updated the feature request as a merged feature request and quote your observation in the part related to the search result pointing.

Do you think this merged version is fine to you?

1 Like

will be implemented in v0.11

1 Like

Thank you!
I’m looking forward to this. And I’ll definitely support this new feature!

Single line breaks make new lines in Obsidian, but highlighting still only works on paragraph/block granularity. This is not solved @WhiteNoise

For clarification:
I think this feature request is mainly about the enhancement for representing the matched item within a list in the preview mode.

Maybe the issue that you proposed is another feature request?

Ok, it was not clear to me based on the title. I opened a new request for those interested.