MHKiT-Software / MHKiT

MHKiT Documentation
https://MHKiT-Software.github.io/MHKiT/
4 stars 14 forks source link

Fix warnings in documentation build #80

Open akeeste opened 1 week ago

akeeste commented 1 week ago

This PR attempts to fix the plethora of warnings that appear in our current documentation build. Not all of them are critical but the vast number of warnings makes it very difficult to see if a PR is building successfully or introducing warnings.

I will note the various problems and solutions. Hopefully this can help future users building sphinx documentation here or elsewhere:

error / error message --> solution

akeeste commented 1 week ago

Notes on the warning "image file not readable": this is an issue related to how nbsphinx is processing markdown output and converting it into html. Currently the TRTS and Strain examples have local images in examples/data/ linked in the jupyter notebooks using HTML: <img src="data/river/ADCP_transect/TRTS_transect_map.png" width=1080 height=920 />

The images are missing in the end HTML because:

  1. the image files are not being copied from mhkit-python/examples/data into a directory in the docs build and
  2. for the local images linked with HTML in the notebooks, the path to the image is taken as is. The path to the image is not updated in the built HTML (for example in docs/strain_measurement_example.html). The path to the image should be updated based on where those files would be copied to, such as docs/_images

Per the nbsphinx docs this should be straight forward, but the processing of certain markdown features through nbsphinx seems to be a known issue. https://github.com/spatialaudio/nbsphinx/pull/438 https://github.com/spatialaudio/nbsphinx/issues/36 https://github.com/spatialaudio/nbsphinx/issues/49

Solution: embedding the images as an attachment in the notebook seems to work. I'll take this approach to solve this warning.