question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An easy way to specify a list of assets that should be copied over.

See original GitHub issue

Is your feature request related to a problem? Please describe.

My teaching notebooks often include links to local assets (images, data or code files, …). I would want these assets to be accessible from the HTML version as well.

Describe the solution you’d like

I would like to have a simple way to specify a list of files (or file globs) that sphinx should copy over to _build/html, preserving the nested structure (i.e. foo/bar.py should be copied over as _built/html/foo/bar.py). This could be some MANIFEST style file, or some config option.

Describe alternatives you’ve considered

Sphinx’s html_extra_path is inconvenient as it flattens the directory structure. I.e. if foo/bar.py is specified, then the copy will land in _build/html/bar.py.

The workaround I found is to create an assets directory, and reproduce the directory structure there, with links to the original files, and add the following to _config.yml

sphinx:
  config:
    html_extra_path: ['assets']

The first step is cumbersome at best.

Bonus

Make it so that the assets would be also available to code executed in the thebelab cells. This one is tough as the kernel is running on a remote Jupyter server, and thus does not have direct access to the files locally hosted on the web server.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:19 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
chrisjsewellcommented, Aug 28, 2020

For option 2, I think the caption part is not yet implemented in Myst-Parser

Yes it is 😄 See the big jupyter-book documentation refresh that is nearly finished in #911 (and will be released as v0.8.0) https://deploy-preview-911--jupyter-book.netlify.app/content/figures.html#markdown-figures

2reactions
nthierycommented, Aug 15, 2020

@nthiery what’s the way in which you’d imagine referencing them? E.g. all of those things seem like things you’d want people to download, but the {download} role will trigger an asset copy if I recall correctly

Ah, ok, good to know. Pending confirmation, let’s try and see if, in practice, the download role + new myst features for images cover all the use cases. Worst comes to worst, a work around could be to use a dummy myst page listing all the desired assets with download links.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Make a List of Personal Assets: 14 Steps (with Pictures)
There are a few simple steps you can follow in order to make a list of your personal ... This will help attach...
Read more >
Copying assets - CS Professional Suite - Thomson Reuters
Copying assets · Open the Asset List window for an activity. · Select the asset you want to copy. Tips · Choose Edit...
Read more >
The 9 Best Income Producing Assets to Grow Your Wealth
A deep dive into the world of income-producing assets and how you can use them to get rich.
Read more >
Copying and pasting assets - IBM
When you paste multiple assets in a report, a dialog box is displayed to allow pasting the assets in a new table. Dialog...
Read more >
24 Best Income Generating Assets [Invest in Cash Flow, 2022]
When thinking of the best ways to establish a financial cushion and overcome reliance on any one income stream, it is advantageous to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found