notionary 0.1.20__tar.gz → 0.1.22__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 (64) hide show
  1. {notionary-0.1.20 → notionary-0.1.22}/PKG-INFO +1 -1
  2. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/prompts/synthax_prompt_builder.py +10 -6
  3. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/registry/block_element_registry.py +7 -1
  4. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/registry/block_element_registry_builder.py +2 -2
  5. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/content/page_content_manager.py +26 -0
  6. {notionary-0.1.20 → notionary-0.1.22}/notionary.egg-info/PKG-INFO +1 -1
  7. {notionary-0.1.20 → notionary-0.1.22}/notionary.egg-info/SOURCES.txt +1 -2
  8. {notionary-0.1.20 → notionary-0.1.22}/setup.py +1 -1
  9. notionary-0.1.20/notionary/util/singleton_decorator.py +0 -20
  10. {notionary-0.1.20 → notionary-0.1.22}/LICENSE +0 -0
  11. {notionary-0.1.20 → notionary-0.1.22}/README.md +0 -0
  12. {notionary-0.1.20 → notionary-0.1.22}/notionary/__init__.py +0 -0
  13. {notionary-0.1.20 → notionary-0.1.22}/notionary/database/database_discovery.py +0 -0
  14. {notionary-0.1.20 → notionary-0.1.22}/notionary/database/database_info_service.py +0 -0
  15. {notionary-0.1.20 → notionary-0.1.22}/notionary/database/models/page_result.py +0 -0
  16. {notionary-0.1.20 → notionary-0.1.22}/notionary/database/notion_database.py +0 -0
  17. {notionary-0.1.20 → notionary-0.1.22}/notionary/database/notion_database_factory.py +0 -0
  18. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/audio_element.py +0 -0
  19. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/bookmark_element.py +0 -0
  20. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/bulleted_list_element.py +0 -0
  21. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/callout_element.py +0 -0
  22. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/code_block_element.py +0 -0
  23. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/column_element.py +0 -0
  24. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/divider_element.py +0 -0
  25. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/embed_element.py +0 -0
  26. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/heading_element.py +0 -0
  27. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/image_element.py +0 -0
  28. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/mention_element.py +0 -0
  29. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/notion_block_element.py +0 -0
  30. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/numbered_list_element.py +0 -0
  31. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/paragraph_element.py +0 -0
  32. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/prompts/element_prompt_content.py +0 -0
  33. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/qoute_element.py +0 -0
  34. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/table_element.py +0 -0
  35. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/text_inline_formatter.py +0 -0
  36. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/todo_lists.py +0 -0
  37. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/toggle_element.py +0 -0
  38. {notionary-0.1.20 → notionary-0.1.22}/notionary/elements/video_element.py +0 -0
  39. {notionary-0.1.20 → notionary-0.1.22}/notionary/exceptions/database_exceptions.py +0 -0
  40. {notionary-0.1.20 → notionary-0.1.22}/notionary/exceptions/page_creation_exception.py +0 -0
  41. {notionary-0.1.20 → notionary-0.1.22}/notionary/notion_client.py +0 -0
  42. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/content/notion_page_content_chunker.py +0 -0
  43. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/markdown_to_notion_converter.py +0 -0
  44. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/metadata/metadata_editor.py +0 -0
  45. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/metadata/notion_icon_manager.py +0 -0
  46. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/metadata/notion_page_cover_manager.py +0 -0
  47. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/notion_page.py +0 -0
  48. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/notion_page_factory.py +0 -0
  49. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/notion_to_markdown_converter.py +0 -0
  50. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/properites/database_property_service.py +0 -0
  51. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/properites/page_property_manager.py +0 -0
  52. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/properites/property_formatter.py +0 -0
  53. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/properites/property_operation_result.py +0 -0
  54. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/properites/property_value_extractor.py +0 -0
  55. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/relations/notion_page_relation_manager.py +0 -0
  56. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/relations/notion_page_title_resolver.py +0 -0
  57. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/relations/page_database_relation.py +0 -0
  58. {notionary-0.1.20 → notionary-0.1.22}/notionary/page/relations/relation_operation_result.py +0 -0
  59. {notionary-0.1.20 → notionary-0.1.22}/notionary/util/logging_mixin.py +0 -0
  60. {notionary-0.1.20 → notionary-0.1.22}/notionary/util/page_id_utils.py +0 -0
  61. {notionary-0.1.20 → notionary-0.1.22}/notionary.egg-info/dependency_links.txt +0 -0
  62. {notionary-0.1.20 → notionary-0.1.22}/notionary.egg-info/requires.txt +0 -0
  63. {notionary-0.1.20 → notionary-0.1.22}/notionary.egg-info/top_level.txt +0 -0
  64. {notionary-0.1.20 → notionary-0.1.22}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.1.20
3
+ Version: 0.1.22
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
@@ -15,21 +15,25 @@ Notion supports standard Markdown with some special extensions for creating rich
15
15
 
16
16
  {element_docs}
17
17
 
18
- Important usage guidelines:
18
+ CRITICAL USAGE GUIDELINES:
19
19
 
20
20
  1. Do NOT start content with a level 1 heading (# Heading). In Notion, the page title is already displayed in the metadata, so starting with an H1 heading is redundant. Begin with H2 (## Heading) or lower for section headings.
21
21
 
22
- 2. The backtick code fence syntax (```) should ONLY be used when creating actual code blocks or diagrams.
23
- Do not wrap examples or regular content in backticks unless you're showing code.
22
+ 2. BACKTICK HANDLING - EXTREMELY IMPORTANT:
23
+ NEVER wrap entire content or responses in triple backticks (```).
24
+ ❌ DO NOT use triple backticks (```) for anything except CODE BLOCKS or DIAGRAMS.
25
+ ❌ DO NOT use triple backticks to mark or highlight regular text or examples.
26
+ ✅ USE triple backticks ONLY for actual programming code, pseudocode, or specialized notation.
27
+ ✅ When showing Markdown syntax examples, use inline code formatting with single backticks.
24
28
 
25
29
  3. Use inline formatting (bold, italic, etc.) across all content to enhance readability.
26
- Proper typography is essential for creating scannable, well-structured documents.
30
+ Proper typography is essential for creating scannable, well-structured documents.
27
31
 
28
32
  4. Notion's extensions to Markdown provide richer formatting options than standard Markdown
29
- while maintaining the familiar Markdown syntax for basic elements.
33
+ while maintaining the familiar Markdown syntax for basic elements.
30
34
 
31
35
  5. Always structure content with clear headings, lists, and paragraphs to create visually appealing
32
- and well-organized documents.
36
+ and well-organized documents.
33
37
  """
34
38
 
35
39
  @staticmethod
@@ -14,7 +14,7 @@ class BlockElementRegistry:
14
14
  """
15
15
  Initialize a new registry instance.
16
16
  """
17
- self._elements = []
17
+ self._elements: List[NotionBlockElement] = []
18
18
 
19
19
  if elements:
20
20
  for element in elements:
@@ -33,6 +33,12 @@ class BlockElementRegistry:
33
33
  self._elements.remove(element_class)
34
34
  return True
35
35
  return False
36
+
37
+ def contains(self, element_class: Type[NotionBlockElement]) -> bool:
38
+ """
39
+ Check if the registry contains the specified element class.
40
+ """
41
+ return element_class in self._elements
36
42
 
37
43
  def clear(self):
38
44
  """Clear the registry completely."""
@@ -53,7 +53,7 @@ class BlockElementRegistryBuilder:
53
53
  .with_tables()
54
54
  .with_columns()
55
55
  .with_bulleted_list()
56
- .with_numberd_list()
56
+ .with_numbered_list()
57
57
  .with_toggles()
58
58
  .with_quotes()
59
59
  .with_todos()
@@ -186,7 +186,7 @@ class BlockElementRegistryBuilder:
186
186
  """
187
187
  return self.add_element(BulletedListElement)
188
188
 
189
- def with_numberd_list(self) -> BlockElementRegistryBuilder:
189
+ def with_numbered_list(self) -> BlockElementRegistryBuilder:
190
190
  """
191
191
  Add support for numbered list elements (ordered lists).
192
192
  """
@@ -35,7 +35,11 @@ class PageContentManager(LoggingMixin):
35
35
  async def append_markdown(self, markdown_text: str) -> str:
36
36
  """
37
37
  Append markdown text to a Notion page, automatically handling content length limits.
38
+ First strips out triple backtick markdown fences if they wrap the entire content.
38
39
  """
40
+ # Strip out triple backticks if they wrap the entire content
41
+ markdown_text = self._strip_wrapping_backticks(markdown_text)
42
+
39
43
  try:
40
44
  blocks = self._markdown_to_notion_converter.convert(markdown_text)
41
45
 
@@ -172,3 +176,25 @@ class PageContentManager(LoggingMixin):
172
176
  async def get_text(self) -> str:
173
177
  blocks = await self.get_page_blocks_with_children()
174
178
  return self._notion_to_markdown_converter.convert(blocks)
179
+
180
+ def _strip_wrapping_backticks(self, text: str) -> str:
181
+ """
182
+ Strip out triple backticks if they wrap the entire content.
183
+ This prevents LLM-generated markdown fences from breaking the Notion import.
184
+
185
+ Args:
186
+ text: The markdown text that might be wrapped in backticks
187
+
188
+ Returns:
189
+ The text with wrapping backticks removed, if present
190
+ """
191
+ lines = text.strip().split('\n')
192
+
193
+ if len(lines) >= 2:
194
+ first_line = lines[0].strip()
195
+ last_line = lines[-1].strip()
196
+
197
+ if first_line.startswith('```') and last_line == '```':
198
+ return '\n'.join(lines[1:-1])
199
+
200
+ return text
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.1.20
3
+ Version: 0.1.22
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
@@ -58,5 +58,4 @@ notionary/page/relations/notion_page_title_resolver.py
58
58
  notionary/page/relations/page_database_relation.py
59
59
  notionary/page/relations/relation_operation_result.py
60
60
  notionary/util/logging_mixin.py
61
- notionary/util/page_id_utils.py
62
- notionary/util/singleton_decorator.py
61
+ notionary/util/page_id_utils.py
@@ -2,7 +2,7 @@ from setuptools import setup, find_namespace_packages
2
2
 
3
3
  setup(
4
4
  name="notionary",
5
- version="0.1.20",
5
+ version="0.1.22",
6
6
  packages=find_namespace_packages(include=["notionary*"]),
7
7
  install_requires=[
8
8
  "httpx>=0.28.0",
@@ -1,20 +0,0 @@
1
- from typing import TypeVar
2
- from functools import wraps
3
-
4
- T = TypeVar("T")
5
-
6
-
7
- def singleton(cls: T) -> T:
8
- """
9
- Decorator zur Implementierung des Singleton-Musters.
10
- Stellt sicher, dass nur eine Instanz der Klasse existiert.
11
- """
12
- instances = {}
13
-
14
- @wraps(cls)
15
- def get_instance(*args, **kwargs):
16
- if cls not in instances:
17
- instances[cls] = cls(*args, **kwargs)
18
- return instances[cls]
19
-
20
- return get_instance
File without changes
File without changes
File without changes