Module inner

Module inner 

Source

StructsΒ§

CompileError πŸ”’

StaticsΒ§

BROWSER πŸ”’
HELPER_PATH πŸ”’
POOL_TAB πŸ”’

FunctionsΒ§

apply_scale_to_svg πŸ”’
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.
compute_auto_scale πŸ”’
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.
ensure_browser
Initialize or check the shared headless Chrome instance used for Mermaid rendering.
ensure_helper_file πŸ”’
extract_dpi_from_svg πŸ”’
Extract data-dpi=β€œNNN” if present (used when SVGs embed DPI metadata).
extract_svg_intrinsic_px πŸ”’
Fast heuristic to extract intrinsic width/height in pixels from an SVG string.
get_browser
get_pool_tab πŸ”’
sanitize_svg_for_printpdf πŸ”’
Simple sanitizer used before passing SVGs to printpdf.
shutdown_browser
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.
strip_slice_class_from_path_tags πŸ”’
Temporary workaround for a printpdf parsing bug: remove class="pieCircle" when it appears inside <path ...> tags only.