Skip to content

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

@Carsten87

Description

@Carsten87

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions