diff --git a/fasthtml/_modidx.py b/fasthtml/_modidx.py
index 99e028ba..f8cc3bbd 100644
--- a/fasthtml/_modidx.py
+++ b/fasthtml/_modidx.py
@@ -116,8 +116,7 @@
'fasthtml.js.SortableJS': ('api/js.html#sortablejs', 'fasthtml/js.py'),
'fasthtml.js.dark_media': ('api/js.html#dark_media', 'fasthtml/js.py'),
'fasthtml.js.light_media': ('api/js.html#light_media', 'fasthtml/js.py')},
- 'fasthtml.jupyter': { 'fasthtml.jupyter.FT._repr_markdown_': ('api/jupyter.html#ft._repr_markdown_', 'fasthtml/jupyter.py'),
- 'fasthtml.jupyter.HTMX': ('api/jupyter.html#htmx', 'fasthtml/jupyter.py'),
+ 'fasthtml.jupyter': { 'fasthtml.jupyter.HTMX': ('api/jupyter.html#htmx', 'fasthtml/jupyter.py'),
'fasthtml.jupyter.JupyUvi': ('api/jupyter.html#jupyuvi', 'fasthtml/jupyter.py'),
'fasthtml.jupyter.JupyUvi.__init__': ('api/jupyter.html#jupyuvi.__init__', 'fasthtml/jupyter.py'),
'fasthtml.jupyter.JupyUvi.start': ('api/jupyter.html#jupyuvi.start', 'fasthtml/jupyter.py'),
@@ -126,6 +125,7 @@
'fasthtml.jupyter.is_port_free': ('api/jupyter.html#is_port_free', 'fasthtml/jupyter.py'),
'fasthtml.jupyter.nb_serve': ('api/jupyter.html#nb_serve', 'fasthtml/jupyter.py'),
'fasthtml.jupyter.nb_serve_async': ('api/jupyter.html#nb_serve_async', 'fasthtml/jupyter.py'),
+ 'fasthtml.jupyter.render_ft': ('api/jupyter.html#render_ft', 'fasthtml/jupyter.py'),
'fasthtml.jupyter.show': ('api/jupyter.html#show', 'fasthtml/jupyter.py'),
'fasthtml.jupyter.wait_port_free': ('api/jupyter.html#wait_port_free', 'fasthtml/jupyter.py'),
'fasthtml.jupyter.ws_client': ('api/jupyter.html#ws_client', 'fasthtml/jupyter.py')},
diff --git a/fasthtml/jupyter.py b/fasthtml/jupyter.py
index 7b70d5d1..53291869 100644
--- a/fasthtml/jupyter.py
+++ b/fasthtml/jupyter.py
@@ -3,8 +3,8 @@
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/06_jupyter.ipynb.
# %% auto 0
-__all__ = ['nb_serve', 'nb_serve_async', 'is_port_free', 'wait_port_free', 'show', 'htmx_config_port', 'JupyUvi', 'HTMX',
- 'ws_client']
+__all__ = ['nb_serve', 'nb_serve_async', 'is_port_free', 'wait_port_free', 'show', 'render_ft', 'htmx_config_port', 'JupyUvi',
+ 'HTMX', 'ws_client']
# %% ../nbs/api/06_jupyter.ipynb
import asyncio, socket, time, uvicorn
@@ -59,8 +59,10 @@ def show(*s):
if IN_NOTEBOOK: return _show(*s, Script('htmx.process(document.body)'))
return _show(*s)
-@patch
-def _repr_markdown_(self:FT): return to_xml(Div(self, Script('if (window.htmx) htmx.process(document.body)')))
+# %% ../nbs/api/06_jupyter.ipynb
+def render_ft():
+ @patch
+ def _repr_markdown_(self:FT): return to_xml(Div(self, Script('if (window.htmx) htmx.process(document.body)')))
# %% ../nbs/api/06_jupyter.ipynb
def htmx_config_port(port=8000):
diff --git a/nbs/api/06_jupyter.ipynb b/nbs/api/06_jupyter.ipynb
index 1b7c6755..080e76e8 100644
--- a/nbs/api/06_jupyter.ipynb
+++ b/nbs/api/06_jupyter.ipynb
@@ -137,7 +137,7 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "6a962b54",
+ "id": "654b36bb",
"metadata": {},
"outputs": [],
"source": [
@@ -145,10 +145,20 @@
"def show(*s):\n",
" \"Same as fasthtml.components.show, but also adds `htmx.process()`\"\n",
" if IN_NOTEBOOK: return _show(*s, Script('htmx.process(document.body)'))\n",
- " return _show(*s)\n",
- "\n",
- "@patch\n",
- "def _repr_markdown_(self:FT): return to_xml(Div(self, Script('if (window.htmx) htmx.process(document.body)')))"
+ " return _show(*s)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "6a962b54",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#| export\n",
+ "def render_ft():\n",
+ " @patch\n",
+ " def _repr_markdown_(self:FT): return to_xml(Div(self, Script('if (window.htmx) htmx.process(document.body)')))"
]
},
{