Global Search Result - File Navigation Doesn't Highlight Exact Text In Document

Steps to reproduce

Note: Safe mode is enabled & only the default Obsidian theme is used

  1. Add markdown file to vault that contains HTML as such:
<p>random words</p>
  1. Save & close the file
  2. Open Global Search bar and search for the term random words
  3. You should see a result pointing directly to the file created in step 1.
  4. Click on the file’s dropdown box which contains a snippet of the highlighted text that matches the search result.
  5. (a.) If the file is in edit mode, step 5 works perfectly & navigates you to the exact place in the file which contains the phrase from step 3. (b) However, if the file is in Read/Preview Mode, then performing step 5 will highlight the entire HTML file and not highlight only the phrase that was searched.

Expected result

  • I would expect that performing step 5 above with the file in Read/Preview Mode would yield the same result as step 6(a) and not just highlight the entire file’s body of text.

Actual result

  • The actual result was seen in Step 6(b) above

Environment

  • Operating system: macOS Ventura 13.2.1

Additional information

Expected Behavior (In Edit Mode)

Unexpected Behavior (In Read/Preview Mode)

Paragraphs in markdown need to have empty lines, so what you have there should be one big paragraph of HTML. Search highlights the paragraph where the result is found, so this seems to be expected behaviour.

I see, okay this makes sense because HTML is considered a markdown paragraph in read mode.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.