notionary 0.2.9__py3-none-any.whl → 0.2.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,9 +44,9 @@ class PageContentWriter(LoggingMixin):
44
44
  )
45
45
  append_divider = False
46
46
 
47
- # Append divider in markdown format as it will be converted to a Notion divider block
47
+ # Append divider in markdown format as it will be converted to a Notion divider block (eher davor als danach wie ich finde.)
48
48
  if append_divider:
49
- markdown_text = markdown_text + "\n---"
49
+ markdown_text = markdown_text + "---\n"
50
50
 
51
51
  markdown_text = self._process_markdown_whitespace(markdown_text)
52
52
 
@@ -86,7 +86,6 @@ class MarkdownToNotionConverter:
86
86
  result = self._process_line_for_spacers(
87
87
  line,
88
88
  processed_lines,
89
- found_first_heading,
90
89
  last_line_was_spacer,
91
90
  last_non_empty_was_heading,
92
91
  )
@@ -115,7 +114,6 @@ class MarkdownToNotionConverter:
115
114
  self,
116
115
  line: str,
117
116
  processed_lines: List[str],
118
- found_first_heading: bool,
119
117
  last_line_was_spacer: bool,
120
118
  last_non_empty_was_heading: bool,
121
119
  ) -> Dict[str, bool]:
@@ -143,15 +141,21 @@ class MarkdownToNotionConverter:
143
141
 
144
142
  # Check if line is a heading
145
143
  if re.match(self.HEADING_PATTERN, line):
144
+ # Check if there's content before this heading (excluding spacers)
145
+ has_content_before = any(
146
+ processed_line.strip() and processed_line.strip() != self.SPACER_MARKER
147
+ for processed_line in processed_lines
148
+ )
149
+
146
150
  if (
147
- found_first_heading
151
+ has_content_before
148
152
  and not last_line_was_spacer
149
153
  and not last_non_empty_was_heading
150
154
  ):
151
- # Add spacer only if:
152
- # 1. Not the first heading
153
- # 2. Last non-empty line was not a heading
154
- # 3. Last line was not already a spacer
155
+ # Add spacer if:
156
+ # 1. There's content before this heading
157
+ # 2. Last line was not already a spacer
158
+ # 3. Last non-empty line was not a heading
155
159
  processed_lines.append(self.SPACER_MARKER)
156
160
  added_spacer = True
157
161
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: A toolkit to convert between Markdown and Notion blocks
5
5
  Home-page: https://github.com/mathisarends/notionary
6
6
  Author: Mathis Arends
@@ -32,13 +32,13 @@ notionary/exceptions/page_creation_exception.py,sha256=4v7IuZD6GsQLrqhDLriGjuG3M
32
32
  notionary/models/notion_block_response.py,sha256=gzL4C6K9QPcaMS6NbAZaRceSEnMbNwYBVVzxysza5VU,6002
33
33
  notionary/models/notion_database_response.py,sha256=FMAasQP20S12J_KMdMlNpcHHwxFKX2YtbE4Q9xn-ruQ,1213
34
34
  notionary/models/notion_page_response.py,sha256=r4fwMwwDocj92JdbSmyrzIqBKsnEaz4aDUiPabrg9BM,1762
35
- notionary/page/markdown_to_notion_converter.py,sha256=-IC2yJimrmJ7e5EorV-48V6V12n1VBmsOHKejZxAKCo,20909
35
+ notionary/page/markdown_to_notion_converter.py,sha256=s6ImGEx82QFvqZdpvRq57tFSkr9ouSPEp1Nol1orySE,21136
36
36
  notionary/page/notion_page.py,sha256=NDxAJaNk4tlKUrenhKBdnuvjlVgnxC0Z6fprf2LyNeE,18046
37
37
  notionary/page/notion_page_factory.py,sha256=2A3M5Ub_kV2-q7PPRqDgfwBjhkGCwtL5i3Kr2RfvvVo,7213
38
38
  notionary/page/notion_to_markdown_converter.py,sha256=vUQss0J7LUFLULGvW27PjaTFuWi8OsRQAUBowSYorkM,6408
39
39
  notionary/page/content/notion_page_content_chunker.py,sha256=xRks74Dqec-De6-AVTxMPnXs-MSJBzSm1HfJfaHiKr8,3330
40
40
  notionary/page/content/page_content_retriever.py,sha256=f8IU1CIfSTTT07m72-vgpUr_VOCsisqqFHQ1JeOhb3g,2222
41
- notionary/page/content/page_content_writer.py,sha256=LOn70vFLOzPoCP2vqH922eNEh96B3cNiBuI3eDy8yLA,7439
41
+ notionary/page/content/page_content_writer.py,sha256=RcS5qaU1arENUWhgAhlvAC7qWB74sMxpfGyE15qLdjY,7478
42
42
  notionary/page/metadata/metadata_editor.py,sha256=HI7m8Zn_Lz6x36rBnW1EnbicVS-4Q8NmCJYKN-OlY-c,5130
43
43
  notionary/page/metadata/notion_icon_manager.py,sha256=6a9GS5sT0trfuAb0hlF2Cw_Wc1oM59a1QA4kO9asvMA,2576
44
44
  notionary/page/metadata/notion_page_cover_manager.py,sha256=gHQSA8EtO4gbkMt_C3nKc0DF44SY_4ycd57cJSihdqk,2215
@@ -54,8 +54,8 @@ notionary/prompting/markdown_syntax_prompt_generator.py,sha256=_1qIYlqSfI6q6Fut1
54
54
  notionary/util/logging_mixin.py,sha256=b6wHj0IoVSWXbHh0yynfJlwvIR33G2qmaGNzrqyb7Gs,1825
55
55
  notionary/util/page_id_utils.py,sha256=EYNMxgf-7ghzL5K8lKZBZfW7g5CsdY0Xuj4IYmU8RPk,1381
56
56
  notionary/util/warn_direct_constructor_usage.py,sha256=vyJR73F95XVSRWIbyij-82IGOpAne9SBPM25eDpZfSU,1715
57
- notionary-0.2.9.dist-info/licenses/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
58
- notionary-0.2.9.dist-info/METADATA,sha256=jGlinb3fPeApuPrgNWsQd-srIx010SOYdf2b2dwFjQM,7521
59
- notionary-0.2.9.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
60
- notionary-0.2.9.dist-info/top_level.txt,sha256=fhONa6BMHQXqthx5PanWGbPL0b8rdFqhrJKVLf_adSs,10
61
- notionary-0.2.9.dist-info/RECORD,,
57
+ notionary-0.2.10.dist-info/licenses/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
58
+ notionary-0.2.10.dist-info/METADATA,sha256=PK9wuL7gA-Wi0HySvGYa3XOpd6gcSnZ2qGCuW7_1DzY,7522
59
+ notionary-0.2.10.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
60
+ notionary-0.2.10.dist-info/top_level.txt,sha256=fhONa6BMHQXqthx5PanWGbPL0b8rdFqhrJKVLf_adSs,10
61
+ notionary-0.2.10.dist-info/RECORD,,