INNER CODE UNIT · Python
create_md_file
Kotlin/kandy · util/kandy-samples-utils/nb_to_doc.py:74
def create_md_file(md_filename: str, cells: List[Tuple[NotebookNode, Optional[str], Optional[str]]], base_name: str) -> None:
"""
Creates a markdown file preserving the order of markdown and code cells.
Args:
md_filename: Path to the output markdown file
cells: List of tuples containing (cell, output_type, output_content)
base_name: Base name for function names and class names
"""
try:
with open(md_filename, "w", encoding="utf-8") as md_file:
# Extract title from the first markdown cell if it exists
title, title_cell_index = _find_title_cell(cells)
# Write the title at the very beginning if found
if title:
md_file.write(title + "\n\n")