Convert roman numeral section headers to proper markdown headings.
(text: str)
| 260 | |
| 261 | |
| 262 | def _normalize_section_headings(text: str) -> str: |
| 263 | """Convert roman numeral section headers to proper markdown headings.""" |
| 264 | text = re.sub(r"\n([IVXLCDM]+)\.\s*\n\s*([A-Z][^\n]+)", r"\n## \1. \2", text) |
| 265 | text = re.sub(r"\n([A-Z])\.\s*\n\s*([A-Z][^\n]+)", r"\n### \1. \2", text) |
| 266 | text = re.sub(r"\n(\d+)\.\s*\n\s*([A-Z][^\n]+)", r"\n#### \1. \2", text) |
| 267 | text = re.sub(r"\n([IVXLCDM]+)\.\s+([A-Z][^\n]+)", r"\n## \1. \2", text) |
| 268 | return text |
| 269 | |
| 270 | |
| 271 | def _collapse_blank_lines(text: str) -> str: |