Open MrSurly opened 4 years ago
Thanks! The culprit seems to be these lines: https://github.com/pdoc3/pdoc/blob/d8b9dbc2a128099e89a9d7859720dac56d574094/pdoc/cli.py#L225-L228 Let me think about it. :thinking: PR welcome!
I gave it a shot (a PR), but it seems to render on-the-fly rather than rendering to a directory, so it didn't really work out.
Well yeah, it's a HTTP server: :smiley: https://github.com/pdoc3/pdoc/blob/d8b9dbc2a128099e89a9d7859720dac56d574094/pdoc/cli.py#L155
I'd say the branch condition above needs to be modified to account for other files that are not module documents and maybe default to SimpleHTTPRequestHandler.do_GET()
behavior for those files (if _WebDoc
inherits from SimpleHTTPRequestHandler
instead, maybe simply super().do_GET()
can be called).
I am also facing this issue ( https://github.com/pdoc3/pdoc/issues/268 ).
Not 100% sure if it makes a difference for the solution but the issue is also there when generating the documentation with pdoc3 --html
. The browser also does not find the image, and this should all be static content I believe?
Since with --html
pdoc just converts markdown ![alt](image)
to HTML <img src="image" alt="alt">
, I believe it's a question of relative path addressing. Where is the image located relative to the document? Have you tried to address it relative to the project root or the CWD?
I guess the problem is that the images are not copied at all into the output directory. I used relative adressing, e.g. test.svg
when the image is located in the same folder as the python file. In https://github.com/pdoc3/pdoc/issues/268 I also described a minimal example to reproduce it.
can i contribute please assign me
Expected Behavior
Images are served by http server
Actual Behavior
Images return a 302 and a URL that ultimately results in a 404.
Steps to Reproduce
Additional info
Note that accessing the files directly via
file://
works as expected.