Highlighting text between {curly brackets}

I use a snippet to highlight text, as I find it easier to navigate my text quicker then.

These started out with @pseudometa’s Shimmering Focus theme, though he removed some of them, such as turning italic text green, bold blue. I just added something that turns text in [square brackets] orange. I’d like to add something like that for {curly brackets} but when I try using the inspector, that text just comes up as regular text.

Does this mean there’s no way to add color here?

to be more specific, I just switched to using LaTeX style citations, and I’d like these to be better visible. These look like this: \footcite[5]{Smith2020}
This gets rendered as Chicago Author-Date (for me): Smith 2020, 5

Is there a way to highlight the whole citation?

Any other ideas?
Thanks!

As long as they’re not considered elements by CSS, you can’t style them easily. In don’t think cyrly braces are parsed into elements by Obsidian.

That’s what I was afraid of. Thanks though!!

You can use the Dynamics highlights plugin to define your own highlights for that with a basic regex:

(if you are not familiar with regex, it is quite beneficial to learn it, since it allows you to do all sorts of things, and is a widely supported standards across many apps.)

Awesome, I’ll look into that :slight_smile: Thank you for point that out!

Another quick question: According to regexr.com this should work: (?<=\\)(.*?)(?=\}), i.e. it should highlight everything between a backslash \ and a }, so that \cite{Smith2020} would be highlighted.

The plugin doesn’t like that though. When I do it via the GUI nothing happens, but when I try importing a highlighter, using the template from the github page:

{
 "TeX-Cite-highlight": {
   "class": "TeX-Cite-highlight",
   "color": "#77787C4A",
   "regex": true,
   "query": "(?<=\\)(.*?)(?=\})",
   "mark": [
     "match",
     "group"
   ],
   "css": ""
 }
}

I get the error: Error importing highlighters: SyntaxError: Unexpected token } in JSON at position 138.

So it seems that the escape character isn’t read?

I’ve also tried this: \\(.*?)\} but with the same result. Again according to that regexr website it should work.

It’s not just curly brackets btw. It also can’t escape )

Any ideas?

I tried the plugin briefly, and I couldn’t get it to match bare words, so I’m not sure if it’s compatible with the current version of Obsidian.

In addition, if it works, it says something about not working in reading and/or preview mode, which I’m unsure what it actually means. How much would that effect it in your case? For me, it was a show stopper in addition to not matching my regex nor bare words.

I think it means that it currently only works in Live Preview mode, as far as I can tell. Which would be fine, as I just want to be able to quickly tell where I’m citing something. But yes, I agree that it doesn’t appear to work right now. Thanks for confirming that!

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