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)