notionary 0.2.8__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.
@@ -2,7 +2,7 @@ import re
2
2
  from typing import Dict, Any, Optional, List, Tuple, Callable
3
3
 
4
4
  from notionary.elements.notion_block_element import NotionBlockElement
5
- from notionary.prompting.element_prompt_content import ElementPromptContent
5
+ from notionary.prompting.element_prompt_content import ElementPromptBuilder, ElementPromptContent
6
6
 
7
7
 
8
8
  class ColumnElement(NotionBlockElement):
@@ -309,14 +309,19 @@ class ColumnElement(NotionBlockElement):
309
309
  """
310
310
  Returns structured LLM prompt metadata for the column layout element.
311
311
  """
312
- return {
313
- "description": "Creates a multi-column layout that displays content side by side.",
314
- "when_to_use": (
312
+ return (
313
+ ElementPromptBuilder()
314
+ .with_description(
315
+ "Creates a multi-column layout that displays content side by side."
316
+ )
317
+ .with_usage_guidelines(
315
318
  "Use columns sparingly, only for direct comparisons or when parallel presentation significantly improves readability. "
316
- "Best for pros/cons lists, feature comparisons, or pairing images with descriptions. "
317
- "Avoid overusing as it can complicate document structure."
318
- ),
319
- "syntax": (
319
+ "Best for pros/cons lists, feature comparisons, or pairing images with descriptions."
320
+ )
321
+ .with_avoidance_guidelines(
322
+ "Avoid overusing as it can complicate document structure. Do not use for simple content that works better in linear format."
323
+ )
324
+ .with_syntax(
320
325
  "::: columns\n"
321
326
  "::: column\n"
322
327
  "Content for first column\n"
@@ -325,8 +330,8 @@ class ColumnElement(NotionBlockElement):
325
330
  "Content for second column\n"
326
331
  ":::\n"
327
332
  ":::"
328
- ),
329
- "examples": [
333
+ )
334
+ .with_examples([
330
335
  "::: columns\n"
331
336
  "::: column\n"
332
337
  "## Features\n"
@@ -341,13 +346,15 @@ class ColumnElement(NotionBlockElement):
341
346
  "- Simplified workflows\n"
342
347
  ":::\n"
343
348
  ":::",
349
+
344
350
  "::: columns\n"
345
351
  "::: column\n"
346
352
  "![Image placeholder](/api/placeholder/400/320)\n"
347
353
  ":::\n"
348
354
  "::: column\n"
349
- "This text appears next to the image, creating a media-with-caption style layout that's perfect for documentation or articles.\n"
355
+ "This text appears next to the image, creating a media-with-caption style layout.\n"
350
356
  ":::\n"
351
- ":::",
352
- ],
353
- }
357
+ ":::"
358
+ ])
359
+ .build()
360
+ )
@@ -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
 
@@ -40,7 +40,6 @@ class ElementPromptContent:
40
40
  if not self.when_to_use:
41
41
  raise ValueError("Usage guidelines are required")
42
42
 
43
-
44
43
  class ElementPromptBuilder:
45
44
  """
46
45
  Builder class for creating ElementPromptContent with a fluent interface.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.2.8
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
@@ -9,7 +9,7 @@ notionary/elements/bookmark_element.py,sha256=msCtZvuPkIj1kiShNwE8i1GDYwamFb5mwR
9
9
  notionary/elements/bulleted_list_element.py,sha256=obsb3JqUNET3uS5OZM3yzDqxSzJzUuEob-Fzx0UIg9Y,2664
10
10
  notionary/elements/callout_element.py,sha256=ZsRvRtVy9kxdTwgrB5JGjZ4qcCiwcC0WimWJ_cW0aLY,4492
11
11
  notionary/elements/code_block_element.py,sha256=YHOiV2eQIe7gbsOnrsQnztomTZ-eP3HRHsonzrj3Tt8,7529
12
- notionary/elements/column_element.py,sha256=pUgu0e2vptvti2Mms_jcivSX0VmeBY9B1asCrVnXrxc,12476
12
+ notionary/elements/column_element.py,sha256=RGLgsL-6et3vJSfU6sTKGKPqRIEMsHqpQxflpEM9RLc,12692
13
13
  notionary/elements/divider_element.py,sha256=h6lzk4HITuBwHzxQU967QCWL4F8j2GfEOloWnZ8xs8E,2332
14
14
  notionary/elements/embed_element.py,sha256=Zcc18Kl8SGoG98P2aYE0TkBviRvSz-sYOdjMEs-tvgk,4579
15
15
  notionary/elements/heading_element.py,sha256=4X8LLhUb2oyfErQ5p-r0bq3wSR6TGSTSQjoVAhVnTO4,3166
@@ -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
@@ -49,13 +49,13 @@ notionary/page/properites/property_value_extractor.py,sha256=TZIbJXWcA1UQ7FutbGl
49
49
  notionary/page/relations/notion_page_relation_manager.py,sha256=tfkvLHClaYel_uEad1PIZ7yzhb2tXS-QrLn1CBvUuuw,11069
50
50
  notionary/page/relations/notion_page_title_resolver.py,sha256=dIjiEeHjjNT-DrIhz1nynkfHkMpUuJJFOEjb25Wy7f4,3575
51
51
  notionary/page/relations/page_database_relation.py,sha256=8lEp8fQjPwjWhA8nZu3k8mW6EEc54ki1Uwf4iUV1DOU,2245
52
- notionary/prompting/element_prompt_content.py,sha256=tHref-SKA81Ua_IQD2Km7y7BvFtHl74haSIjHNYE3FE,4403
52
+ notionary/prompting/element_prompt_content.py,sha256=tBhOL07bKcjC8OK03HcaC5jhFcVBk9cjRfBohKNO8H8,4401
53
53
  notionary/prompting/markdown_syntax_prompt_generator.py,sha256=_1qIYlqSfI6q6Fut10t6gGwTQuS8c3QBcC_5DBme9Mo,5084
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.8.dist-info/licenses/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
58
- notionary-0.2.8.dist-info/METADATA,sha256=RtbtcBYg8U9oqX64Tl2VD79bf199uwLZEqVD9QQ2jio,7521
59
- notionary-0.2.8.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
60
- notionary-0.2.8.dist-info/top_level.txt,sha256=fhONa6BMHQXqthx5PanWGbPL0b8rdFqhrJKVLf_adSs,10
61
- notionary-0.2.8.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,,