If you want to embed a repl in another platform. This guide will show you how it can be done using iframe, on WordPress, and on Medium. You will also learn what happens if you want to edit an embedded repl.
You can embed repls in an iframe. This is useful if you want to integrate Replit into your app. If your app supports OEmbed, we already implement the standard, so simply copy and paste any Replit URL and it should work.
If you'd like to embed specific code, you must:
Here is an example:
And the HTML snippet for this:
<iframe frameborder="0" width="100%" height="500px" src="https://repl.it/@amasad/PitifulLastingWhoopingcrane?lite=true"></iframe>
You can also manually embed repls by using your own custom
iframe tags. These repls must have
?lite=true as a query parameter to be embedded. You can also include
outputonly=1 as a query parameter if you want to hide the editor in the embed. Note that the code is still accessible if the user opens the repl on Replit.
Note: To embed the spotlight view, use
?embed=true instead of
WordPress supports OEmbed but can only embed content from an approved whitelist of websites. Check out the WordPress documentation for instructions to add Replit to the whitelist. Once Replit is added, a repl URL formatted as https://replit.com/@username/repltitle will automatically embed an interactive copy of the repl into your WordPress site.
To embed your repl on Medium, simply paste the repl link (https://replit.com/@username/repl-name) into your medium post and hit "Enter". The repl should automatically be converted to the interactive IDE, where you can edit and run code. To resize the embedded repl, click on it, then select one of four choices that Medium presents to you.
If anyone edits an embedded repl, it will automatically fork the repl for them and they will be editing their own version. If the user is logged into Replit in their browser, the forked repl will become theirs and show up on their "My repls" dashboard. If the owner edits an embedded repl, those changes will be saved to the repl and become visible to others who view the embedded repl.