firecrown.fctools.code_block_checker ==================================== .. py:module:: firecrown.fctools.code_block_checker .. autoapi-nested-parse:: Check Python code blocks in Quarto (.qmd) files for syntax errors. Attributes ---------- .. autoapisummary:: firecrown.fctools.code_block_checker.app Functions --------- .. autoapisummary:: firecrown.fctools.code_block_checker.check_qmd_file firecrown.fctools.code_block_checker.extract_code_blocks firecrown.fctools.code_block_checker.main Module Contents --------------- .. py:data:: app .. py:function:: check_qmd_file(file_path) Parse a .qmd file, extract Python code blocks, and check their syntax. :param file_path: Path to the Quarto (.qmd) file to check :return: List of error messages for code blocks with syntax errors .. py:function:: extract_code_blocks(content, code_blocks) Extract Python code blocks from Quarto markdown content. Parses content line by line to find code blocks delimited by {python} or {.python} (display-only), including blocks with execution options like {python, echo=false}. Appends the code from each Python block to the code_blocks list. :param content: The Quarto markdown content to parse :param code_blocks: List to append extracted code blocks to (modified in-place) .. py:function:: main(directory = typer.Argument(..., help='The directory containing .qmd files to check', exists=True), quiet = typer.Option(False, '--quiet', '-q', help='Only report errors, suppress success messages')) Check Python code blocks in Quarto (.qmd) files for syntax errors. Scans all .qmd files in the specified directory, extracts Python code blocks, and checks them for syntax errors using Python's ast.parse(). Usage: code_block_checker.py tutorial/ Exit codes: 0: No errors found 1: Syntax errors found or directory invalid