Skip to content

Commit 0799a50

Browse files
Update ext/notion.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent fdebdb5 commit 0799a50

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ext/notion.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ class Notion(Directive):
1818
final_argument_whitespace = False
1919

2020
def run(self):
21+
if not self.content:
22+
raise self.error("Notion directive requires a URL")
23+
if len(self.content) > 1:
24+
raise self.error("Notion directive only accepts a single URL")
25+
url = self.content[0]
26+
# Basic validation that it's a Notion URL
27+
if not url.startswith(("https://notion.site", "https://www.notion.so")) and "notion" not in url:
28+
raise self.error("URL does not appear to be a valid Notion URL")
29+
2130
para = nodes.raw(
22-
"", TEMPLATE.format(url=self.content[0]), format="html"
31+
"", TEMPLATE.format(url=url), format="html"
2332
)
2433
return [para]
2534

0 commit comments

Comments
 (0)