File tree Expand file tree Collapse file tree 6 files changed +67
-3
lines changed
Expand file tree Collapse file tree 6 files changed +67
-3
lines changed Original file line number Diff line number Diff line change 215215 "embed",
216216 "gravatar",
217217 "sketchviz",
218+ "notion",
218219]
219220
220221myst_enable_extensions = [
433434 "image": "_static/logo/logo.png",
434435}
435436# Ensures og:image meta tag generation which is not always generated by sphinxext.opengraph
436- ogp_image = "_static/logo/logo.png"
437+ ogp_image = "_static/logo/logo.png"
Original file line number Diff line number Diff line change @@ -9,3 +9,10 @@ list-style: circle
99excerpts:
1010---
1111```
12+
13+ ```{toctree}
14+ :caption: Secciones
15+ :hidden: true
16+
17+ talk-brainstorming.md
18+ ```
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def run(self):
3838
3939 data = {}
4040 if klass is not None:
41- data[' classes' ] = klass
41+ data[" classes" ] = klass
4242
4343 image = nodes.image(alt=alt, classes=klass, uri=url)
4444 return [image]
Original file line number Diff line number Diff line change 1+ """A directive to generate an iframe with a Notion page."""
2+
3+ import urllib.parse
4+
5+ from docutils import nodes
6+ from docutils.parsers.rst import Directive
7+ from sphinx.application import Sphinx
8+ from sphinx.util import logging
9+
10+ logger = logging.getLogger(__name__)
11+
12+ TEMPLATE: str = """
13+ <iframe src="{url}" width="100%" height="1200" frameborder="0" allowfullscreen>
14+ </iframe>
15+ """
16+
17+
18+ class Notion(Directive):
19+ has_content = True
20+ final_argument_whitespace = False
21+
22+ def run(self):
23+ if not self.content:
24+ raise self.error("Notion directive requires a URL")
25+ if len(self.content) > 1:
26+ raise self.error("Notion directive only accepts a single URL")
27+ url = self.content[0]
28+ # Basic validation that it's a Notion URL
29+ if (
30+ not url.startswith(
31+ ("https://notion.site", "https://www.notion.so")
32+ )
33+ and "notion" not in url
34+ ):
35+ raise self.error("URL does not appear to be a valid Notion URL")
36+
37+ para = nodes.raw(
38+ "",
39+ TEMPLATE.format(url=urllib.parse.quote(url, safe=":/?&=+")),
40+ format="html",
41+ )
42+ return [para]
43+
44+
45+ def setup(app: Sphinx):
46+ app.add_directive("notion", Notion)
47+
48+ return {
49+ "version": "0.1",
50+ "parallel_read_safe": True,
51+ "parallel_write_safe": True,
52+ }
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ Revisa nuestras normas de como integrarte en la comunidad de Python Perú.
7979```
8080
8181```{toctree}
82- :caption: Secciónes
82+ :caption: Secciones
8383:hidden: true
8484
8585about.md
Original file line number Diff line number Diff line change 1+ # Brainstorming de Charlas
2+
3+ ```{notion} https://forested-roadrunner-0a7.notion.site/ebd/1e114afe2a67809c9ff0eb9429b1d3c7?v=1e114afe2a6780d88e41000c2debb2b5
4+ ```
You can’t perform that action at this time.
0 commit comments