-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Use remark-codesandbox for the code examples #3100
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
base: main
Are you sure you want to change the base?
Conversation
ed210b8 to
466918b
Compare
rickhanlonii
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool
| ">0.2%", | ||
| "not dead", | ||
| "not ie <= 11", | ||
| "not op_mini all" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know what will happen when people browse embedded codesandboxes on unsupported browsers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yes this is a good point. Most probably it will just be a console error, but I can catch this maybe and show a better message. By the way, which browsers do you aim to support with the runnable examples? I'll make sure they'll work in those browsers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question, these supported browser options seem fair to me but I defer to @gaearon.
|
Nice work @CompuIves ! |
In this PR I have replaced some code examples with
remark-codesandbox. In the repo we specify some template projects, which we then can refer to in our code blocks. For example:This code will take the
umdtemplate (defined in/codesandbox/examples/umd), and replace the entry file with this contents, and then create an embed with those contents included. Like this:We can specify as many templates as we want. For example, right now I've defined
umd(using script tags),simple(single file) andcra(CRA).I've also included some examples with line highlights! 😄
I'm curious what you think, I think another improvement would be to let this plugin replace the code blocks with something created with
react-sandpack. The advantages of using this are:I can work on a second version where we use
react-sandpackif you're interested!