-
Notifications
You must be signed in to change notification settings - Fork 51
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
Incompatibility with d2 plugin in version 1.3 #249
Comments
Welcome to this project and thank you! |
Thanks! I had a look at the example, which is quite straightforward. Offhand, I can't see a logical explanation why this change of version in Mkdocs-Macros is creating a problem. Let's find out.
I am not fully familiar with te d2 project., though it obviously does something similar to the mkdocs-mermaid2 plugin, except for the fact that it is rendering the diagram at build/serve time (am I correct?). |
Hello, To answer both questions, the error message I get in the build process in verbose mode is the message in the opening issue. No more, no less. However, here is the full build stack in verbose mode for the record:
About the d2-plugin, yes. It builds diagrams from code, in d2 language, which is an alternative to mermaid. It generates SVG as output during the build phase. :) For the comparison, here is the verbose build stack with macros in version 1.2.0:
Hope that helps :) |
Yes, certainly that gves us something to work with... I still have no idea what's going on, because MkDocs-Macros does not have code to mess up with fenced code (contrary to e.g. MkDocs-Mermaid2). The issue seems to occur on the Do you know so far, which piece of code is saying "Error: The current file is not set for the '!relative' tag. It cannot be used in this context; the intended usage is within Also, I am not sure what it means exactly, but this might be a pointer: mkdocs/mkdocs#3453 . I am not sure in what file this |
The error happens here, but I would not be able to say how and why it happens... That's why the code I gave is minimal. There is nothing but a simple d2 diagram in a single page. I know for sure this is happening at least in this content, though I don't know where exactly in the code it is happening as I am not really knowledgeable in debugging python. However, your question made me wonder if the issue is really the content. It looks like to me that the issue happens before that. To make sure of that, I have removed any D2 content from the code I gave you in the opening issue, and the issue still happens. See here for the empty content. To summarize: even with no content, only an empty file, the issue happens. So it is unrelated to the content. |
I have executed the build process in debug mode, and here is the instruction that provokes the error: https://github.com/fralau/mkdocs-macros-plugin/blame/3a73707abd48c9df214646d57204cff854bbe98b/mkdocs_macros/plugin.py#L847 The change happened last week. The debug command is called, but the Commenting it out prevents the error from happening... Hope that helps! |
Wow. It certainly does! Now it makes sense. I'll have a look to fix it. |
Just in case if that can help, the stack continues to here: https://github.com/fralau/mkdocs-macros-plugin/blame/3a73707abd48c9df214646d57204cff854bbe98b/mkdocs_macros/util.py#L139 The TypeError happens on a Which down below leads to the initial error... 😃 I am very interested to understand why this happens only when using the d2 plugin... 🤔 |
It's apparently some object that the object dumper can't process. I should make it more robust, so that it reacts more gracefully. |
It was indeed due to the class |
@Karreg I made a special test case for that, which passed with flying colors. Could you please test on your side? |
Fix confirmed on both my sample code and a real world documentation 👍 |
Thanks! It was a pleasure! |
Hello @fralau , would you mind release the 1.3.7 version with this fix? That would be great, thanks 🙂 |
Done! |
Thanks :) |
Hello,
I have found an incompatibility with d2 plugin in the 1.3 version, that did not exist in version 1.2.
I don't have all the details, but here is what I found:
Since version 1.3, I get this error when building my documentation:
Without more context in the error, I could not find out which content generated this error, however:
My guess is that since version 1.3, macros plugin analyzes incorrectly the d2 generated content, which is SVG. But that is just a guess.
I have created a repository (with a devcontainer if that can help) here to show the issue. The mkdocs content is minimal (no content other than a simple d2 diagram, no plugin other than search, macros and d2, no theming...): https://gitlab.com/karreg/mkdocs-macros-d2-issue
If I can help, I'll be glad to try :)
The text was updated successfully, but these errors were encountered: