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

Built-in privacy plugin produces different HTML output on second run #7616

Closed
4 tasks done
Carsten87 opened this issue Oct 14, 2024 · 3 comments
Closed
4 tasks done
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@Carsten87
Copy link

Context

No response

Bug description

When running mkdocs build in a clean working copy of the project for the first time the privacy plugin fails to correctly "internalize" mermaid.min.js in the generated HTML documents.

Running mkdocs build a second time - without changing anything else - will correctly reference assets/external/unpkg.com/mermaid@11/dist/mermaid.min.js.

For example see the diff between the first and the second run on index.html:

--- a/index_first_run.html
+++ b/index_second_run.html
@@ -263,7 +263,7 @@
     
       <script src="assets/javascripts/bundle.525ec568.min.js"></script>
       
-        <script src="https:/unpkg.com/mermaid@11/dist/mermaid.min.js"></script>
+        <script src="assets/external/unpkg.com/mermaid@11/dist/mermaid.min.js"></script>
       
     
   </body>

Note: Somehow in the minimal reproducer the diagram is still being rendered (I did not yet figure out how) but in my real world project it is only rendered correctly after the second run. However rerunning mkdocs build without changing inputs should deterministically produce the same result in my opinion.

PS: Thank you for the great project, I really enjoy mkdocs-material 👍

Related links

Reproduction

9.5.40-mermaid-asset-incorrectly-internalized.zip

Steps to reproduce

  1. Run mkdocs build
  2. Inspect the generated site/index.html
  • It contains <script src="https:/unpkg.com/mermaid@11/dist/mermaid.min.js"></script> (in line 266 in my case on the very end of the file just before </body>)
  1. Run mkdocs build again
  2. Inspect the generated site/index.html
  • It now contains <script src="assets/external/unpkg.com/mermaid@11/dist/mermaid.min.js"></script> (in line 266 in my case on the very end of the file just before </body>)
  1. This is the only difference between the two files

Browser

No response

Before submitting

@squidfunk
Copy link
Owner

Thanks for reporting. This seems to be a race condition. I think it might be fixed with 92089c6, at least I can't reproduce it anymore. Please give that a try, and come back to us whether this solves the problem.

@squidfunk squidfunk added bug Issue reports a bug resolved Issue is resolved, yet unreleased if open labels Oct 14, 2024
@Carsten87
Copy link
Author

@squidfunk wow that was fast 🚀 Thank you!

I can confirm that I also cannot reproduce the issue anymore. I did try with the reproducer as well as with my real world project. Both look fine now and the diagrams are rendered on first build now 👍

@squidfunk
Copy link
Owner

squidfunk commented Oct 15, 2024

Released as part of 9.5.41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants