File size: 917 Bytes
ba9555f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import re

def extract_points(markdown_text: str) -> list[str]:
    """
    Extracts numbered/bulleted markdown points as clean strings.
    
    Removes:
    - markdown bold/italic/code formatting
    - numbering/bullets
    - extra spaces/newlines
    """

    lines = markdown_text.splitlines()
    points = []

    for line in lines:
        line = line.strip()

        if not line:
            continue

        # Match numbered or bulleted list items
        if re.match(r"^(\d+\.\s+|[-*]\s+)", line):

            # Remove numbering/bullets
            line = re.sub(r"^(\d+\.\s+|[-*]\s+)", "", line)

            # Remove markdown formatting
            line = re.sub(r"\*\*(.*?)\*\*", r"\1", line)   # bold
            line = re.sub(r"\*(.*?)\*", r"\1", line)       # italic
            line = re.sub(r"`(.*?)`", r"\1", line)         # inline code

            points.append(line.strip())

    return points