We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fdebdb5 commit 0799a50Copy full SHA for 0799a50
ext/notion.py
@@ -18,8 +18,17 @@ class Notion(Directive):
18
final_argument_whitespace = False
19
20
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
+
30
para = nodes.raw(
- "", TEMPLATE.format(url=self.content[0]), format="html"
31
+ "", TEMPLATE.format(url=url), format="html"
32
)
33
return [para]
34
0 commit comments