-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MDX support to the GUI API #73
Merged
Conversation
This file contains 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
…hs in mdx This gets around introducing custom syntax that isn't being processed by mdx
As far as I can tell it doesn't work for images without a predefined aspect ratio
- Remove <img src="" /> => data URL logic - Add .visible support
brentyi
approved these changes
Aug 8, 2023
yzslab
pushed a commit
to yzslab/viser
that referenced
this pull request
Oct 20, 2024
* Create JSX component that processes markdown using MDX 2 * Add markdown to the GUI API and style it on the client * Update Example 14 to be scoped per-client * Move GUI Handles for Folders, Tabs, and Markdown to _gui_handles.py * Use regex literals to resolve 'Unsupported Escape Sequence' warnings * Update interface to intake a image_root Path and replace relative paths in mdx This gets around introducing custom syntax that isn't being processed by mdx * Remove custom placeholder from markdown image As far as I can tell it doesn't work for images without a predefined aspect ratio * Tweak markdown support - Remove <img src="" /> => data URL logic - Add .visible support * Prettier --------- Co-authored-by: Brent Yi <[email protected]>
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.
Some of the code here is probably a bit weird, but this PR provides the ability for Viser to accept MDX from Python that gets rendered in real time on the client.
It does so with the interface:
Where
markdown
is the provided mdx andimages
is an optional dictionary of named local images that the mdx can draw from (alongside any remote images).Example 14 highlights an actual use case of how this works and the results, since the outcome is a little large for a screenshot.