INNER CODE UNIT · Python
_find_title_cell
Kotlin/kandy · util/kandy-samples-utils/nb_to_doc.py:106
def _find_title_cell(cells: List[Tuple[NotebookNode, Optional[str], Optional[str]]]) -> Tuple[Optional[str], Optional[int]]:
"""
Find the title cell in the notebook.
Args:
cells: List of tuples containing (cell, output_type, output_content)
Returns:
Tuple of (title, title_cell_index)
"""
for i, (cell, _, _) in enumerate(cells):
if cell.cell_type == "markdown":
lines = cell.source.strip().split('\n')
if lines and lines[0].startswith('# '):
return cell.source, i
return None, None