(sections: list[Section], anchor: str)
| 342 | |
| 343 | |
| 344 | def find_section_by_anchor(sections: list[Section], anchor: str) -> Optional[Section]: |
| 345 | target = anchor.lstrip("^") |
| 346 | for s in flatten_sections(sections): |
| 347 | if s.anchor == target: |
| 348 | return s |
| 349 | return None |
| 350 | |
| 351 | |
| 352 | def find_section_by_title(sections: list[Section], title: str) -> Optional[Section]: |