{{ message }}
add pages of examples translated from ObservablePlot docs - #72
Draft
jamesscottbrown wants to merge 20 commits into
Draft
add pages of examples translated from ObservablePlot docs#72jamesscottbrown wants to merge 20 commits into
jamesscottbrown wants to merge 20 commits into
Conversation
gka
requested changes
May 29, 2025
gka
left a comment
Contributor
There was a problem hiding this comment.
Hey, I really like this idea, thanks for working on it.
Actually, a proper "examples" section was on my todo list for a while now, too.
So I took your initiative as inspiration to get it working. The setup I came up with is a bit simpler, you can find it in the repo now under /src/routes/examples.
A couple of differences in my approach:
- each example plot must be in its own Svelte file, like this one
- the title is exported via
<script module> - the category pages automatically generate an index of all example plots, see https://svelteplot.dev/examples/line, for instance
- the example code is automatically added below the plot, like here https://svelteplot.dev/examples/axis/datawrapper-ticks
- I added a script
pnpm run screenshotsthat generates screenshots of all example plots so the index pages can show them as little thumbnails
Given this new setup, I'd suggest the following procedure for adding more examples, including from the Observable Plot gallery:
- For examples that are already supported in SveltePlot we can open PRs that include multiple examples at once. It would be nice if you could run the screenshot script before opening the PR.
- For examples that are not yet supported in SveltePlot I would prefer having separate PRs for each example, so we can hold off on merging until the features are implemented in SveltePlot (or we properly document API differences)
What do you think?
Contributor
Author
This was referenced May 29, 2025
This was referenced May 29, 2025
This was referenced May 29, 2025
This was referenced May 29, 2025
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.

I added some pages of examples auto-translated from the Observable Plot Plot gallery using my https://github.com/jamesscottbrown/Sveltify-plot tool (which is still a WIP, but good enough for these examples).
Lots of thing sworked, but this also surfaced some issues.