-
Notifications
You must be signed in to change notification settings - Fork 28
Adding talk brainstorming section #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,3 +9,10 @@ list-style: circle | |
| excerpts: | ||
| --- | ||
| ``` | ||
|
|
||
| ```{toctree} | ||
| :caption: Secciones | ||
| :hidden: true | ||
|
|
||
| talk-brainstorming.md | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| """A directive to generate an iframe with a Notion page.""" | ||
|
|
||
| from docutils import nodes | ||
| from docutils.parsers.rst import Directive | ||
| from sphinx.application import Sphinx | ||
| from sphinx.util import logging | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| TEMPLATE: str = """ | ||
| <iframe src="{url}" width="100%" height="1200" frameborder="0" allowfullscreen> | ||
| </iframe> | ||
| """ | ||
|
|
||
|
|
||
| class Notion(Directive): | ||
| has_content = True | ||
| final_argument_whitespace = False | ||
|
|
||
| def run(self): | ||
| if not self.content: | ||
| raise self.error("Notion directive requires a URL") | ||
| if len(self.content) > 1: | ||
| raise self.error("Notion directive only accepts a single URL") | ||
| url = self.content[0] | ||
| # Basic validation that it's a Notion URL | ||
| if not url.startswith(("https://notion.site", "https://www.notion.so")) and "notion" not in url: | ||
| raise self.error("URL does not appear to be a valid Notion URL") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion URL validation could be more robust. The current validation allows any URL containing "notion" which could be too permissive. Consider using a more restrictive pattern or providing a warning when falling back to this looser check. - if not url.startswith(("https://notion.site", "https://www.notion.so")) and "notion" not in url:
+ if url.startswith(("https://notion.site", "https://www.notion.so")):
+ pass # Standard Notion URLs are fine
+ elif "notion" in url:
+ logger.warning(f"URL {url} doesn't use standard Notion domains but contains 'notion'. Proceeding with caution.")
+ else:
raise self.error("URL does not appear to be a valid Notion URL")
|
||
|
|
||
| para = nodes.raw( | ||
| "", TEMPLATE.format(url=url), format="html" | ||
|
jpchauvel marked this conversation as resolved.
Outdated
|
||
| ) | ||
| return [para] | ||
|
jpchauvel marked this conversation as resolved.
|
||
|
|
||
|
|
||
| def setup(app: Sphinx): | ||
| app.add_directive("notion",Notion) | ||
|
|
||
| return { | ||
| "version": "0.1", | ||
| "parallel_read_safe": True, | ||
| "parallel_write_safe": True, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Brainstorming de Charlas | ||
|
|
||
| ```{notion} https://forested-roadrunner-0a7.notion.site/ebd/1e114afe2a67809c9ff0eb9429b1d3c7?v=1e114afe2a6780d88e41000c2debb2b5 | ||
| ``` |
Uh oh!
There was an error while loading. Please reload this page.