diff --git a/Makefile b/Makefile
index f9755cd..c4cef16 100644
--- a/Makefile
+++ b/Makefile
@@ -50,3 +50,7 @@ clean-playground:
.PHONY: check-jq
check-jq:
which jq || (echo "jq is not installed. Please install jq to continue." && exit 1)
+
+convert-tdom-examples-to-ipynb:
+ python tools/convert_py_to_ipynb.py
+ @echo "Converted tdom examples to ipynb format."
\ No newline at end of file
diff --git a/content/boolean_attribute_value.ipynb b/content/boolean_attribute_value.ipynb
new file mode 100644
index 0000000..0895d17
--- /dev/null
+++ b/content/boolean_attribute_value.ipynb
@@ -0,0 +1,50 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "5b7d23a9",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "\"\"\"Boolean attribute values are reduced during rendering.\"\"\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "4e709496",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from tdom import html"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "c219302b",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def main():\n",
+ " \"\"\"Main entry point.\"\"\"\n",
+ " result = html(t\"
-
+
+
+
+
+
+
+
+
-
+
+
+
+
diff --git a/pyproject.toml b/pyproject.toml
index 05bddf6..af42824 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -5,7 +5,8 @@ description = "The https://t-strings.help/ website"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
-# "sphinx>=8.2.3",
+ # "sphinx>=8.2.3",
"jupyterlite-core[all]>=0.6.0b0",
"jupyterlite-pyodide-kernel>=0.6.0b1",
+ "jupytext>=1.17.1",
]
diff --git a/tools/convert_py_to_ipynb.py b/tools/convert_py_to_ipynb.py
new file mode 100644
index 0000000..9822fc5
--- /dev/null
+++ b/tools/convert_py_to_ipynb.py
@@ -0,0 +1,18 @@
+import json
+from pathlib import Path
+import jupytext, nbformat as nbf
+
+ROOT = Path(__file__).parent.parent
+TDOM = ROOT.parent / "tdom"
+OUT = ROOT / "content"
+OUT.mkdir(parents=True, exist_ok=True)
+
+notebooks = []
+
+for init_py in TDOM.joinpath("examples").rglob("__init__.py"):
+ name = init_py.parent.name # e.g. call_function
+ ipynb = OUT / f"{name}.ipynb"
+ nbf.write(jupytext.read(init_py), ipynb)
+ notebooks.append(name) # just the bare name
+
+(OUT / "notebooks.json").write_text(json.dumps(sorted(notebooks)))
diff --git a/uv.lock b/uv.lock
index ea56360..eb01aa1 100644
--- a/uv.lock
+++ b/uv.lock
@@ -306,12 +306,14 @@ source = { virtual = "." }
dependencies = [
{ name = "jupyterlite-core", extra = ["all"] },
{ name = "jupyterlite-pyodide-kernel" },
+ { name = "jupytext" },
]
[package.metadata]
requires-dist = [
{ name = "jupyterlite-core", extras = ["all"], specifier = ">=0.6.0b0" },
{ name = "jupyterlite-pyodide-kernel", specifier = ">=0.6.0b1" },
+ { name = "jupytext", specifier = ">=1.17.1" },
]
[[package]]
@@ -706,6 +708,22 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/55/36/b874e43c6e8cd1fc228bb024e5544b26fc3f52aab3f41286a8371e62ee99/jupyterlite_pyodide_kernel-0.6.0b1-py3-none-any.whl", hash = "sha256:d13b1342ffef08edf5484b98e7be0c826e4b8ba8669e8278219940bf48f3f432", size = 904176 },
]
+[[package]]
+name = "jupytext"
+version = "1.17.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "markdown-it-py" },
+ { name = "mdit-py-plugins" },
+ { name = "nbformat" },
+ { name = "packaging" },
+ { name = "pyyaml" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/6e/d9/b7acd3bed66c194cec1915c5bbec30994dbb50693ec209e5b115c28ddf63/jupytext-1.17.1.tar.gz", hash = "sha256:c02fda8af76ffd6e064a04cf2d3cc8aae242b2f0e38c42b4cd80baf89c3325d3", size = 3746897 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/12/b7/e7e3d34c8095c19228874b1babedfb5d901374e40d51ae66f2a90203be53/jupytext-1.17.1-py3-none-any.whl", hash = "sha256:99145b1e1fa96520c21ba157de7d354ffa4904724dcebdcd70b8413688a312de", size = 164286 },
+]
+
[[package]]
name = "libarchive-c"
version = "5.2"
@@ -715,6 +733,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/89/ef/b21525339880eda2ee8e9018b7c5f74e1856e5bde257dde54b9e2274b323/libarchive_c-5.2-py3-none-any.whl", hash = "sha256:9e6dfae09c9c47cd9348410967af547efe80dc619e2066f20941b57296f0435a", size = 15690 },
]
+[[package]]
+name = "markdown-it-py"
+version = "3.0.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "mdurl" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/38/71/3b932df36c1a044d397a1f92d1cf91ee0a503d91e470cbd670aa66b07ed0/markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb", size = 74596 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1", size = 87528 },
+]
+
[[package]]
name = "markupsafe"
version = "3.0.2"
@@ -755,6 +785,27 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/8f/8e/9ad090d3553c280a8060fbf6e24dc1c0c29704ee7d1c372f0c174aa59285/matplotlib_inline-0.1.7-py3-none-any.whl", hash = "sha256:df192d39a4ff8f21b1895d72e6a13f5fcc5099f00fa84384e0ea28c2cc0653ca", size = 9899 },
]
+[[package]]
+name = "mdit-py-plugins"
+version = "0.4.2"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "markdown-it-py" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/19/03/a2ecab526543b152300717cf232bb4bb8605b6edb946c845016fa9c9c9fd/mdit_py_plugins-0.4.2.tar.gz", hash = "sha256:5f2cd1fdb606ddf152d37ec30e46101a60512bc0e5fa1a7002c36647b09e26b5", size = 43542 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/a7/f7/7782a043553ee469c1ff49cfa1cdace2d6bf99a1f333cf38676b3ddf30da/mdit_py_plugins-0.4.2-py3-none-any.whl", hash = "sha256:0c673c3f889399a33b95e88d2f0d111b4447bdfea7f237dab2d488f459835636", size = 55316 },
+]
+
+[[package]]
+name = "mdurl"
+version = "0.1.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979 },
+]
+
[[package]]
name = "mistune"
version = "3.1.3"