stuebersystems / mkdocs-img2fig-plugin

A MkDocs plugin that converts markdown encoded images into <figure> elements.
https://pypi.org/project/mkdocs-img2fig-plugin
MIT License
20 stars 10 forks source link

img2fig breaks relative links when use_directory_urls is set to True #4

Open timvink opened 3 years ago

timvink commented 3 years ago

With the following directory structure:

docs/
   - folder/page.md
   - sys.png
mkdocs.yml 

And use_directory_urls: true in mkdocs.yml, the images break when enabling this plugin.

The src path is not correct, f.e. changing:

<img alt="The github logo" src="../../github-octocat.png">

To

<figure class="figure-image">
  <img src="../github-octocat.png" alt="The github logo">
  <figcaption>The github logo</figcaption>
</figure>

For a reproducable example (try turning img2fig off and on):

git clone git@github.com:timvink/mkdocs-print-site-plugin.git
cd mkdocs-print-site-plugin
mkdocs serve -f tests/fixtures/projects/relative_images/mkdocs_img2fig.yml