Styled PDF Report Exporter

This page documents the canonical styled Markdown-to-PDF exporter used for repository analysis and campaign reports.

Styled Markdown-to-PDF report exporter for repository analysis artifacts.

scripts.reports.generate_styled_report_pdf.build_argument_parser()[source]

Build the exporter command-line parser.

Returns:

Parser configured for Markdown input, HTML preview handling, PDF output, report labels, and browser resolution.

Return type:

argparse.ArgumentParser

scripts.reports.generate_styled_report_pdf.detect_browser_executable(explicit_path)[source]

Resolve the browser executable used for headless PDF export.

Parameters:

explicit_path (str) – Optional browser path provided by the caller.

Returns:

Resolved Chrome or Edge executable path.

Return type:

Path

Raises:

FileNotFoundError – If no valid explicit path is provided and no known local Chrome or Edge installation can be detected.

scripts.reports.generate_styled_report_pdf.build_html_document(report_title, report_subtitle, report_category, body_html)[source]

Assemble the standalone HTML document used for preview and PDF export.

Parameters:
  • report_title (str) – Main report title shown in the hero block.

  • report_subtitle (str) – Subtitle shown below the report title.

  • report_category (str) – Category badge displayed in the hero block.

  • body_html (str) – Rendered report body HTML.

Returns:

Complete HTML document with the repository report stylesheet embedded inline.

Return type:

str

scripts.reports.generate_styled_report_pdf.convert_html_to_pdf(browser_executable_path, html_path, pdf_path)[source]

Export a rendered HTML report to PDF through a headless browser.

Parameters:
  • browser_executable_path (Path) – Resolved Chrome or Edge executable.

  • html_path (Path) – Local HTML file generated by the report pipeline.

  • pdf_path (Path) – Final PDF output path.

Raises:

subprocess.CalledProcessError – If the browser export command fails.

Return type:

None

scripts.reports.generate_styled_report_pdf.main()[source]

Run the styled Markdown-to-PDF export pipeline.

The pipeline resolves paths, renders the Markdown source into the custom HTML layout, exports the PDF through a headless browser, and cleans temporary workspace artifacts unless an HTML preview is explicitly kept.

Return type:

None