INNER CODE UNIT · Python

bold_text_before_colon

cognitivetech/ollama-ebook-summary · sum.py:175

def bold_text_before_colon(text: str) -> str:
    """Bold any text before the first colon that isn't already bolded."""
    pattern = r'^([ \t]*-[ \t]*)([a-zA-Z].*?):'
    replacement = r'\1**\2:**'
    return re.sub(pattern, replacement, text)

# -----------------------------
# Output Writing
# -----------------------------
def write_markdown_header(md_out, filename_no_ext: str, model: str, sanitized_model: str, api_base: str):
    """Write the initial headers and model information to the Markdown file."""
    md_out.write(f"# {filename_no_ext}\n\n")
    md_out.write(f"## {model}\n\n")  # Use the original model name for display

# -----------------------------
# Global or External Variables for ToC
# -----------------------------
toc_entries = []  # Will collect (level, heading_text) as we go

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…