jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

Jupyter book stripping path from produced html output

Open chipbrock opened this issue 1 year ago • 1 comments

This is of some urgency with the start of the semester happening in a few weeks.

I hope this is understandable. I'll show the directory structure below, but here is the issue:

I have a perfectly functioning book, but I need to have a directory that contains examples referred to in the otherwise just-fine-source chapters. So I have a MD file (myfile.md) that has the following line:

<img src="../../images/motion/michigan.png" width="500px" /> When the book is processed, the html file for that is produced (myfile.html) has in that spot:

<a class="reference internal image-reference" href="images/motion/michigan.png"> The process seems to have stripped the path to the location of the image.

Here is the directory structure. I'm afraid that the "code" here collapses the indentation in the preview, so I'm not using it for this. I'm also afraid that I must use "bracket<" and "bracket>"as < or > as that gets messed up in the preview otherwise. Sorry.

|--_build/ .....|-- html/ ..........|-- _static/ ..........|-- examples/ ...............|-- motion/ ....................|-- myfile.html --> results: bracket< a class="reference internal image-reference" href="images/motion/michigan.png" >bracket ..........|-- _images/ ...............|-- myimage.png ..........|-- _sources/ ..........|-- motion/ ...............files |--__config.yml |--__images/ .....|-- motion/ ..........|-- myimage.png |--__static |--__toc.yml |--.idea |--.ipynb_checkpoints |--.virtual_documents |--.vscode |--examples/ .....|-- motion/ ..........|-- myfile.md --> contains: bracket< img src="../../images/motion/michigan.png" width="500px" />bracket |-- intro.md |--logo.png |-- motion/ .....|-- other files |-- references.bib |-- reStructuredText.plist |-- venv

Any idea what's going on??

chipbrock avatar Aug 10 '24 23:08 chipbrock

notice also that the book creation flattens any directory structure of the original _images directory, dumping all referenced images into one heap. It then, indeed, changes the paths of the produced html, but correctly. Just for this one directory outside of the toc does it process the MD files, but eliminate the path.

I don't understand why disrespecting the _images directory structure is necessary either. So two issues, one kind of annoying and the other seems a bug.

chipbrock avatar Aug 11 '24 11:08 chipbrock