Fix static embedding (and gallery build)

Static embedding is not working correctly, affecting the `build_gallery.py` script

- [x] Fix static embeding
- [x] Reimplement `create_html_snippet` with new embed API
- [x] Fix `build_gallery.py` minimally
- [x] rework  `build_gallery.py` to use new embed API directly