fastai/fast_template

Embed image with url in notebook

Opened this issue · 2 comments

When the notebook to be published containts a url to the internet, the convertion of the notebook to a post gives an error.

I tried three options:

  1. Embed using markup
![Example Bullet Chart](https://jscharting.com/blog/bullet-charts/images/bullet_components.png)
  1. Embed using Image
from IPython.display import Image
Image('https://jscharting.com/blog/bullet-charts/images/bullet_components.png')
  1. Embed as HTML
<img src="https://jscharting.com/blog/bullet-charts/images/bullet_components.png" alt="Bullet chart" style="width: 200px;"/>

In case 3, this is the error in (https://github.com/cast42/cast42.github.io/runs/415599290?check_suite_focus=true):

converting: _notebooks/2020_01_29_bullet_chart_altair.ipynb
[Errno 2] No such file or directory: '/home/runner/work/cast42.github.io/cast42.github.io/_notebooks/https:/jscharting.com/blog/bullet-charts/images/bullet_components.png'
converting: _notebooks/2020-01-28-Altair.ipynb
Traceback (most recent call last):
  File "_action_files/nb2post.py", line 23, in <module>
    export2html.notebook2html(fname='_notebooks/*.ipynb', dest='_posts/')
  File "/home/runner/work/cast42.github.io/cast42.github.io/nbdev/nbdev/export2html.py", line 410, in notebook2html
    raise Exception(msg + '\n'.join([f.name for p,f in zip(passed,files) if not p]))
  File "/home/runner/work/cast42.github.io/cast42.github.io/nbdev/nbdev/export2html.py", line 410, in <listcomp>
    raise Exception(msg + '\n'.join([f.name for p,f in zip(passed,files) if not p]))
AttributeError: 'str' object has no attribute 'name'
##[error]Process completed with exit code 1.

@cast42 any chance you have a public link to your notebook so I can take a look? nevermind that is not necessary, I'm taking a look now

@cast42 I looked into this and this looks like a limitation with nbdev ( I believe that only images sourced from your local files are supported, not links but not 100% sure ) , perhaps you should file an issue in https://github.com/fastai/nbdev/

I did open a PR as you did encounter a bug with the error handling though!