diff --git a/resources/nb-check.py b/resources/nb-check.py index 6a1f7e6..71df60d 100755 --- a/resources/nb-check.py +++ b/resources/nb-check.py @@ -123,7 +123,13 @@ def new_markdown_cell(cell_id: str, content: str) -> dict[str, Any]: # Clear out execution metadata and cell output for cell in cells: if 'metadata' in cell: - cell['metadata'] = {} + clean_metadata = {} + if 'language' in cell['metadata']: + clean_metadata['language'] = cell['metadata']['language'] + if 'output_variable' in cell['metadata']: + clean_metadata['output_variable'] = cell['metadata']['output_variable'] + + cell['metadata'] = clean_metadata if 'outputs' in cell: cell['outputs'] = [] if 'execution_count' in cell: