Social plugin: runtime error with virtual files #7517
Replies: 3 comments
-
Thanks for noting. Unfortunately we need a minimal reproduction to fix it, which we'd be more than happy to. Thus, if you can provide one, it's likely an easy fix. You might just put the virtual files logic in a hook to reproduce it, but I'm not sure since I don't know the code. Without a reproduction, we can only guess. |
Beta Was this translation helpful? Give feedback.
-
I managed to prepare a reproduction by creating a minimal example plugin that adds a generated file to the build. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for fixing this so quickly in ee8d243f9. And thank you for reminding me of the hooks feature, which I wasn't aware of. This might be helpful for future bug reports. |
Beta Was this translation helpful? Give feedback.
-
This is actually a bug report. I didn't open an issue because I can't create a minimal reproduction. The bug only manifests in combination with other plugins that add virtual files to the build. I hope you still consider this report as valid.
The Insiders version of the material/social plugin has the following code in its on_files event handler:
This code raises an AttributeError exception if abs_src_path is None. This happens for virtual files, which MkDocs supports since version 1.6.
See for example here:
https://www.mkdocs.org/about/release-notes/#enabling-true-generated-files-and-expanding-the-file-api
Our internal MkDocs plugin creates virtual files in its on_files event handler. I was able to work around the issue in the Social plugin by adjusting the event handler priorities to ensure that we create these files after the Social on_files event has run. However, not all third-party plugins might be able to make similar adjustments.
Beta Was this translation helpful? Give feedback.
All reactions