One of the comments in that thread though said " You can’t select elements with a specific text inside via CSS. What you can do though is to via jQuery look for that element and then add a class to it, so that you then can select it via CSS.
$("span:contains('I am special')").addClass('hide');
And then in CSS
.hide{
display:none;
}
What I’m trying to do
I’m trying to select a <span> with a certain content, like <span>I'm special</span> so I can color its background or otherwise make it stand out.
I’m looking for something like
.span[text="I am special"] { color=red !important; }
My question would be, can I do something like this with Obsidian styles? I know very little JQuery beyond limited examples from a class a long time ago.
Only with css i dont think it is possible, only in especifics cases, the obsidian transform markdown in html when is in view mode so somethimes contents like links can be especified by the values that it contains.
Why:
In a link is obligatory to have a href so you can especify in the css by using the value in href.
But if the compiled html version does not have a point to be specified is not possible to select one alone.
I understand tha for pure CSS this is impossible, as per the quoted post I provided, but I was wondering if there were a way to use javascript somehow. Maybe I’m leaving the land of sanity here.
I guess what I’m really trying to do is color a string of text that I use a lot. I don’t really care how. Right now I use a hotkey with Shell Commands on a selected string to wrap it in html. Not elegant but it works.