So your solution works, but I found a better one. I got Dynamic Highlights working! Thanks @holroy for making me have another look at it.
I think the plugin isn’t working the way it should, but I got it to work, and if anyone comes looking for an automatic highlighting, this is how you do it.
Go to the plugin’s Github page and copy one of the author’s templates. I used the Pandoc one because I also want to capture groups.
Then in the plugin’s settings in Obsidian go to Import
and paste the template. Rename it to whatever you like. Then you can replace the template’s regex query with something you need to capture.
For me this never worked, as it always complained about malformed escape characters or something like that. So Ctrl+Z your way back to the template’s regex query and just hit Save.
Then you hit the edit button and instead of editing the Custom CSS field, you change the “Search Term” field, where you should be seeing the template’s query. You put your own query in their and hit the Save button (make sure not to accidentally turn on/off the “Enable regex” button, as there’s some overlap in hitboxes), and then it should work!
Remember to choose a color you can actually see because for me it was defaulting to an almost invisible color of grey.
And now it works. For me the query was \\.+?\}
, to capture everything between a \
and a }
, which is how LaTeX citations work.
But actually I just tried exporting my Dynamic highlighting setting, and it exports to this:
"Whole-Cite": {
"class": "Whole-Cite",
"color": "#2FB90882",
"regex": true,
"query": "\\\\.+?\\}",
"mark": [
"match",
"group"
],
"css": ""
}
}
So it seems that the problem that it somehow wants/needs double or triple (?) escape characters.
Anyways, this works for me
I’d love to see an update version of this plugin to make it a little more straightforward but overall I’m happy to have solved this.
The advantage of this solution is that I don’t need to worry about Lua filters or deleting asterisks or spans, even though that would have also worked.
Thanks all for the help!!