javalent / obsidian-leaflet

Adds interactive maps to Obsidian.md using Leaflet.js
486 stars 30 forks source link

Auto-create maps based on YAML #317

Open Calorion opened 2 years ago

Calorion commented 2 years ago

I'm trying to create Evernote-style Note info with help from Leaflet.

What I've been doing so far is using Callouts, like so:

> [!info]- Note info
> **Created** 
>Sun, 11 Sep 2022 08:08:43 -0500
>
> **Location**
> ```leaflet
>maxZoom: 16
>id: 2022-09-11T08:08:43-05:00
>markerFile: [[2022-09-11]]
>```
><span style="display:block;width:fit-content;margin:auto;">[[📍Journal Map|📍See all note locations]]</span>

This works, and is even somewhat attractive in reading view, but is also kind of clunky, as it's frontmatter outside of the frontmatter, so to speak, and therefore sometimes doesn't interact with other things well.

What would be even better if a foldable map could be auto-generated on the page based on frontmatter tags. Something like map: yes in the frontmatter would indicate to Leaflet that a map should be displayed in that note based on the other info in the frontmatter.

This would be an awesome addition to an awesome plugin!

Calorion commented 1 year ago

An example of a plugin that does just this sort of thing is https://github.com/mgmeyers/obsidian-embedded-note-titles. That's pretty much exactly what I want, except with (foldable) maps.

Or, even better, actually integrate the map into the metadata section somehow, the way tags are displayed in reading view.