in scripts/nb_to_md.py [0:0]
def parse_front_matter(self, content, markdown) -> Tuple[str, str, int, str]:
"""Gets the Front Matter for the updated notebook.
Uses the Markdown Front Matter as the default values and overrides with
content from the notebook.
Args:
content: The notebook content converted to Markdown.
markdown: An instance of MarkdownFile.
Returns:
A tuple containing the title, description, weight, and content without
the Front Matter."""
title, description, weight = markdown.parse_front_matter()
content_idx = 0
# find the title
idx = content.find('\n')
if idx:
line = content[0:idx]
if line.startswith("#"):
title = line[1:].strip()
content_idx = idx + 1
# find the description
descIdx = content.find('\n', idx + 1)
if descIdx:
line = content[idx + 1:descIdx]
if line.startswith(">"):
description = line[1:].strip()
content_idx = descIdx + 1
content = content[content_idx:]
return title, description, weight, content