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

Relative Notebook URL needed for NbconvertFileHandler (or differently) #2744

Open
gabyx opened this issue Aug 10, 2017 · 0 comments
Open

Relative Notebook URL needed for NbconvertFileHandler (or differently) #2744

gabyx opened this issue Aug 10, 2017 · 0 comments

Comments

@gabyx
Copy link
Contributor

gabyx commented Aug 10, 2017

There is a pull request for a notebook extension which uses the html_embed.py exporter.
So far, the exporter can open and convert markdown image links to base64 only if the working directory of jupyter is the same as the opened notebook.ipynb.

Could we generally handover the relative URL as a resource to the NbconvertFileHandler.

class NbconvertFileHandler(IPythonHandler):

    SUPPORTED_METHODS = ('GET',)
    
    @web.authenticated
    def get(self, format, path):
    ...
            output, resources = exporter.from_notebook_node(
                model['content'],
                resources={
                    "metadata": {
                        "name": name[:name.rfind('.')],
                        "modified_date": (model['last_modified']
                            .strftime(text.date_format)),
                        "path" : path   ### < Handing over the path here...
                    },
                    "config_dir": self.application.settings['config_dir'],
                }
            )

such that certain exporters such as html_embed.py can resolve the image links and successfully open the image?

Or is there another better way of doing this? (but needs to be in place and working when all jupyter_notebook_nbextensions are installed)

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

1 participant