Giter VIP home page Giter VIP logo

Comments (6)

afeld avatar afeld commented on May 22, 2024

As a not-ideal workaround, I added

use_directory_urls: false

to the configuration, which fixed it.

from mkdocs-jupyter.

danielfrg avatar danielfrg commented on May 22, 2024

The solution is what afled commented.

Another option is to have the images in another dir inside the docs one, for example I usually do img/post-slug/img.png
and I include those in the notebook with

![alt](/img/post-slug/img.png)

from mkdocs-jupyter.

abadithela avatar abadithela commented on May 22, 2024

Hi, I'm trying to use the method suggested by @danielfrg above but the image still does not render. I created a separate folder in docs called imglib and put all my figures there. The docs folder also contains my Jupyter notebook at the following directory: case_studies/evaluating_perception/simple_script.ipynb . This case studies folder in docs is actually a symbolic link to the case studies folder that is located in the same directory as docs. I'm trying to render simple_script.ipynb that tries to print an image from the imglib folder but the figure does not render in my browser. Specifically, this is the error I get when I run make docs-serve:

INFO     -  [21:53:55] Serving on http://127.0.0.1:8000/gear/
WARNING  -  [21:53:58] "GET /gear/javascripts/mathjax.js HTTP/1.1" code 404
WARNING  -  [21:53:58] "GET /imglib/simple_case_study_fig2.png HTTP/1.1" code 404
WARNING  -  [21:53:58] "GET /imglib/simple_case_study_fig2.png HTTP/1.1" code 404

from mkdocs-jupyter.

giturra avatar giturra commented on May 22, 2024

Hi!

I'm having the same problem that @abadithela, any suggestions?

from mkdocs-jupyter.

abadithela avatar abadithela commented on May 22, 2024

@giturra I rendered in the Jupyter notebook using matplotlib. It's not the greatest but it works:

import matplotlib.pyplot as plt
import matplotlib.image as mpimg

%matplotlib inline
fig, ax = plt.subplots()
img = mpimg.imread('imglib/autonomy-stack.png')
imgplot = ax.imshow(img)
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
plt.show()

A better alternative is to use Python commands:

from IPython.display import Image
Image("imglib/autonomy-stack.png")

from mkdocs-jupyter.

zoldello avatar zoldello commented on May 22, 2024

The issue with using use_directory_urls: false is that it added ".html" to the end of web pages. If that is not acceptable, then the question is still opened.

If you set use_directory_urls: true and your notebooks are not in docs folder, you have an new issue where the directory of the images is different between local development and the generated site/ folder for the site.

from mkdocs-jupyter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.