Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render ipyleaflet and ipywidgets in mkdocs-jupyter #85

Closed
giswqs opened this issue Jul 14, 2021 · 5 comments
Closed

Render ipyleaflet and ipywidgets in mkdocs-jupyter #85

giswqs opened this issue Jul 14, 2021 · 5 comments
Labels
Feature Request New feature or request help wanted Extra attention is needed

Comments

@giswqs
Copy link
Member

giswqs commented Jul 14, 2021

The documentation website (https://leafmap.org) is built using MkDocs and mkdocs-jupyter with GitHub Actions (mkdocs.yml and docs.yml). Currently, it seems mkdocs-jupyter can only render folium maps. Ipyleaflet maps and ipywidgets do not show up on the webpage. Any advice on making the ipyleaflet-based interactive maps show up on https://leafmap.org would be greatly appreciated.

Examples:

@deeplook @sackh @martinRenou @davidbrochart @danielfrg @squidfunk @chrieke

@giswqs giswqs added help wanted Extra attention is needed Feature Request New feature or request labels Jul 14, 2021
@danielfrg
Copy link

I think the main issue is that the mkdocs-jupyter does not include the amd-embed.js from jupyter-widgets.

Take a look at: https://ipywidgets.readthedocs.io/en/latest/embedding.html

Maybe just including the JS into the mkdocs-material template will do it.

@giswqs
Copy link
Member Author

giswqs commented Jul 14, 2021

@danielfrg Thank you for the advice. Can it (including the JS into the mkdocs-material template) be done within this repo or it has to be fixed by mkdocs-material?

@danielfrg
Copy link

It can be done in this repo: https://squidfunk.github.io/mkdocs-material/customization/

@giswqs
Copy link
Member Author

giswqs commented Jul 14, 2021

I followed the MkDocs customization instruction to add two JavaScripts to the docs/javascripts directory and add the following lines to mkdocs.yml. However, ipyleaflet maps still do not show up. Should I also modify main.html and how? Sorry, my JavaScript knowledge is very limited. Any help will be appreciated.

extra_javascript:
    - javascripts/embed-amd.js
    - javascripts/require.min.js

@giswqs
Copy link
Member Author

giswqs commented Jul 14, 2021

This is what it looks like when I clicked on the Embed widgets menu.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants