Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

mdinclude image path support #46

Open
xobs opened this issue Sep 24, 2019 · 1 comment
Open

mdinclude image path support #46

xobs opened this issue Sep 24, 2019 · 1 comment

Comments

@xobs
Copy link

xobs commented Sep 24, 2019

If a Markdown file is in a different directory and includes images, the paths are not preserved when the file is inserted into the source document.

For example:

.. mdinclude:: D:\Code\Fomu\foboot\hw\deps\valentyusb\valentyusb\usbcore\cpu\howto.md
❯ sphinx-build -M html build/documentation/ build/documentation/_build
Running Sphinx v2.2.0
c:\python37\lib\site-packages\m2r.py:652: RemovedInSphinx30Warning: app.add_source_parser() does not support suffix argument. Use app.add_source_suffix() instead.
app.add_source_parser('.md', M2RParser)
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] usb
deps/valentyusb/valentyusb/usbcore/cpu/howto.md:: WARNING: image file not readable: usb-icon.jpg
looking for now-outdated files... none found
pickling environment... done
checking consistency... D:\Code\Fomu\foboot\hw\build\documentation\identifier_mem.rst: WARNING: document isn't included in any toctree
D:\Code\Fomu\foboot\hw\build\documentation\lxspi.rst: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] usb
generating indices...  genindexdone
writing additional pages...  searchdone
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 3 warnings.
The HTML pages are in build\documentation\_build\html.
smcro@CUBOID  D:\Code\Fomu\foboot\hw foboot-2 ≢ 
[13:51]  ❯ dir .\deps\valentyusb\valentyusb\usbcore\cpu\usb-icon.jpg
Directory: D:\Code\Fomu\foboot\hw\deps\valentyusb\valentyusb\usbcore\cpu
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        24/9/2019  12:37 pm          15507 usb-icon.jpg
smcro@CUBOID  D:\Code\Fomu\foboot\hw   foboot-2 ≢ 
[13:51]  ❯ 

The file that sphinx mentions exists, and is an image. However, sphinx is doing path.join(app.srcdir, imgpath) which means it's actually looking for D:\Code\Fomu\foboot\hw\build\documentation\usb-icon.jpg which doesn't exist.

@xobs
Copy link
Author

xobs commented Sep 24, 2019

Also note that this appears to be a longstanding shortcoming in Sphinx: sphinx-doc/sphinx#701

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant