esm7 / obsidian-map-view

Interactive map view for Obsidian.md
MIT License
598 stars 30 forks source link

[Feature request] - Marker icon rules - read from properties #255

Open pelegm opened 2 months ago

pelegm commented 2 months ago

The current marker rules only read note tags. In my workflow, I don't usually use tags, but rather properties (e.g., instead of tags:\n - campingsite I use types:\n - "[[Camping site]]"). To have special icons for various note types, I now add tags, but this duplicates some of my work. Is there any chance to support general properties in a future release?

esm7 commented 2 months ago

That's a really cool idea. How do you foresee the syntax for these properties? Making a generic rules mechanism for properties is probably far more excessive than for tags. Making a property for the icon is very easy, but might not be flexible enough for some users.

pelegm commented 2 months ago

Thanks for the feedback!

I would probably not try to reinvent the wheel but instead use Obsidian's basic query rules. E.g., Screenshot from 2024-07-11 10-18-46

The [properyname:propertyvalue] syntax returns every note whose propertyname either equals propertyvalue or contains it as an element in a list. It also ignores the square brackets and is case-insensitive by default.

esm7 commented 2 months ago

Oh nice. I knew somewhere in the back of my head it exists but never tried it. Will look into it.

pelegm commented 2 months ago

By the way, I would apply the same concept for filters - you already allow there most of what Obsidian's search allows. Shall I open a distinct issue for that?

esm7 commented 2 months ago

Unfortunately mimicking Obsidian's search is a pain. I discussed with the Obsidian developers years ago to provide an API to the search capabilities, they agree with the need but never came to it. So Map View has its own query mechanism, and if you think of other operators that could be useful, I prefer to cherry pick them than to play catch-up. (Regardless, to my understanding this is about to change soon, as Obsidian is about to introduce its own querying mechanism based on Data View. I'm hopeful it will have a formal API and Map View can plug into that.)

pelegm commented 2 months ago

Sounds good. Thank you again so much! (bought you a coffee). I'll open a distinct issue for filtering in map view in terms of properties.