Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagram path computation resolves incorrectly #87

Open
manueleiria opened this issue Jan 24, 2025 · 4 comments
Open

Diagram path computation resolves incorrectly #87

manueleiria opened this issue Jan 24, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@manueleiria
Copy link

manueleiria commented Jan 24, 2025

The issue we're having has been pinpointed.
Consider the following folder structure:

docs/
-> folder/
  -> file.md
  -> diagram.md
-> index.md

Essentially, when declaring a diagram such as ![diagram](diagram.drawio) in file document.md, the mkdocs-drawio-exporter is able to generate it correctly, but when placing it after generation the file structure looks like this:

docs/
-> folder/
  -> file.md
  -> diagram.drawio
-> index.md
site/
-> folder/
  -> file/
    -> index.html
  -> diagram.drawio-0.svg
-> index.html

At this point the diagram is no longer in the same directory as the html page and the diagram can't be found. Of course, if I change the src in the developer console to ../diagram.drawio-0.svg it then finds it without issue. Since our mkdocs generates pages this way, is there a possibility do add a rewrite as parameter perhaps?

@LukeCarrier
Copy link
Owner

This might be the issue described in #83; I'll try and take a look when I get chance. In the meantime if you could prepare a minimum repro case that would really help speed things up. You could modify the example setup in the docs if that helps.

@LukeCarrier LukeCarrier added the bug Something isn't working label Jan 25, 2025
@manueleiria
Copy link
Author

That seems like a different issue where their own navigation isn't working as intended. We have closed source in our repo for the templates, so it might take some more time to get you a test repo. The behaviour happening however is that mkdocs turns all navigation that is not an index page the following way:

index.md
navigation1/
->diagram.drawio
->index.md
->other_page.md

into:

index.html
navigation1/
->diagram.drawio-0.svg
->index.html
->other_page/
  ->index.html

Let's say that both navigation1/index.md and navigation1/other_page.md both reference the diagram as ![diag](diagram.drawio#0).
This will mean that navigation1/index.html will be able to reach the diagram, but not navigation1/other_page/index.html. In this case there will need to be a rewrite happening to point the navigation to the correct file. I will try to provide a better test example after the weekend.

@LukeCarrier
Copy link
Owner

In the absence of a repro case, can you try and repro the issue on 0.9.1? There were changes in 0.10 to the hooks used to rewrite links that were intended to improve compatibility with other plugins which might explain both behaviours.

@manueleiria
Copy link
Author

manueleiria commented Jan 25, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants