docs(embedding): add raw-JS / prebuilt-bundle path#727
Conversation
Splits the HTML+JS section into a raw-JS subsection (drop the prebuilt static-embed.js bundle on a page with #root + #buckaroo-data) and the existing TypeScript / buckaroo-js-core subsection. Documents the late-bound fetch variant for data loaded after page render, and fixes the prior note that referenced a non-existent window.BuckarooStaticEmbed global — the bundle is ESM and auto-inits from DOM hooks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a8507e6c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <body> | ||
| <div id="root"></div> | ||
| <script id="buckaroo-data" type="application/json"> | ||
| {{ artifact_json_from_python }} |
There was a problem hiding this comment.
Avoid autoescaping the artifact JSON
When this example is copied into a Flask/Django/Jinja template with autoescaping enabled (the server-rendered backends suggested immediately below), {{ artifact_json_from_python }} will typically emit entities such as " inside the <script type="application/json"> body. Script contents are read verbatim by static-embed.js via textContent, so JSON.parse receives the escaped entities instead of JSON and the table fails to render. The docs should show a framework JSON helper or an explicitly safe JSON insertion pattern that also handles </script> safely.
Useful? React with 👍 / 👎.
📦 TestPyPI package publishedpip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.13.5.dev25760271609or with uv: uv pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.13.5.dev25760271609MCP server for Claude Codeclaude mcp add buckaroo-table -- uvx --from "buckaroo[mcp]==0.13.5.dev25760271609" --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo-table📖 Docs preview🎨 Storybook preview |
Summary
docs/source/articles/embedding.rstinto two clearly labelled paths: a raw-JS subsection that uses the prebuiltstatic-embed.jsbundle (works today, no build step), and the existing TypeScript /buckaroo-js-coresubsection (lands when the npm package publishes).<script id="buckaroo-data">+<div id="root">— plus a late-boundfetch(...) → import("./static-embed.js")variant for data not known at page-render time.window.BuckarooStaticEmbed; the bundle is built as ESM (packages/js/package.jsonbuild:static) and does not expose that global. Replaced with a pointer to the new raw-JS path.Test plan
sphinx-build -b html source /tmp/out— embedding.rst builds with no new warnings (the 11 reported warnings are all pre-existing in other files: duplicateusinglabels, an unknownembedding-guideref indastardly-dataframe-dataset.rst, and a syntax warning inhistograms.rst).articles/embedding.html.🤖 Generated with Claude Code