AVATEAM-IT-SYSTEMHAUS / mkdocs-kroki-plugin

MkDocs plugin for Kroki-Diagrams
MIT License
41 stars 27 forks source link

DownloadImages does work with Mike command #48

Closed pdefert closed 1 month ago

pdefert commented 7 months ago

Hi,

when i use mike to build my documentation, the path of my schema was wrong

it missing a slash between site_url and DownloadDir .

ex: in mkdocs.yaml, site_url is set with http://foo.bar/ with mike, i deploy develop branch. the new site_url is http://foo.bar/develop (wihtou slash)

it's seems happen here https://github.com/AVATEAM-IT-SYSTEMHAUS/mkdocs-kroki-plugin/blob/fe483bf78bdece117d8617e7c38015f2c5f76352/kroki/plugin.py#L120

it concatenate site_url with mkdocs_file.url (DownloadDir+filename)

DownloadDir not allow to start with slash, it hangs an error.

  1. First proposal, add slash a line 120 between {self._site_url}{mkdocs_file.url}
  2. Second proposal, Build mkdocs_file.url to start with slash, it produce a path relative to website root /images/kroki_generated/metric-b5bda32c406a1b2420322790f522df66.svg. without slash, it will be considere the path relative to url path. Generated data are write relative to website root, not relative to url path

Best regards

Philippe

oniboni commented 1 month ago

We had multiple issues with the absolute image paths in the past, therefore the DownloadDir option was removed and the images are now placed next to the pages that contain them.

If there are still problems with image retrieval, feel free to open a new issue. :wink: