Repository navigation
Support MySTRA Viewer embedding in article and book themes - #16
Merged
Merged
Conversation
Contributor
|
Lightcone previews: Paper · Playground — inventory, viewers, dialogs and glyphs 1a0fbcc · @astra-spec/ui 0.0.5 from 9c940eb · Lightcone brand 0.0.3 · astra-theme 1a0fbcc · content 3735fcc · MySTRA https://github.com/LightconeResearch/MySTRA/releases/download/v0.0.8/mystra.mjs |
Import maps redirect JavaScript module imports to the public prefix, but font and image URLs inside the compiled CSS bundles are still root-relative and 404 behind the viewer prefix. Serve those CSS files through a small rewrite route that prepends the prefix, leaving the compiled files on disk untouched so standalone sessions keep working. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbuPkemydX136SpURMmW1S
Resolves conflicts with the shared-UI rendering work from PR #17: - root.tsx: keep the bundled stylesheets in <head> so embedded sessions can prefix them, while adopting main's brand class and theme attributes and dropping the Google Fonts links now that the brand package bundles them. - AstraOutput: wrap the prefixed decision link in main's InlineReference. - @myst-theme/site patch: regenerated against the pristine 1.3.1 sources so it carries both the useLocalStorage option and main's themeAttributes. - README: keep both the embedding contract and the shared-rendering notes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbuPkemydX136SpURMmW1S
EiffL
marked this pull request as ready for review
September 10, 2026 13:01
- Validate MYSTRA_BASE_URL as JupyterHub emits it: percent-encoded, '@' and '~' literal, no trailing slash, regex-safe for Express paths; require the three MYSTRA_* variables together so the server and page agree. - Compile the Remix root route from the decoded prefix, since the router matches decoded pathnames while Express matches raw ones. - Keep the bundled stylesheets in links() and prefix them as they are served, so the root error page stays styled and the cascade order matches main. - Cache the rewritten stylesheets with immutable headers; register the capabilities endpoint only in prefix mode. - Reduce previewHref to a single guard and PreviewReload to MyST's reload message with backed-off reconnects; no reload on reopen. - Derive the @myst-theme/site patch from main's with only the local-storage hunks added. - Document that hosts must relay X-Remix-* response headers, and the known limitation for client-side navigation to non-page files. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VbuPkemydX136SpURMmW1S
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ASTRA article and book applications assume root asset URLs and a directly reachable MyST reload port, which prevents faithful embedding behind Jupyter authentication. This adds optional
mystra-viewer.v1support so Lightcone can display the actual selected theme under a per-project URL prefix. It is the theme half of LightconeResearch/jupyterlab-lightcone#11; the companion viewer is LightconeResearch/jupyterlab-lightcone#19.The host sets
MYSTRA_BASE_URL,MYSTRA_CONTENT_URLandMYSTRA_RELOAD_URLtogether and starts the normalmyst start. Without them nothing changes.What the production server does under a prefix (
themes/*/server.js, byte-identical):links()and the font/image URLs inside compiled CSS as they are served, so the files on disk stay reusable by standalone sessions. Stylesheets keep theirlinks()order and remain on the root error page.GET <prefix>/mystra-capabilitiesfor the host's readiness probe.What the application does (
root.tsx,loaders.server.ts,packages/astra):@myst-theme/sitepatch).The README specifies the host contract, including that the proxy must relay
X-Remix-*response headers (fixed on the viewer side in the companion PR), and notes the one known limitation: Remix 1 navigates same-origin redirects in-app, so client-side navigation to a non-page file MyST did not mark static still lands on the content URL without a route.Validation:
/user/j%C3%B6rg@x/site: home and pages render with every asset, stylesheet, ASTRA and nav link prefixed;?_datarequests return data, index redirects carry prefixedLocation/X-Remix-Redirect, static files redirect to the public content URL, and the root error page keeps its stylesheets. Standalone start is unchanged and no longer exposes the capabilities endpoint.🤖 Generated with Claude Code
https://claude.ai/code/session_01VbuPkemydX136SpURMmW1S