-
Notifications
You must be signed in to change notification settings - Fork 5
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
File not found errors caused by blog plugin #13
Comments
There are two ways to solve this:
I don't know if the first option is even possible, so number two seems like a more likely solution. |
I'm not sure 2. is a good idea. One of the good side of MkDocs versus Jekyll or Hugo, is the ease to target resources without specifying where they are. Especially with preview. Also, it breaks the way the plugin is working now, i.e. handling d2 files as if they were images. It's intuitive. Isn't there a way to force the sequence of plugin execution? The issue here is that the blog plugin is executed before the d2 plugin. |
I just tested and it wouldn't work anyway since Your plugin priority suggestion might work, I will test it. |
Order is documented here. Note sure we can do much. In my sample, the blog plugin is defined after the d2 plugin, but it's still executed before... It would be worth the try to open a issue on material, I can do that. |
Oh I missed that! 🤞 |
I fixed the issue by rewriting all relative links to absolute links before blog plugin copies the files. I'm not merging it yet because I still need to make sure it doesn't break anything. |
Please test version 1.4.0rc1 and let me know if it works for you. |
Sure, will do and get back to you as soon as possible :) |
I have tested it on my blog and it's indeed breaking with other plugins. I have isolated one, the git plugin:
I don't understand how the d2 plugin version could impact the path for the git plugin to find the git binary, but with version 1.3.3 it's working fine. I have updated the test project to get the 1.4.0rc1 version and activate the git plugin: https://github.com/Karreg/mkdocs-d2-plugin-playground To test with the previous version, you just need to force the version to 1.3.3 and call |
It's probably because I had to change |
Yup, I was right - squidfunk/mkdocs-material#5336 |
Changing plugin execution order does not solve the issue and I can't find a way to alter the Markdown without affecting other plugins, because files created by the blog plugin during on_files event have placeholder content. I started a discussion in the Material for MkDocs repo. |
Maybe you can change it before executing your plugin, and set it back to its previous value just after? This way you don't have effect on other plugins, and whatever the order as long as it's before the blog plugin? |
I will check if the issue happens with drawio too. If not, maybe they have a way to work around this issue. |
I confirm the issue is also there with the drawio exporter. With blog plugin, image generation is broken, without blog plugin, it's working. (I have added it to the playground project) |
Wouldn't this setup interesting to work around the issue? squidfunk/mkdocs-material#5336 (comment) |
Material for MkDocs blog plugin copies markdown files to create excerpts but it does not copy assets alongside them. This causes "file not found" errors.
For context: #11
The text was updated successfully, but these errors were encountered: