I am a relative beginner developing a Python package. At the root of the repository there are two important directories: images
and docs
. The former contains some png and svg files I would like to put inside a documentation, the latter is where I run sphinx-quickstart
in. I cannot change that layout therefore I have to let Sphinx know to use the top-level images
directory while building the docs.
According to what I found over the internet I adjusted the conf.py
file to have:
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static', '../images']
And in the index.rst
I have to point to the image file itself:
.. image:: ../images/scheme.svg
:width: 500
:alt: schematic
:align: center
Having these two set up I run make html
and I do get clean logs but the output directory is a little strange... Once the build is finished i have a docs/_build/html
directory which contains _static
and _images
sub-directories (among many others). What I find strange is that inside docs/_build/html/_static
I see all the contents of the root-level images
being copied over whereas (at the same time) inside docs/_build/html/_images
I only have scheme.svg
. So essentially this one file is duplicated into these two subdirectories...
This does not look very clean to me... how should I adjust this setup?
Reply to the comment of bad_coder:
Below I will paste a tree with the dir structure (kept only the relevant elements):
.
├── docs
│ ├── Makefile
│ ├── _build
│ │ └── html
│ │ ├── _images
│ │ │ └── scheme.svg
│ │ ├── _static
│ │ │ ├── scheme.svg
│ ├── conf.py
│ ├── index.html
│ ├── index.rst
├── images
│ ├── scheme.svg