INNER CODE UNIT · Python
rebuild_file
DataTalksClub/datatalksclub.github.io · scripts/add_context_from_title.py:36
def rebuild_file(yaml_lines, remaining_content):
"""
Rebuild the markdown file with updated YAML front matter.
Args:
yaml_lines: List of YAML lines
remaining_content: Content after YAML front matter
Returns:
str: Complete file content
"""
yaml_str = '\n'.join(yaml_lines)
return f"---\n{yaml_str}\n---\n{remaining_content}"
def find_title_lines(yaml_lines):
"""
Find the line indices where the title field starts and ends.