A Dynamically Created Site Map using Mermaid

The title say’s it all, but to clarify, with a single script run a new and updated site map should be created using Mermaid code based on the automatic XML sitemap generated by the Hugo site build command.

Questions

The Mermaid map should over write an existing html page?

Or should it be generated as a md file? This would require a second Hugo build?

Can the Python script be incorporated into the Hugo build script?