Search doesn't always work when text has a HTML style

Dear Obsidian developers,
I am writing to you to provide feedback on a functionality flaw that I have encountered while using your application. I have noticed that when I use the search function on Obsidian and input a text that has some parts styled using markdown(such as text color\size), the search function fails to locate the file containing that phrase. I believe this issue may have been caused by the styling settings dividing the text into separate sections, thus making it impossible for the search function to recognize the whole phrase.
As an avid user of Obsidian, I find this functionality flaw quite frustrating, as it hinders my ability to organize and search through my notes effectively. I don`t know if this is actually a feature flaw or just because of my poor knowledge about the seach function. I hope that you can address this issue as soon as possible to improve the overall user experience of your application.
Thank you for your attention to this matter, and I look forward to your prompt response.
Best regards

Can you post an example of something (from your note) that’s not working in Search?

this is an example:
in the following sentence, some texts were styled while others were not:

you can find<“font color=”#ffc000">good pictures</font"><“span style=“background:#93bfcf”>or good movies</span”>

When I tried to search tfor “good pictures or good movies”, When I tried to search for “good pictures or good movies,” I failed to find anything that satisfied me.
You can only search for “good pictures” or “good movies”, which are surrounded by style identifiers, can not search the texts combine them

Have a look at the official search documentation page.

I tried a few different search variations, and the note was returned for each one. Maybe I’m unclear on what you are expecting search to return. This is a fairly empty test vault, but the note was returned in my main vault as well (with a bunch of others).

The context box under the note name doesn’t render markdown (or html). There’s a feature request for markdown rendering in Search and Backlinks →

1 Like

Switch to ‘read’ mode (right side of the image below) and you can search for all the words.

The HTML syntax needs to be correct:

``HTML
You can find <font color="#ffc000">good pictures</font> <span style="background:#93bfcf">or good movies</span>
```

1 Like

Oh, good angle @anon63144152. The first post mentioned

and I didn’t even think about search within a note.

1 Like

Searching for a restricted contiguous phrase doesn’t work (because of the HTML, I assume), but an unrestricted search of all the words does work from the sidebar or in the note.

Seems to help if the HTML and text validates. :face_with_peeking_eye:

1 Like

Original text:

you can find<“font color=”#ffc000">good pictures</font"><“span style=“background:#93bfcf”>or good movies</span”>

And in the OP’s text, there is no space between ‘find’ and ‘good’, or between ‘pictures’ and ‘or’, so the phrase “good pictures or good movies” is not actually in the file.

The HTML also doesn’t validate in the sample provided.

Yeah, I noticed the issues in the original example, but took it as is.

Hopefully us digging in a bit helps!

2 Likes

I apologize for the incorrect HTML syntax I posted. If it was correct, it would have rendered instead of displaying the syntax,so I change the syntax to show the raw sytax :laughing:,so sorry made a misunderstanding. This is my first time using the forum, and I am sorry for any mistakes I have made.
Perhaps the issue is not well-explained; please refer to the following pictures.
your solution can solve the sentence with spaces,but can not solve the issues that arise in Chinese.
By the way , the issues occur in a note and official page




@ariehen @anon63144152 forget to@ you

Have a look at the forum code formatting tips for next time. :face_with_monocle:

It looks like you are using the Obsidian editing toolbar and you’ve got a lot of HTML mixed in together with the Markdown in your notes.

I pasted the below into a note:

<span style="background:#93bfcf">揯æ čæźéœ€èŠ</span>[[æŽ§ćˆ¶ć‡șć…„]]

Screen Shot 2023-04-07 at 19.13.01

I think, if you want to continue to use all the HTML in your notes, you’ll have to refine your searches (adding spaces, etc) to work around it. While HTML works in notes, there is little in the help documentation about it and I don’t think it’s a priority.

1 Like

Thank you so much! I will learn from the forum code formatting tips.
In this example use space is available , but maybe we can not remember to set spaces in the correct place everytime. So maybe this is really a problem need to be solved by fixing the search function? So I think if obsidian developers can change the search rule, such as ignore the HTML syntax, it will be easier to use all kinds of HTML style without worrying about the search problem.

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