How to Put Fully Interactive, Runnable Code in a Medium Post
Published on August 29, 2018
Categories:
useful tips
,
Medium
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.
Notes
- 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
Besides embedding code in your articles, repl.it has a great discussion forum and interactive exercises to learn coding.
I welcome comments, feedback, or constructive criticism and can be reached on Twitter @koehrsen_will.