mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

Make live demos on the website working for node.js examples

Open neokito opened this issue 7 years ago • 11 comments

Where http://mathjs.org/examples/advanced/custom_argument_parsing.js.html Custom argument parsing File: custom_argument_parsing.js (click for a live demo)

neokito avatar Dec 04 '18 00:12 neokito

Thanks for bringing this up.

The "live demo" link currently only works for the browser examples. We should either turn this link off for the node.js examples like custom_argument_parsing.js, or link it to a real live demo on RunKit or CodeSandbox or something like that.

josdejong avatar Dec 05 '18 09:12 josdejong

Anyone interested in picking this up?

josdejong avatar Dec 05 '18 09:12 josdejong

Sounds fun. What would you think about adding the interactive code demos to the examples page itself (the table of contents at the top of the page links to individual sections below), so visitors could play with all the demos right there? We could even include the relevant portions of the JS which visitors can edit in a small window, and see the results immediately. Then next to that is a link to the full JS/HTML like there is now.

ericman314 avatar Dec 05 '18 14:12 ericman314

ah, of course!! Embedded node.js example would be even better

josdejong avatar Dec 05 '18 14:12 josdejong

I've looked at a few code snippet hosting providers. JSFiddle has a nice, clean interface for embedded fiddles (https://docs.jsfiddle.net/embedding-fiddles) but they are not editable. Codepen can do editable embedded pens but it requires a pro account. Codesandbox can supposedly do it but I couldn't figure out how to make it work. Have any of you had any luck with anything else? We could do our own but it seems like it might take a lot of work.

ericman314 avatar Dec 06 '18 05:12 ericman314

I think it is okay do not allow support editing embedded snippets. As long is folk can click a link to get to an editable one.

Alternatively, I think runkit allows editable embedded snippets: https://runkit.com/docs/embed

harrysarson avatar Dec 06 '18 12:12 harrysarson

Some more options (I don't know if / how well they support embedding):

  • ~https://codepen.io~ doesn't support node.js
  • https://frontarm.com/demoboard/

josdejong avatar Dec 06 '18 18:12 josdejong

Another suggestion:

  • https://repl.it/languages/nodejs
  • https://codesandbox.io/pricing

rnd-debug avatar Oct 03 '20 18:10 rnd-debug

👍 I guess we should summarize pros/cons of the alternatives and pick a suitable one.

josdejong avatar Oct 05 '20 18:10 josdejong

A very small team and I are looking into this now! Was there ever internal discussion on which embedded node platform sounds best? One that I found while investigating was https://glitch.com, which seems to have a free tier that supports our needs and allows embedding.

Also, it looks like just the files in /examples and /examples/advanced need updating, does that sound right? I want to make sure there's no actual website code that needs updating in addition to these examples.

tmello01 avatar Apr 04 '23 11:04 tmello01

o nice, thanks👌

Yes, we'll have to see what a suitable solution is for embedded node.js examples. https://runkit.com can be interesting too, that's used by npm.

Also, it looks like just the files in /examples and /examples/advanced need updating, does that sound right?

That is correct

josdejong avatar Apr 04 '23 14:04 josdejong