notionary 0.1.21__py3-none-any.whl → 0.1.23__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.
@@ -155,4 +155,5 @@ class CodeBlockElement(NotionBlockElement):
155
155
  '```json\n{"name": "Alice", "age": 30}\n```',
156
156
  "```mermaid\nflowchart TD\n A --> B\n```",
157
157
  ],
158
- }
158
+ "avoid": "NEVER EVER wrap markdown content with ```markdown. Markdown should be written directly without code block formatting. NEVER use ```markdown under any circumstances."
159
+ }
@@ -1,4 +1,4 @@
1
- from typing import TypedDict, List
1
+ from typing import NotRequired, TypedDict, List
2
2
 
3
3
 
4
4
  class ElementPromptContent(TypedDict):
@@ -18,3 +18,7 @@ class ElementPromptContent(TypedDict):
18
18
 
19
19
  when_to_use: str
20
20
  """Guidelines explaining the appropriate scenarios for using this element."""
21
+
22
+ avoid: NotRequired[str]
23
+ """Optional field listing scenarios when this element should be avoided."""
24
+
@@ -15,21 +15,30 @@ 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.
37
+
38
+ 6. CONTENT FORMATTING - CRITICAL:
39
+ ❌ DO NOT include introductory phrases like "I understand that..." or "Here's the content...".
40
+ ✅ Provide ONLY the requested content directly without any prefacing text or meta-commentary.
41
+ ✅ Generate just the content itself, formatted according to these guidelines.
33
42
  """
34
43
 
35
44
  @staticmethod
@@ -58,8 +67,10 @@ and well-organized documents.
58
67
  f"**Example:** {content['examples'][0]}" if content["examples"] else "",
59
68
  f"**When to use:** {content['when_to_use']}",
60
69
  ]
70
+
71
+ if "avoid" in content and content["avoid"]:
72
+ doc_parts.append(f"**Avoid:** {content['avoid']}")
61
73
 
62
- # Filter out any empty parts and join with newlines
63
74
  return "\n".join([part for part in doc_parts if part])
64
75
 
65
76
  @classmethod
@@ -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."""
@@ -35,6 +35,7 @@ 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
  """
39
40
  try:
40
41
  blocks = self._markdown_to_notion_converter.convert(markdown_text)
@@ -171,4 +172,4 @@ class PageContentManager(LoggingMixin):
171
172
 
172
173
  async def get_text(self) -> str:
173
174
  blocks = await self.get_page_blocks_with_children()
174
- return self._notion_to_markdown_converter.convert(blocks)
175
+ return self._notion_to_markdown_converter.convert(blocks)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionary
3
- Version: 0.1.21
3
+ Version: 0.1.23
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/audio_element.py,sha256=KuPA30Ii0Bv0WcAOOze_XBB98W0kMZSSWZ3An
9
9
  notionary/elements/bookmark_element.py,sha256=hnDpAQsNfN1nUORuxfsEyg6Tustck1wcfynNumlLSFI,7931
10
10
  notionary/elements/bulleted_list_element.py,sha256=-0_CeCfjHOkgYmK6m8Jl6uQasp8HepwSojCJKh5NhPo,2721
11
11
  notionary/elements/callout_element.py,sha256=GA5vIhepgy7tuf4o18LWroVwuVEP08Hc-8zuKHBQKGs,4037
12
- notionary/elements/code_block_element.py,sha256=A7XTTPVCTd-djdgtY89qYG67RcLNeC3554qKegO4l3g,5573
12
+ notionary/elements/code_block_element.py,sha256=-dbh97VNOjMLr4mZ_M1KLk79jEENOcWjh83mjYONOZQ,5760
13
13
  notionary/elements/column_element.py,sha256=v2O5lgewFeA9YE99XqhPxp6ujtHW1LfMKclPDERqbeU,10794
14
14
  notionary/elements/divider_element.py,sha256=FUYc2rn7cSyHbuOlQdECJWVfMYcyY5BPDaSCyXkIESs,1988
15
15
  notionary/elements/embed_element.py,sha256=i4DaDk-xvCxIV-D-OwcEy1lng_eac8U1jDfKOyMVSnY,4382
@@ -25,9 +25,9 @@ notionary/elements/text_inline_formatter.py,sha256=wvUdbDPoiVXcSZEMWy_1RAN2UcwwA
25
25
  notionary/elements/todo_lists.py,sha256=gyktOvG1tSQvta_SjDauowfP__woJ9ySUHzwMwlN7Cg,3914
26
26
  notionary/elements/toggle_element.py,sha256=UZvvOeVlayMCoXi5bvYTreMq9-3W4TrP6Gs2uUJ8qsE,8149
27
27
  notionary/elements/video_element.py,sha256=37KzUkbUrxXgIxbhrq0iDAR_Mr-q7b4FlLTn7IonoKg,5513
28
- notionary/elements/prompts/element_prompt_content.py,sha256=DL60MqTLKSaSIT0AoByArw-L__glCkSf9y08oSpTLaE,666
29
- notionary/elements/prompts/synthax_prompt_builder.py,sha256=PBK4s9KhfzqsJN6KtRkk9re1sHGpxjFBx7-ueid-Q2s,3707
30
- notionary/elements/registry/block_element_registry.py,sha256=8SXhrDsuxg60W9NcLzb33nhq3rYY4E0OuHoMVPMlu0E,3325
28
+ notionary/elements/prompts/element_prompt_content.py,sha256=jAI-F_dYJrl9Xo5PKQVYpm7rnV54giqSo_9emiCwgT4,797
29
+ notionary/elements/prompts/synthax_prompt_builder.py,sha256=uXvuXJSwyEid8PAEKfK82ulZbLsKHAmI8h7IKAT5L-o,4397
30
+ notionary/elements/registry/block_element_registry.py,sha256=-SZSOz0ZBkToII948KtOge4bYQ0vhKG8ywHyCz7y8Mo,3574
31
31
  notionary/elements/registry/block_element_registry_builder.py,sha256=N5SqUqSxDoNDxg4iOwCu9KsfTYj_KD0832oNpwS-pSw,9042
32
32
  notionary/exceptions/database_exceptions.py,sha256=I-Tx6bYRLpi5pjGPtbT-Mqxvz3BFgYTiuZxknJeLxtI,2638
33
33
  notionary/exceptions/page_creation_exception.py,sha256=4v7IuZD6GsQLrqhDLriGjuG3ML638gAO53zDCrLePuU,281
@@ -36,7 +36,7 @@ notionary/page/notion_page.py,sha256=pJSy-vWFqQdCqmtFifL9AdUZpWoM0DzfblRBBBUTsTI
36
36
  notionary/page/notion_page_factory.py,sha256=UUEZ-cyEWL0OMVPrgjc4vJdcplEa1bO2yHCYooACYC8,8189
37
37
  notionary/page/notion_to_markdown_converter.py,sha256=qZIeZjDpeGFgW5RGTrcfi0mVI6NT0VvXeHM7jpP6ZHo,8067
38
38
  notionary/page/content/notion_page_content_chunker.py,sha256=xRks74Dqec-De6-AVTxMPnXs-MSJBzSm1HfJfaHiKr8,3330
39
- notionary/page/content/page_content_manager.py,sha256=gOynb6VTPsczD_HnjogUwslWYra0u1BEC5L-iMKIML4,6126
39
+ notionary/page/content/page_content_manager.py,sha256=u-OAMLNKrbuBjifh2PAKxW3L9fM0sbeHrW94etedsPw,6215
40
40
  notionary/page/metadata/metadata_editor.py,sha256=61uiw8oB25O8ePhytoJvZDetuof5sjPoM6aoHZGo4wc,4949
41
41
  notionary/page/metadata/notion_icon_manager.py,sha256=ixZrWsHGVpmF05Ncy9LCt8vZlKAQHYFZW-2yI5JZZDI,1426
42
42
  notionary/page/metadata/notion_page_cover_manager.py,sha256=qgQxQE-bx4oWjLFUQvpXD5GzO1Mx7w7htz1xC2BOqUg,1717
@@ -51,8 +51,8 @@ notionary/page/relations/page_database_relation.py,sha256=F9aGXFjjL8ZLNbfTGeGm_Q
51
51
  notionary/page/relations/relation_operation_result.py,sha256=NDxBzGntOxc_89ti-HG8xDSqfY6PwyGHKHrrKbCzNjM,5010
52
52
  notionary/util/logging_mixin.py,sha256=fKsx9t90bwvL74ZX3dU-sXdC4TZCQyO6qU9I8txkw_U,1369
53
53
  notionary/util/page_id_utils.py,sha256=EYNMxgf-7ghzL5K8lKZBZfW7g5CsdY0Xuj4IYmU8RPk,1381
54
- notionary-0.1.21.dist-info/licenses/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
55
- notionary-0.1.21.dist-info/METADATA,sha256=M7rUxxRbiAwAfAaNorGjJuSMbnkqahMTSYa_gLOkd5A,8342
56
- notionary-0.1.21.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
57
- notionary-0.1.21.dist-info/top_level.txt,sha256=fhONa6BMHQXqthx5PanWGbPL0b8rdFqhrJKVLf_adSs,10
58
- notionary-0.1.21.dist-info/RECORD,,
54
+ notionary-0.1.23.dist-info/licenses/LICENSE,sha256=zOm3cRT1qD49eg7vgw95MI79rpUAZa1kRBFwL2FkAr8,1120
55
+ notionary-0.1.23.dist-info/METADATA,sha256=9AUWVqDZ8PtJ6N_NvHzVDdCcw3MCxGrIuOC06JCJ3jY,8342
56
+ notionary-0.1.23.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
57
+ notionary-0.1.23.dist-info/top_level.txt,sha256=fhONa6BMHQXqthx5PanWGbPL0b8rdFqhrJKVLf_adSs,10
58
+ notionary-0.1.23.dist-info/RECORD,,