-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Replace README Gist with CodeSandbox Example #3117
Conversation
Unfortunately, this won't work, as GitHub won't display the iframe and the readme here is fairly high traffic. |
Interesting, I didn't realize that github blocks it but it makes sense in retrospect. I'll pick a different code snippet to embed and link to this codesandbox example in the readme. |
Let's not mess with the readme just yet. I'd rather see how it works with a page somewhere inside of the docs. A great place to start would be the examples page, where we already have Codesandbox links: https://redux.js.org/introduction/examples |
Hmm. So I just tried playing around with this for a few minutes with the Counter item in the Examples page:
Also, when I hit save in the Gitbook editor, it created a commit that touched 140 files, including renaming every markdown file in the repo to lowercase and a bunch of other stuff. Not cool. I reverted that. I do note that the embed-via-UI attempt produced this:
Yes, that's rather ugly. It's an escaped JS object in a string. Ew. @SamyPesse , is it actually possible to get a CodeSandbox editor embedded in a page? The Gitbook docs page on Embeds shows a CodePen that is editable in page after clicking on it. |
Do both Gitbook and Codesandbox support oEmbed? |
GitBook should support Codesandbox embeds (it uses iframely.com). Since embeds doesn't exist in Markdown, We serialize it as a liquid tag with some JSON ( Solution 1: HTML Comments for GitBook specific contentOne thing that could work, will be for GitBook to support some special HTML comments that will be hidden on GitHub, but visible on GitBook. Something like (better syntax ideas are welcome):
Solution 2: GitBook should parse iframe tags as embedsOr the other (probably better) solution will be for GitBook to support iframe HTML tags (not as iframe itself, but as embeds). The iframe will be stripped by GitHub, but the embed will be visible on GitBook.
Yep sorry, I've mentioned a few months ago that you should not edit on the platform since it'll try to normalize the content (we don't store Markdown on our end). It works well for repositories that started using GitBook from day one, or are using GitBook as the main source of edits. But it results in a massive first commit for documentation like Redux. |
Sorry for being MIA for a bit. The last few weeks have been hectic. I'm happy to spend some time tonight / this week updating the examples Tim linked above. I can use the liquid tag example that Mark & Samy gave if that's desirable. One thing to note, when I ran gitbook locally, the iframe embed did seem to work. If there is a different way I should be testing please let me know! |
@dan-kez: yeah, if you can play with this a bit more and see if there's a combo that does work right now, I'd appreciate it. Thanks! |
We've just released an improvement for embeds, inserting the following code in the README will show the CodeSandbox on GitBook:
|
I feel terrible - this totally slipped my mind after I got back from vacation. Happy to hear the update @SamyPesse . I will update this PR today. |
6e8f7da
to
ad7c9ca
Compare
@SamyPesse I just updated the PR to utilize the embed tag you noted above. It works perfectly. The only draw back is that I wasn't able to figure out a way to hide the I attempted the following:
@timdorr I also removed the codesandbox snippet from the README as requested. If we can figure out a way to hide the |
Closing this out since we're on Docusaurus now. Feel free to rebuild this for that system, though! |
Hi All!
Per the request in issue #2590 (comment) I added a codesandbox example for the main Redux gist presently on the README.