How to Put Fully Interactive, Runnable Code in a Medium Post
Code is meant to be interactive.
- Head to repl.it
- Write some code in your favorite language.
- Copy and paste the url for your repl into a Medium post.
- Publish the post to make the code interactive.
Interactive code. In a Medium article! (from repl.it).
Feel free to play around with the code above. This is a simple example, but you can create complex scripts for readers to run in many languages.
- The code is only fully interactive after you publish
- You can add packages, data files, or include multiple scripts in your repl
- This does work on mobile although not perfectly
- Each time the page is reloaded, the packages are installed
I welcome comments, feedback, or constructive criticism and can be reached on Twitter @koehrsen_will.