observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
966 stars 83 forks source link

add leaflet to recommended libraries #285

Closed mbostock closed 2 years ago

mbostock commented 2 years ago

Adds Leaflet to the list of recommended libraries (so that it’s easier for us to make a snippet for creating Leaflet maps).

shancarter commented 2 years ago

The default L construction feels a little unfortunate because it's so arcane in the context of a snippet in observable. It doesn't immediately identify itself as using leaflet, which is especially obscure for these magic std lib cars. Should we use Leaflet instead (like Plot) even though it's not the default global for leaflet?

shancarter commented 2 years ago

I think this is a very useful snippet though, it seems like something I see people trying and struggling with quite a bit.

mbostock commented 2 years ago

I don’t like the L either, but given that it’s the Leaflet convention (and Leaflet defines a global L which is used by some plugins), I think we should stick with that. In the autocomplete menu we can say “L [Leaflet]” like we do with Apache Arrow and Arquero.

I think this is a very useful snippet though, it seems like something I see people trying and struggling with quite a bit.

Yes, people may struggle, but this is as simple as I can make it and it should work out of the box, which I think will encourage users to learn more and experience some success. Just think about how hard it is to do it right now without this snippet and without it being built-in to the standard library! 😄

mbostock commented 2 years ago

Specifically I want to use L because if you look on the web for snippets of code using Leaflet, they will all use L, so users won’t have to translate the L into Leaflet to get them to work on Observable. E.g., https://leafletjs.com/examples/quick-start/

shancarter commented 2 years ago

Sounds good. Having the description in the autocomplete will definitely help. Wonder if we could have the description in the title hover tag or whatever when we do them for standard lib objects?