Any way to auto highlight specific text?

Hi,

Does anyone know of a way, perhaps a plugin, to automatically highlight a specific text string? For example, I have some #now and #next tags in my todo lists, and I would like them to automatically turn green and orange, respectively. I don’t want to have to manually add any other markup - just looking for a way for those specific tags to be enough and when I remove them, the highlight goes away.

Thanks for any tips,
Rich

Hi @rteakin, try with a css snippet like:

.cm-s-obsidian span.cm-hashtag.cm-tag-now {
  color:green;
}
.cm-s-obsidian span.cm-hashtag.cm-tag-next {
  color:orange;
}

image

4 Likes

This worked great, thanks!

This may be enough for my needs, although I was originally intending to highlight all text on that line. I don’t imagine there is a way to do that from CSS, is there?

Thanks again for the help,
Rich

That’s great. Nevertheless I found no way to select the parent element with css

Hm, I wonder how the built-in functionality works when using == to highlight to the end of the current line, like this:

Seems to stretch until an \n char or whatever, regardless if there is a closing ==. But I suppose this is part of Obsidian’s markdown processor, and not an attribute accessible by CSS? Again my original intention was to auto highlight any line containing the #now tag, for example.

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