Apply a direct scale to the provided SVG markup by inserting a <g transform="scale(...)">
around the SVG contents and multiplying simple numeric width/height attributes when present.
It also adjusts a viewBox attributeβs width/height so that SVGs that rely on viewBox
sizing are not cropped after applying the transform.
Given an SVG and a candidate scale, determine the final scale so that the
rendered image does not exceed the specified maximum ratio of the provided page width/height. The
function returns a scale that is at most candidate_scale.
Shutdown and kill any spawned Chrome used by Mermaid rendering. This ensures
the process doesnβt keep child processes or background threads alive which
can prevent the main program from exiting when its output is piped.