DEV Community

Your experience with embedded JS code snippets

Drakso on January 04, 2018

I am building a simple website with small but useful code examples of how javascript works for people that are new to the language. It is nothing f...
Collapse
 
orkon profile image
Alex Rudenko

Have you considered using highlightjs.org/ for your website? It worked quite well for me (and it's easy to combine with Markdown). But I didn't need to execute code snippets and display the results. If you need that, I guess something like JsFiddle or CodePen is the way to go.

Collapse
 
drakso profile image
Drakso

This is a great alternative Alex. Executing code snippets really saves me time by showing an interactive version of the utility I am trying to present, instead of me coding an interactive example. Even tho this library does not support that feature, I really like that it would make the site load almost instantly. I could probably code some of the examples by hand if I really want users to interact with the example. Thanks :)

Collapse
 
artlantis profile image
Oğuz Çelikdemir

Try to Klipse which is available code execution feature.

Collapse
 
drakso profile image
Drakso

It will be hard to showcase manipulation of DOM with this, but I will definitely have this in mind. Unlike all other alternatives, this actually lets the user type in his own code in the example ( CodePen has the option, but you have to pay ). I am impressed!

Collapse
 
callistom profile image
callistorr90

Have you tried stackblitz.com/? Here is a embed example: stackblitz.com/edit/sdk-create-pro...