notionary 0.2.8__tar.gz → 0.2.10__tar.gz

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.
Files changed (66) hide show
  1. {notionary-0.2.8 → notionary-0.2.10}/PKG-INFO +1 -1
  2. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/column_element.py +21 -14
  3. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/content/page_content_writer.py +2 -2
  4. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/markdown_to_notion_converter.py +11 -7
  5. {notionary-0.2.8 → notionary-0.2.10}/notionary/prompting/element_prompt_content.py +0 -1
  6. {notionary-0.2.8 → notionary-0.2.10}/notionary.egg-info/PKG-INFO +1 -1
  7. {notionary-0.2.8 → notionary-0.2.10}/setup.py +1 -1
  8. {notionary-0.2.8 → notionary-0.2.10}/LICENSE +0 -0
  9. {notionary-0.2.8 → notionary-0.2.10}/README.md +0 -0
  10. {notionary-0.2.8 → notionary-0.2.10}/notionary/__init__.py +0 -0
  11. {notionary-0.2.8 → notionary-0.2.10}/notionary/database/database_discovery.py +0 -0
  12. {notionary-0.2.8 → notionary-0.2.10}/notionary/database/models/page_result.py +0 -0
  13. {notionary-0.2.8 → notionary-0.2.10}/notionary/database/notion_database.py +0 -0
  14. {notionary-0.2.8 → notionary-0.2.10}/notionary/database/notion_database_factory.py +0 -0
  15. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/audio_element.py +0 -0
  16. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/bookmark_element.py +0 -0
  17. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/bulleted_list_element.py +0 -0
  18. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/callout_element.py +0 -0
  19. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/code_block_element.py +0 -0
  20. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/divider_element.py +0 -0
  21. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/embed_element.py +0 -0
  22. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/heading_element.py +0 -0
  23. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/image_element.py +0 -0
  24. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/mention_element.py +0 -0
  25. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/notion_block_element.py +0 -0
  26. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/numbered_list_element.py +0 -0
  27. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/paragraph_element.py +0 -0
  28. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/qoute_element.py +0 -0
  29. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/registry/block_registry.py +0 -0
  30. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/registry/block_registry_builder.py +0 -0
  31. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/table_element.py +0 -0
  32. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/text_inline_formatter.py +0 -0
  33. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/todo_element.py +0 -0
  34. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/toggle_element.py +0 -0
  35. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/toggleable_heading_element.py +0 -0
  36. {notionary-0.2.8 → notionary-0.2.10}/notionary/elements/video_element.py +0 -0
  37. {notionary-0.2.8 → notionary-0.2.10}/notionary/exceptions/database_exceptions.py +0 -0
  38. {notionary-0.2.8 → notionary-0.2.10}/notionary/exceptions/page_creation_exception.py +0 -0
  39. {notionary-0.2.8 → notionary-0.2.10}/notionary/models/notion_block_response.py +0 -0
  40. {notionary-0.2.8 → notionary-0.2.10}/notionary/models/notion_database_response.py +0 -0
  41. {notionary-0.2.8 → notionary-0.2.10}/notionary/models/notion_page_response.py +0 -0
  42. {notionary-0.2.8 → notionary-0.2.10}/notionary/notion_client.py +0 -0
  43. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/content/notion_page_content_chunker.py +0 -0
  44. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/content/page_content_retriever.py +0 -0
  45. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/metadata/metadata_editor.py +0 -0
  46. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/metadata/notion_icon_manager.py +0 -0
  47. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/metadata/notion_page_cover_manager.py +0 -0
  48. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/notion_page.py +0 -0
  49. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/notion_page_factory.py +0 -0
  50. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/notion_to_markdown_converter.py +0 -0
  51. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/properites/database_property_service.py +0 -0
  52. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/properites/page_property_manager.py +0 -0
  53. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/properites/property_formatter.py +0 -0
  54. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/properites/property_value_extractor.py +0 -0
  55. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/relations/notion_page_relation_manager.py +0 -0
  56. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/relations/notion_page_title_resolver.py +0 -0
  57. {notionary-0.2.8 → notionary-0.2.10}/notionary/page/relations/page_database_relation.py +0 -0
  58. {notionary-0.2.8 → notionary-0.2.10}/notionary/prompting/markdown_syntax_prompt_generator.py +0 -0
  59. {notionary-0.2.8 → notionary-0.2.10}/notionary/util/logging_mixin.py +0 -0
  60. {notionary-0.2.8 → notionary-0.2.10}/notionary/util/page_id_utils.py +0 -0
  61. {notionary-0.2.8 → notionary-0.2.10}/notionary/util/warn_direct_constructor_usage.py +0 -0
  62. {notionary-0.2.8 → notionary-0.2.10}/notionary.egg-info/SOURCES.txt +0 -0
  63. {notionary-0.2.8 → notionary-0.2.10}/notionary.egg-info/dependency_links.txt +0 -0
  64. {notionary-0.2.8 → notionary-0.2.10}/notionary.egg-info/requires.txt +0 -0
  65. {notionary-0.2.8 → notionary-0.2.10}/notionary.egg-info/top_level.txt +0 -0
  66. {notionary-0.2.8 → notionary-0.2.10}/setup.cfg +0 -0
@@ -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
@@ -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
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name="notionary",
5
- version="0.2.8",
5
+ version="0.2.10",
6
6
  packages=find_namespace_packages(include=["notionary*"]),
7
7
  install_requires=["httpx>=0.28.0", "python-dotenv>=1.1.0", "pydantic>=2.11.4"],
8
8
  author="Mathis Arends",
File without changes
File without changes
File without changes