You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a project structured like this, and you run restview . at the top, you'll get a list of all .rst (and .txt) files. If you then click on foo/README.rst, the image will be visible.
If, on the other hand, you run restview README.rst inside the foo/ subdirectory, or restview foo/README.rst at the project root, the image will not be available. This is because the URL structure doesn't work. When README.rst is exposed at /, and you have a relative link starting with .., it has no upper level to climb to. As you can see in your pasted access log, the browser requests /img/bar.png and not /../img/bar.png, so restview is trying to find a img/bar.png in the directory that contains the README.rst. In fact if you create a symlink ln -s ../img bar/img, the images will start working.
Perhaps it would be nice if you could tell restview to serve everything under ., but ask it to open foo/README.rst instead of the list of files. Something like restview . --open foo/README.rst or restview foo/README.rst --root . maybe? I'm willing to accept such a pull request, but I don't know if I will find the time to work on it myself.
Actually, perhaps I should stop thinking of restview as a web server and start thinking about it as a program that displays ReStructuredText documents. There's nothing preventing me from discovering all the image directives in the document, making a list of images, and rewriting them into URLs that work (plus making sure to expose them via HTTP).
Given a project with the structure:
README.rst
When README.rst is rendered in the browser, the image does not appear. Below are the logs:
It looks like it's striping the
..
. When uploaded to GutHub, the images are rendered correctly.restview version: 2.8.0
python version: 3.6
The text was updated successfully, but these errors were encountered: