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

Question: Captions for local image files just like urls ? #111

Closed
hamelsmu opened this issue Mar 22, 2020 · 4 comments
Closed

Question: Captions for local image files just like urls ? #111

hamelsmu opened this issue Mar 22, 2020 · 4 comments

Comments

@hamelsmu
Copy link
Member

hamelsmu commented Mar 22, 2020

With nbdev, you can include captions in images like this:

![](https://www.fast.ai/images/fastai_paper/show_batch.png "My Caption")

However, when the link is a local file, instead of a url this is not picked up by nbdev. For example,

![](my_icons/fastai_logo.png "hello")

is not handled the same way - this results an in error when someone tries to do this. @sgugger I believe perhaps we should make an ammendment to the _img2jkl function:

nbdev/nbdev/export2html.py

Lines 125 to 129 in 9f572b2

def _img2jkl(d, h, jekyll=True):
if not jekyll: return '<img ' + h.attrs2str() + '>'
if 'width' in d: d['max-width'] = d.pop('width')
if 'src' in d: d['file'] = d.pop('src')
return '{% include image.html ' + h.attrs2str() + ' %}'

However, I am not completely sure that is as easy as changing this function. We might have to also (1) copy the image (2) change the relative path to the copied location. Please let me know your thoughts.

The related issue on fatpages: fastai/fastpages#225

cc:@noklam

@hamelsmu hamelsmu changed the title Captions for local image files just like urls Captions for local image files just like urls ? Mar 22, 2020
@hamelsmu hamelsmu changed the title Captions for local image files just like urls ? Question: Captions for local image files just like urls ? Mar 22, 2020
@noklam
Copy link

noklam commented Mar 22, 2020

Thx @hamelsmu I just saw the notification and saw you have already opened the issue.

@sgugger
Copy link

sgugger commented Mar 22, 2020

Should be fixed now. I made sure it works the same way as external images.

@hamelsmu
Copy link
Member Author

Wow that was fast. You close issues like magic on this repo. I don’t know how you do it - starting to wonder if you are an artificial intelligence😝

@sgugger
Copy link

sgugger commented Mar 22, 2020

I am only every happy when the number of issues and PRs is 0 ;)

jph00 pushed a commit that referenced this issue Jul 24, 2022
Revert "Conditionally load modules for doclinks"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants