From 460e2683ec55225d2b4bd16e5ef0b631ad4bee1b Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 11 Jul 2026 15:51:20 +0100 Subject: [PATCH] refactor extract_section_content to improve section handling logic --- tools/search_md.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/search_md.py b/tools/search_md.py index d56115e..cff5412 100644 --- a/tools/search_md.py +++ b/tools/search_md.py @@ -284,18 +284,18 @@ def extract_section_content(content: str, section_type: str) -> str: return "" for line in lines: - if pattern.match(line): - in_section = True - section_level = len(line) - len(line.lstrip('#')) - continue - if in_section: if line.startswith('#'): current_level = len(line) - len(line.lstrip('#')) if current_level <= section_level: in_section = False - continue - section_content.append(line) + else: + section_content.append(line) + else: + section_content.append(line) + elif pattern.match(line): + in_section = True + section_level = len(line) - len(line.lstrip('#')) return '\n'.join(section_content)