feat: full heading parsing also before headings

Signed-off-by: Konstantin Fickel <mail@konstantinfickel.de>
This commit is contained in:
Konstantin Fickel 2025-06-20 21:46:05 +02:00
parent 6d61d67d2e
commit 63ce959d4c
2 changed files with 85 additions and 16 deletions

View file

@ -142,7 +142,7 @@ class TestParseProcess:
),
)
def test_parse_split_at_headin_if_marker_on_subheading(self):
def test_parse_split_at_heading_if_marker_on_subheading(self):
file_text = "# Heading @Tag1\n\n## @Marker1 Subheading @Tag2\n\n# Heading @Tag3"
assert parse_markdown_file(self.file_name, file_text) == StreamFile(
@ -159,21 +159,24 @@ class TestParseProcess:
start_line=1,
end_line=4,
children=[
Shard(
markers=[],
tags=[],
start_line=2,
end_line=2,
children=[],
),
Shard(
markers=["Marker1"],
tags=["Tag2"],
start_line=3,
end_line=4,
children=[],
)
),
],
),
Shard(
markers=[],
tags=["Tag3"],
start_line=5,
end_line=5,
children=[],
markers=[], tags=["Tag3"], start_line=5, end_line=5, children=[]
),
],
),
@ -192,3 +195,32 @@ class TestParseProcess:
children=[],
),
)
def test_continue_full_parsing_before_headings_start(self):
file_text = "Hello\n\n@Marker1 World!\n\n# @Marker2 I'm a heading!"
assert parse_markdown_file(self.file_name, file_text) == StreamFile(
filename=self.file_name,
shard=Shard(
markers=[],
tags=[],
start_line=1,
end_line=5,
children=[
Shard(
markers=["Marker1"],
tags=[],
start_line=3,
end_line=3,
children=[],
),
Shard(
markers=["Marker2"],
tags=[],
start_line=5,
end_line=5,
children=[],
),
],
),
)